Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
happylolonly committed Oct 27, 2023
1 parent ba54427 commit 4c5d821
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
23 changes: 8 additions & 15 deletions src/containers/Search/SearchResults.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
Expand All @@ -55,7 +51,6 @@ function SearchResults() {
const {
data: items,
total,
isFetching,
error,
hasMore,
isInitialLoading,
Expand All @@ -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({});
Expand Down Expand Up @@ -172,6 +157,14 @@ function SearchResults() {
>
{renderItems}
</InfiniteScroll>
) : error ? (
<p
style={{
color: 'red',
}}
>
{error.message}
</p>
) : (
<NoItems text={`No information about ${query}`} />
)}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/blok/blockDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function BlockDetails({ router }) {
}, [data, idBlock]);

if (loading) {
return <div>Loading...</div>;
return <div>loading...</div>;
}

if (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ipfs/components/metaInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function RowItem({ text, value }) {
function MetaInfo({ data, cid }) {
try {
if (!data) {
return <div>Loading....</div>;
return <div>loading....</div>;
}
return (
<>
Expand Down
14 changes: 11 additions & 3 deletions src/containers/ipfs/ipfs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
<Dots />
</>,
'yellow'
);
} else if (ipfsDataDetails) {
setAdviser(
<div className={styles.meta}>
Expand Down Expand Up @@ -107,6 +113,8 @@ function Ipfs() {
}
}, [ipfsDataDetails, creator, setAdviser, rankInfo, cid, content, status]);

console.debug(status, cid, content, ipfsDataDetails);

return (
<>
<main
Expand Down
4 changes: 2 additions & 2 deletions src/pages/robot/_refactor/account/tabs/link.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export default function GetLink() {
`;
const { loading, error, data: dataLink } = useQuery(GET_CHARACTERS);
if (loading) {
return 'Loading...';
return 'loading...';
}
if (error) {
return `Error! ${error.message}`;
return `error! ${error.message}`;
}

return <TableLink data={dataLink.cyberlinks_aggregate.nodes} />;
Expand Down

0 comments on commit 4c5d821

Please sign in to comment.