diff --git a/.github/workflows/dashboard-firebase-hosting-merge.yml b/.github/workflows/dashboard-firebase-hosting-merge.yml
index 66c6728f..74c0bfec 100644
--- a/.github/workflows/dashboard-firebase-hosting-merge.yml
+++ b/.github/workflows/dashboard-firebase-hosting-merge.yml
@@ -33,6 +33,7 @@ jobs:
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 }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
@@ -66,6 +67,7 @@ jobs:
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 }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- 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 d7e227e9..7d4062c2 100644
--- a/.github/workflows/dashboard-firebase-hosting-pull-request.yml
+++ b/.github/workflows/dashboard-firebase-hosting-pull-request.yml
@@ -33,6 +33,7 @@ jobs:
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 }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
@@ -65,6 +66,7 @@ jobs:
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 }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
diff --git a/.github/workflows/scan-firebase-hosting-merge.yml b/.github/workflows/scan-firebase-hosting-merge.yml
index b2721d28..6d2f285b 100644
--- a/.github/workflows/scan-firebase-hosting-merge.yml
+++ b/.github/workflows/scan-firebase-hosting-merge.yml
@@ -30,6 +30,7 @@ jobs:
REACT_APP_UPLOAD_API_URL: '${{ vars.REACT_APP_UPLOAD_API_URL }}'
REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}'
REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
@@ -60,6 +61,7 @@ jobs:
REACT_APP_UPLOAD_API_URL: '${{ vars.REACT_APP_UPLOAD_API_URL }}'
REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}'
REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
diff --git a/.github/workflows/scan-firebase-hosting-pull-request.yml b/.github/workflows/scan-firebase-hosting-pull-request.yml
index 6ed998d5..01d826cd 100644
--- a/.github/workflows/scan-firebase-hosting-pull-request.yml
+++ b/.github/workflows/scan-firebase-hosting-pull-request.yml
@@ -30,6 +30,7 @@ jobs:
REACT_APP_UPLOAD_API_URL: '${{ vars.REACT_APP_UPLOAD_API_URL }}'
REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}'
REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
@@ -59,6 +60,7 @@ jobs:
REACT_APP_UPLOAD_API_URL: '${{ vars.REACT_APP_UPLOAD_API_URL }}'
REACT_APP_CERAMIC_MAINNET_HOST: '${{ vars.REACT_APP_CERAMIC_MAINNET_HOST }}'
REACT_APP_CERAMIC_TESTNET_HOST: '${{ vars.REACT_APP_CERAMIC_TESTNET_HOST }}'
+ REACT_APP_ADMIN_ADDRESS: '${{ vars.REACT_APP_ADMIN_ADDRESS }}'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
diff --git a/packages/client/scan/.env.example b/packages/client/scan/.env.example
index 7dc961bf..3bb4811a 100644
--- a/packages/client/scan/.env.example
+++ b/packages/client/scan/.env.example
@@ -7,4 +7,6 @@ REACT_APP_UPLOAD_API_URL=https://api-dev.u3.xyz
REACT_APP_CERAMIC_MAINNET_HOST=https://gcp-ceramic-mainnet-dev.s3.xyz
REACT_APP_CERAMIC_TESTNET_HOST=https://gcp-ceramic-testnet-dev.s3.xyz
-REACT_APP_WALLET_CONNECT_PROJECT_ID = c652d0148879353d7e965d7f6f361e59
\ No newline at end of file
+REACT_APP_WALLET_CONNECT_PROJECT_ID = c652d0148879353d7e965d7f6f361e59
+
+REACT_APP_ADMIN_ADDRESS = 0x0000000
\ No newline at end of file
diff --git a/packages/client/scan/src/components/DappModelInstance.tsx b/packages/client/scan/src/components/DappModelInstance.tsx
index 7e85947e..6cd7de45 100644
--- a/packages/client/scan/src/components/DappModelInstance.tsx
+++ b/packages/client/scan/src/components/DappModelInstance.tsx
@@ -7,6 +7,7 @@ import { ModelMid } from '../types'
import { shortPubKey } from '../utils/shortPubKey'
import { UserAvatar } from '@us3r-network/profile'
import dayjs from 'dayjs'
+import { Link } from 'react-router-dom'
export default function DappModelInstance({ modelId }: { modelId: string }) {
const { network } = useCeramicCtx()
@@ -69,7 +70,13 @@ export default function DappModelInstance({ modelId }: { modelId: string }) {
console.log(item)
return (
- {shortPubKey(item.streamId, { len: 8 })} |
+
+
+ {shortPubKey(item.streamId, { len: 8 })}
+
+ |
diff --git a/packages/client/scan/src/components/Header.tsx b/packages/client/scan/src/components/Header.tsx
index d0e1b187..cfa83667 100644
--- a/packages/client/scan/src/components/Header.tsx
+++ b/packages/client/scan/src/components/Header.tsx
@@ -51,11 +51,12 @@ export default function Header() {
{(showBack && window.history.length > 1 && (
{
- if (location.pathname.startsWith('/models/modelview')) {
- navigate('/models')
- } else {
- navigate(-1)
- }
+ navigate(-1)
+ // if (location.pathname.startsWith('/models/modelview')) {
+ // navigate('/models')
+ // } else {
+ // navigate(-1)
+ // }
}}
/>
)) || }
diff --git a/packages/client/scan/src/components/icons/Spinner.tsx b/packages/client/scan/src/components/icons/Spinner.tsx
new file mode 100644
index 00000000..0d240cc4
--- /dev/null
+++ b/packages/client/scan/src/components/icons/Spinner.tsx
@@ -0,0 +1,91 @@
+export default function Spinner({ stroke = '#718096' }: { stroke?: string }) {
+ return (
+
+ )
+}
diff --git a/packages/client/scan/src/constants/index.ts b/packages/client/scan/src/constants/index.ts
index a2323b71..d7060fa6 100644
--- a/packages/client/scan/src/constants/index.ts
+++ b/packages/client/scan/src/constants/index.ts
@@ -44,3 +44,5 @@ export const TypesReverse = Object.fromEntries(
export const WALLET_CONNECT_PROJECT_ID =
process.env.REACT_APP_WALLET_CONNECT_PROJECT_ID ||
'c652d0148879353d7e965d7f6f361e59'
+
+export const ADMIN_ADDRESS = process.env.REACT_APP_ADMIN_ADDRESS
diff --git a/packages/client/scan/src/container/DappsList.tsx b/packages/client/scan/src/container/DappsList.tsx
index d0a88dee..6c790be2 100644
--- a/packages/client/scan/src/container/DappsList.tsx
+++ b/packages/client/scan/src/container/DappsList.tsx
@@ -70,7 +70,13 @@ export default function DappsList() {
{(item.modelDetals.length > 0 &&
item.modelDetals.map((item, idx) => {
return (
- {item.stream_content.name}
+
+
+ {item.stream_content.name}
+
+
)
})) ||
'-'}
@@ -217,9 +223,8 @@ const TableContainer = styled.table<{ isMobile: boolean }>`
align-items: center;
gap: 10px;
max-width: 550px;
- overflow: hidden;
text-overflow: ellipsis;
- overflow: hidden;
+ overflow: scroll;
padding-right: 5px;
white-space: nowrap;
}
diff --git a/packages/client/scan/src/container/ModelView.tsx b/packages/client/scan/src/container/ModelView.tsx
index 992ee9e4..19f37e65 100644
--- a/packages/client/scan/src/container/ModelView.tsx
+++ b/packages/client/scan/src/container/ModelView.tsx
@@ -11,7 +11,8 @@ import styled from 'styled-components'
import { useSession } from '@us3r-network/auth-with-rainbowkit'
import { Dapp } from '@us3r-network/data-model'
-import { set } from 'lodash'
+import Spinner from '../components/icons/Spinner'
+import { ADMIN_ADDRESS } from '../constants'
export default function ModelView() {
const { streamId } = useParams()
@@ -108,12 +109,13 @@ export default function ModelView() {
const startIndex = useCallback(async () => {
if (!streamId) return
try {
+ setIndexing(true)
const resp = await startIndexModel({
network,
modelId: streamId,
didSession: session?.serialize(),
})
- console.log('startIndex', resp.data)
+
if (resp.data.code !== 0) {
throw new Error(resp.data.msg)
}
@@ -150,13 +152,30 @@ export default function ModelView() {
return ['Instance', 'Playground']
}, [isIndexed])
+ const isAdmin = useMemo(() => {
+ if (!session?.id || !ADMIN_ADDRESS) return false
+ return session.id.endsWith(ADMIN_ADDRESS.toLowerCase())
+ }, [session?.id])
+
return (
-
- {modelStream?.streamContent?.name}
- {!isIndexed && }
-
+ {(modelStream?.streamContent?.name && (
+
+ {modelStream?.streamContent?.name}
+ {isAdmin && !isIndexed && (
+ <>
+ {indexing ? (
+
+ ) : (
+
+ )}
+ >
+ )}
+
+ )) || }
Model Definition
Model Instance Documents
diff --git a/packages/client/scan/src/container/Models.tsx b/packages/client/scan/src/container/Models.tsx
index c95bd033..8af28ea7 100644
--- a/packages/client/scan/src/container/Models.tsx
+++ b/packages/client/scan/src/container/Models.tsx
@@ -266,8 +266,9 @@ export default function ModelsPage() {
function Dapps({
dapps,
}: {
- dapps: Array<{ name: string; description: string; icon: string }>
+ dapps: Array<{ name: string; description: string; icon: string; id: number }>
}) {
+ const { network } = useCeramicCtx()
const apps = useMemo(() => {
const data = [...dapps]
if (data.length > 3)
@@ -280,7 +281,13 @@ function Dapps({
{apps.data.length > 0
? apps.data.map((item, idx) => {
return (
-
+
+
+
)
})
: 'None'}
@@ -299,35 +306,37 @@ const DappBox = styled.div`
font-style: normal;
font-weight: 400;
line-height: normal;
- > span {
- color: #fff;
- width: 36px;
- height: 36px;
- border-radius: 10px;
- border: 1px solid #718096;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- overflow: hidden;
- &.name {
- font-size: 20px;
- font-weight: 500;
- }
- &.left {
- border: none;
+ a {
+ > span {
color: #fff;
- justify-content: start;
- font-family: Rubik;
- font-size: 12px;
- font-style: normal;
- font-weight: 400;
- line-height: normal;
- }
- > img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- flex-shrink: 0;
+ width: 36px;
+ height: 36px;
+ border-radius: 10px;
+ border: 1px solid #718096;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ overflow: hidden;
+ &.name {
+ font-size: 20px;
+ font-weight: 500;
+ }
+ &.left {
+ border: none;
+ color: #fff;
+ justify-content: start;
+ font-family: Rubik;
+ font-size: 12px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: normal;
+ }
+ > img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ flex-shrink: 0;
+ }
}
}
`
diff --git a/packages/client/scan/src/types/index.ts b/packages/client/scan/src/types/index.ts
index 98a5aff3..a91c37e2 100644
--- a/packages/client/scan/src/types/index.ts
+++ b/packages/client/scan/src/types/index.ts
@@ -82,7 +82,7 @@ export type ModelStream = {
recentlyUseCount?: number
isIndexed?: boolean
firstRecordTime?: string
- dapps?: { name: string; description: string; icon: string }[]
+ dapps?: { name: string; description: string; icon: string; id: number }[]
}
export type ModelStreamInfo = {
|