import React, {useContext} from "react"; import { Flex, HStack, Skeleton, Box, Heading, Center, Spinner } from "@chakra-ui/react"; import { useTxInfo, useTxCashe, useRouter } from "../../src/core/hooks"; import FourOFour from "../../src/components/FourOFour"; import FourOThree from "../../src/components/FourOThree"; import Tags from "../../src/components/Tags"; import { getLayout } from "../../src/layouts/EntriesLayout"; import Scrollable from "../../src/components/Scrollable"; import TxInfo from "../../src/components/TxInfo" import UIContext from "../../src/core/providers/UIProvider/context"; const Entry = () => { const ui = useContext(UIContext); const router = useRouter(); const { entryId } = router.params; const txCache = useTxCashe; const callReroute = () => { ui.setEntriesViewMode("list"); router.push({ pathname: `/stream`, query: router.query, }); const LoadingSpinner = () => (
); return ( ) } const transaction = txCache.getCurrentTransaction() const { data: entry, isFetchedAfterMount, isLoading, isError, error, } = useTxInfo({tx:transaction}) if (isError) {return callReroute()} if (isError && error.response.status === 404) return ; if (isError && error.response.status === 403) return ; // if (!entry || isLoading) return ""; return ( {entry && entry.hash} {!isLoading && ( )} ); }; Entry.getLayout = getLayout; export default Entry;