diff --git a/src/containers/ipfs/components/AdviserMeta/AdviserMeta.tsx b/src/containers/ipfs/components/AdviserMeta/AdviserMeta.tsx index c2e23f218..b61dc392a 100644 --- a/src/containers/ipfs/components/AdviserMeta/AdviserMeta.tsx +++ b/src/containers/ipfs/components/AdviserMeta/AdviserMeta.tsx @@ -1,9 +1,11 @@ import { Rank, Account } from 'src/components'; import { timeSince, formatCurrency } from 'src/utils/utils'; +import useRank from 'src/features/cyberlinks/rank/useRank'; +import { Link } from 'react-router-dom'; +import { routes } from 'src/routes'; import useGetCreator from '../../hooks/useGetCreator'; import { PREFIXES } from '../metaInfo'; import styles from './AdviserMeta.module.scss'; -import useRank from 'src/features/cyberlinks/rank/useRank'; type Props = { cid: string; @@ -42,7 +44,7 @@ function AdviserMeta({ cid, type, size }: Props) { 🟥 {size ? formatCurrency(size, 'B', 0, PREFIXES) : 'unknown'} - + 🌓 ); diff --git a/src/containers/ipfs/hooks/useGetDiscussion.ts b/src/containers/ipfs/hooks/useGetDiscussion.ts index adcd58fed..96acae454 100644 --- a/src/containers/ipfs/hooks/useGetDiscussion.ts +++ b/src/containers/ipfs/hooks/useGetDiscussion.ts @@ -26,8 +26,6 @@ function useGetLinks( where.neuron = { _eq: neuron }; } - console.log('search neuron:', neuron); - // always no next page when skip const [hasNextPage, setHasNextPage] = useState(!skip); const [isInitialLoading, setIsInitialLoading] = useState(true); diff --git a/src/features/cyberlinks/rank/useRank.ts b/src/features/cyberlinks/rank/useRank.ts index 9d7e334fb..84c3478c4 100644 --- a/src/features/cyberlinks/rank/useRank.ts +++ b/src/features/cyberlinks/rank/useRank.ts @@ -1,26 +1,11 @@ -import { useEffect, useState } from 'react'; -import { useQueryClient } from 'src/contexts/queryClient'; +import useQueryClientMethod from 'src/hooks/useQueryClientMethod'; function useRank(cid: string) { - const [rank, setRank] = useState(); + const { data } = useQueryClientMethod('rank', [cid]); - const queryClient = useQueryClient(); + const rank = data?.rank; - useEffect(() => { - (async () => { - if (!queryClient) { - return; - } - - return; - - const response = await queryClient.rank(cid); - - setRank(Number(response.rank)); - })(); - }, [cid, queryClient]); - - return rank; + return rank ? Number(rank) : undefined; } export default useRank; diff --git a/src/hooks/useQueryClientMethod.ts b/src/hooks/useQueryClientMethod.ts index a603051e6..c8fe28715 100644 --- a/src/hooks/useQueryClientMethod.ts +++ b/src/hooks/useQueryClientMethod.ts @@ -19,7 +19,7 @@ function useQueryClientMethod( >( ['queryClientMethod', methodName, memoParams], () => { - const func = queryClient![methodName]; + const func = queryClient![methodName].bind(queryClient); // refactor if (memoParams) { diff --git a/src/index.html b/src/index.html index f5a0e73c6..56ea8b11d 100644 --- a/src/index.html +++ b/src/index.html @@ -62,21 +62,13 @@
- - - - diff --git a/src/routes.ts b/src/routes.ts index 04a1da56b..b994231cc 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -48,6 +48,9 @@ export const routes = { brain: { path: '/robot/brain', }, + soul: { + path: '/robot/soul', + }, }, }, robotPassport: {