From 4c5d821929f0b36ca48f09b8d2c09949b0705726 Mon Sep 17 00:00:00 2001 From: Cheslav Zhuravsky Date: Fri, 27 Oct 2023 22:06:51 +0400 Subject: [PATCH] fixes --- src/containers/Search/SearchResults.tsx | 23 +++++++------------ src/containers/blok/blockDetails.jsx | 2 +- src/containers/ipfs/components/metaInfo.tsx | 2 +- src/containers/ipfs/ipfs.tsx | 14 ++++++++--- .../robot/_refactor/account/tabs/link.jsx | 4 ++-- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/containers/Search/SearchResults.tsx b/src/containers/Search/SearchResults.tsx index 47decbd56..54086b9af 100644 --- a/src/containers/Search/SearchResults.tsx +++ b/src/containers/Search/SearchResults.tsx @@ -1,11 +1,9 @@ import { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; -// import InfiniteScroll from 'react-infinite-scroll-component'; import InfiniteScroll from 'react-infinite-scroll-component'; import { useDevice } from 'src/contexts/device'; import { IpfsContentType } from 'src/utils/ipfs/ipfs'; import Spark from 'src/components/search/Spark/Spark'; -import { useAdviser } from 'src/features/adviser/context'; import Loader2 from 'src/components/ui/Loader2'; import { getIpfsHash } from '../../utils/search/utils'; import { encodeSlash } from '../../utils/utils'; @@ -34,8 +32,6 @@ function SearchResults() { const query = q || cid || ''; - // const location = useLocation(); - // const navigate = useNavigate(); const [keywordHash, setKeywordHash] = useState(''); console.debug(query, keywordHash); const [rankLink, setRankLink] = useState(null); @@ -55,7 +51,6 @@ function SearchResults() { const { data: items, total, - isFetching, error, hasMore, isInitialLoading, @@ -75,16 +70,6 @@ function SearchResults() { // // eslint-disable-next-line react-hooks/exhaustive-deps // }, [query]); - const { setAdviser } = useAdviser(); - - useEffect(() => { - if (error) { - setAdviser(JSON.stringify(error), 'red'); - } else { - // setAdviser(''); - } - }, [setAdviser, error, isFetching, isInitialLoading]); - useEffect(() => { setContentTypeFilter(initialContentTypeFilterState); setContentType({}); @@ -172,6 +157,14 @@ function SearchResults() { > {renderItems} + ) : error ? ( +

+ {error.message} +

) : ( )} diff --git a/src/containers/blok/blockDetails.jsx b/src/containers/blok/blockDetails.jsx index cf90ebba7..80f004ef8 100644 --- a/src/containers/blok/blockDetails.jsx +++ b/src/containers/blok/blockDetails.jsx @@ -50,7 +50,7 @@ function BlockDetails({ router }) { }, [data, idBlock]); if (loading) { - return
Loading...
; + return
loading...
; } if (error) { diff --git a/src/containers/ipfs/components/metaInfo.tsx b/src/containers/ipfs/components/metaInfo.tsx index b34b6adfa..50f5fdf81 100644 --- a/src/containers/ipfs/components/metaInfo.tsx +++ b/src/containers/ipfs/components/metaInfo.tsx @@ -42,7 +42,7 @@ function RowItem({ text, value }) { function MetaInfo({ data, cid }) { try { if (!data) { - return
Loading....
; + return
loading....
; } return ( <> diff --git a/src/containers/ipfs/ipfs.tsx b/src/containers/ipfs/ipfs.tsx index 09b4a88f8..f11a52501 100644 --- a/src/containers/ipfs/ipfs.tsx +++ b/src/containers/ipfs/ipfs.tsx @@ -8,7 +8,7 @@ import { encodeSlash, formatCurrency, timeSince } from 'src/utils/utils'; import { IPFSContentDetails } from 'src/utils/ipfs/ipfs'; import { PATTERN_IPFS_HASH } from 'src/utils/config'; import { getIpfsHash } from 'src/utils/search/utils'; -import { Account, Rank } from '../../components'; +import { Account, Dots, Rank } from '../../components'; import useGetCreator from './hooks/useGetCreator'; import ContentIpfsCid from './components/ContentIpfsCid'; import styles from './IPFS.module.scss'; @@ -70,9 +70,15 @@ function Ipfs() { useEffect(() => { if (['error', 'timeout', 'not_found'].includes(status)) { - setAdviser(`Ipfs loading error, status: ${status}`); + setAdviser(`IPFS loading error, status: ${status}`, 'red'); } else if (['pending', 'executing'].includes(status)) { - setAdviser('Loading...', 'yellow'); + setAdviser( + <> + loading + + , + 'yellow' + ); } else if (ipfsDataDetails) { setAdviser(
@@ -107,6 +113,8 @@ function Ipfs() { } }, [ipfsDataDetails, creator, setAdviser, rankInfo, cid, content, status]); + console.debug(status, cid, content, ipfsDataDetails); + return ( <>
;