Extract common component
This commit is contained in:
parent
88d0116d4e
commit
ee0ea1a2e3
|
@ -11,7 +11,7 @@ import { SelectionContext, useSelection } from "../useSelection";
|
||||||
import { useMultipleETHUSDOracle } from "../usePriceOracle";
|
import { useMultipleETHUSDOracle } from "../usePriceOracle";
|
||||||
import { RuntimeContext } from "../useRuntime";
|
import { RuntimeContext } from "../useRuntime";
|
||||||
import { useParams, useSearchParams } from "react-router-dom";
|
import { useParams, useSearchParams } from "react-router-dom";
|
||||||
import { ChecksummedAddress } from "../types";
|
import { ChecksummedAddress, ProcessedTransaction } from "../types";
|
||||||
import { useContractsMetadata } from "../hooks";
|
import { useContractsMetadata } from "../hooks";
|
||||||
|
|
||||||
type AddressTransactionResultsProps = {
|
type AddressTransactionResultsProps = {
|
||||||
|
@ -120,23 +120,7 @@ const AddressTransactionResults: React.FC<AddressTransactionResultsProps> = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContentFrame tabs>
|
<ContentFrame tabs>
|
||||||
<div className="flex justify-between items-baseline py-3">
|
<NavBar address={address} page={page} controller={controller} />
|
||||||
<div className="text-sm text-gray-500">
|
|
||||||
{page === undefined ? (
|
|
||||||
<>Waiting for search results...</>
|
|
||||||
) : (
|
|
||||||
<>{page.length} transactions on this page</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<UndefinedPageControl
|
|
||||||
address={address}
|
|
||||||
isFirst={controller?.isFirst}
|
|
||||||
isLast={controller?.isLast}
|
|
||||||
prevHash={page?.[0]?.hash ?? ""}
|
|
||||||
nextHash={page?.[page.length - 1]?.hash ?? ""}
|
|
||||||
disabled={controller === undefined}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<ResultHeader
|
<ResultHeader
|
||||||
feeDisplay={feeDisplay}
|
feeDisplay={feeDisplay}
|
||||||
feeDisplayToggler={feeDisplayToggler}
|
feeDisplayToggler={feeDisplayToggler}
|
||||||
|
@ -153,6 +137,22 @@ const AddressTransactionResults: React.FC<AddressTransactionResultsProps> = ({
|
||||||
metadatas={metadatas}
|
metadatas={metadatas}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
<NavBar address={address} page={page} controller={controller} />
|
||||||
|
</SelectionContext.Provider>
|
||||||
|
) : (
|
||||||
|
<PendingResults />
|
||||||
|
)}
|
||||||
|
</ContentFrame>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
type NavBarProps = {
|
||||||
|
address: ChecksummedAddress;
|
||||||
|
page: ProcessedTransaction[] | undefined;
|
||||||
|
controller: SearchController | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const NavBar: React.FC<NavBarProps> = ({ address, page, controller }) => (
|
||||||
<div className="flex justify-between items-baseline py-3">
|
<div className="flex justify-between items-baseline py-3">
|
||||||
<div className="text-sm text-gray-500">
|
<div className="text-sm text-gray-500">
|
||||||
{page === undefined ? (
|
{page === undefined ? (
|
||||||
|
@ -170,12 +170,6 @@ const AddressTransactionResults: React.FC<AddressTransactionResultsProps> = ({
|
||||||
disabled={controller === undefined}
|
disabled={controller === undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SelectionContext.Provider>
|
|
||||||
) : (
|
|
||||||
<PendingResults />
|
|
||||||
)}
|
|
||||||
</ContentFrame>
|
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
export default AddressTransactionResults;
|
export default AddressTransactionResults;
|
||||||
|
|
Loading…
Reference in New Issue