From 97611ca0a127f0b6326f7c7d5bf14e806484886d Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 25 Nov 2021 07:03:29 -0300 Subject: [PATCH] Extract address transaction results component --- src/AddressTransactions.tsx | 77 +++-------------- src/address/AddressTransactionResults.tsx | 100 ++++++++++++++++++++++ 2 files changed, 111 insertions(+), 66 deletions(-) create mode 100644 src/address/AddressTransactionResults.tsx diff --git a/src/AddressTransactions.tsx b/src/AddressTransactions.tsx index 52432fd..6e014f8 100644 --- a/src/AddressTransactions.tsx +++ b/src/AddressTransactions.tsx @@ -16,18 +16,13 @@ import { faQuestionCircle } from "@fortawesome/free-regular-svg-icons/faQuestion import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import Copy from "./components/Copy"; -import ContentFrame from "./ContentFrame"; import NavTab from "./components/NavTab"; +import AddressTransactionResults from "./address/AddressTransactionResults"; import Contracts from "./address/Contracts"; -import UndefinedPageControl from "./search/UndefinedPageControl"; -import ResultHeader from "./search/ResultHeader"; -import PendingResults from "./search/PendingResults"; -import TransactionItem from "./search/TransactionItem"; import { SearchController } from "./search/search"; import { RuntimeContext } from "./useRuntime"; import { pageCollector, useResolvedAddresses } from "./useResolvedAddresses"; import { useFeeToggler } from "./search/useFeeToggler"; -import { SelectionContext, useSelection } from "./useSelection"; import { useMultipleETHUSDOracle } from "./usePriceOracle"; import { useAppConfigContext } from "./useAppConfig"; import { useMultipleMetadata } from "./useSourcify"; @@ -176,7 +171,6 @@ const AddressTransactions: React.FC = () => { const [feeDisplay, feeDisplayToggler] = useFeeToggler(); - const selectionCtx = useSelection(); const addresses = useMemo(() => { const _addresses: ChecksummedAddress[] = []; if (checksummedAddress) { @@ -273,65 +267,16 @@ const AddressTransactions: React.FC = () => { -
-
- {page === undefined ? ( - <>Waiting for search results... - ) : ( - <>{page.length} transactions on this page - )} -
- -
- - {page ? ( - - {page.map((tx) => ( - - ))} -
-
- {page === undefined ? ( - <>Waiting for search results... - ) : ( - <>{page.length} transactions on this page - )} -
- -
-
- ) : ( - - )} - + } /> void; + resolvedAddresses: ResolvedAddresses | undefined; + priceMap: Record; + metadatas: Record; +}; + +const AddressTransactionResults: React.FC = ({ + page, + checksummedAddress, + controller, + feeDisplay, + feeDisplayToggler, + resolvedAddresses, + priceMap, + metadatas, +}) => { + const selectionCtx = useSelection(); + + return ( + +
+
+ {page === undefined ? ( + <>Waiting for search results... + ) : ( + <>{page.length} transactions on this page + )} +
+ +
+ + {page ? ( + + {page.map((tx) => ( + + ))} +
+
+ {page === undefined ? ( + <>Waiting for search results... + ) : ( + <>{page.length} transactions on this page + )} +
+ +
+
+ ) : ( + + )} +
+ ); +}; + +export default AddressTransactionResults;