From dbfb34ffab5ca88e3e7deb1a2dd97734c52c3cbd Mon Sep 17 00:00:00 2001 From: ttang Date: Thu, 15 Jun 2023 16:32:32 +0800 Subject: [PATCH 1/2] fix: new issues --- packages/client/dashboard/src/App.tsx | 1 + .../dashboard/src/components/MergeModal.tsx | 48 +++++++++++-------- .../dashboard/src/components/ModelList.tsx | 16 +++++-- .../client/dashboard/src/components/Nav.tsx | 35 +++++--------- 4 files changed, 54 insertions(+), 46 deletions(-) diff --git a/packages/client/dashboard/src/App.tsx b/packages/client/dashboard/src/App.tsx index 8c5f5ee3..dd77ad70 100644 --- a/packages/client/dashboard/src/App.tsx +++ b/packages/client/dashboard/src/App.tsx @@ -41,6 +41,7 @@ function Routers() { } /> } /> + } /> } /> diff --git a/packages/client/dashboard/src/components/MergeModal.tsx b/packages/client/dashboard/src/components/MergeModal.tsx index 6d7d0a60..9dea7711 100644 --- a/packages/client/dashboard/src/components/MergeModal.tsx +++ b/packages/client/dashboard/src/components/MergeModal.tsx @@ -81,30 +81,40 @@ export default function MergeModal({ setModels(v) }} > - - {dappModels.map((item) => { - return ( - - - {item.stream_content.name} - - ) - })} + {(dappModels.length === 0 && ( +

This Dapp has no model available to be merged.

+ )) || ( + <> + + {dappModels.map((item) => { + return ( + + + {item.stream_content.name} + + ) + })} + + )}
- {loading ? ( - - ) : ( - + {dappModels.length !== 0 && ( + <> + {loading ? ( + + ) : ( + + )} + )}
diff --git a/packages/client/dashboard/src/components/ModelList.tsx b/packages/client/dashboard/src/components/ModelList.tsx index 6e2c7202..cee02900 100644 --- a/packages/client/dashboard/src/components/ModelList.tsx +++ b/packages/client/dashboard/src/components/ModelList.tsx @@ -7,7 +7,7 @@ import { Modal, ModalOverlay } from 'react-aria-components' import PlusIcon from './Icons/PlusIcon' import { useNavigate } from 'react-router-dom' import useSelectedDapp from '../hooks/useSelectedDapp' -import { useCallback, useEffect, useState } from 'react' +import { useCallback, useEffect, useRef, useState } from 'react' import { ModelStream } from '../types' import { getStarModels } from '../api' import { Network } from './Selector/EnumSelect' @@ -73,8 +73,14 @@ export default function ModelList({ [loadDapps, selectedDapp, session] ) + const isFirstRenderRef = useRef(true) + useEffect(() => { - setLoading(true) + if (isFirstRenderRef.current) { + isFirstRenderRef.current = false + setLoading(true) + } + loadModelsInfo().finally(() => setLoading(false)) }, [loadModelsInfo]) @@ -145,10 +151,14 @@ export default function ModelList({ setSelectModel(model) }} removeModelAction={async (id: string) => { + await removeModelFromDapp(id) if (id === selectModel?.stream_id) { setSelectModel(undefined) + setSelectModelId('') + setSelectModelName && setSelectModelName('') + setDappModels(undefined) + setSelected(undefined) } - await removeModelFromDapp(id) }} /> )} diff --git a/packages/client/dashboard/src/components/Nav.tsx b/packages/client/dashboard/src/components/Nav.tsx index 7b751dcb..496fea6e 100644 --- a/packages/client/dashboard/src/components/Nav.tsx +++ b/packages/client/dashboard/src/components/Nav.tsx @@ -83,30 +83,12 @@ export default function Nav({ appId }: { appId: string }) { )} -
{ - if (!pathname.endsWith('explore')) { - navigate(`/dapp/${appId}/explore?filterStar=filter`) - return - } - if (filterStar) { - setSearchParams((params) => { - params.delete('filterStar') - return params - }) - } else { - setSearchParams((params) => { - params.set('filterStar', 'filter') - return params - }) - } - }} - > - {(filterStar && ) || } - Favorite Models -
- + +
+ {(filterStar && ) || } + Favorite Models +
+
@@ -163,6 +145,11 @@ const NavContainer = styled.nav<{ open?: boolean }>` width: 150px; transition: opacity 0.09s ease-in-out; } + + &.active { + background: #14171a; + color: #fff; + } } .top { From 829e49cd7da96d565cdb8b177138afb779dd3882 Mon Sep 17 00:00:00 2001 From: bufan Date: Thu, 15 Jun 2023 16:56:25 +0800 Subject: [PATCH 2/2] update github action for env REACT_APP_DOCS_URL --- .github/workflows/dashboard-firebase-hosting-merge.yml | 2 ++ .github/workflows/dashboard-firebase-hosting-pull-request.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/dashboard-firebase-hosting-merge.yml b/.github/workflows/dashboard-firebase-hosting-merge.yml index 90f04885..66c6728f 100644 --- a/.github/workflows/dashboard-firebase-hosting-merge.yml +++ b/.github/workflows/dashboard-firebase-hosting-merge.yml @@ -32,6 +32,7 @@ jobs: REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}' REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}' REACT_APP_S3_SCAN_URL: '${{ vars.REACT_APP_S3_SCAN_URL }}' + REACT_APP_DOCS_URL: '${{ vars.REACT_APP_DOCS_URL }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' @@ -64,6 +65,7 @@ jobs: REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}' REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}' REACT_APP_S3_SCAN_URL: '${{ vars.REACT_APP_S3_SCAN_URL }}' + REACT_APP_DOCS_URL: '${{ vars.REACT_APP_DOCS_URL }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/dashboard-firebase-hosting-pull-request.yml b/.github/workflows/dashboard-firebase-hosting-pull-request.yml index fb8b7e69..d7e227e9 100644 --- a/.github/workflows/dashboard-firebase-hosting-pull-request.yml +++ b/.github/workflows/dashboard-firebase-hosting-pull-request.yml @@ -32,6 +32,7 @@ jobs: REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}' REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}' REACT_APP_S3_SCAN_URL: '${{ vars.REACT_APP_S3_SCAN_URL }}' + REACT_APP_DOCS_URL: '${{ vars.REACT_APP_DOCS_URL }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' @@ -63,6 +64,7 @@ jobs: REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}' REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}' REACT_APP_S3_SCAN_URL: '${{ vars.REACT_APP_S3_SCAN_URL }}' + REACT_APP_DOCS_URL: '${{ vars.REACT_APP_DOCS_URL }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}'