mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* add export for address txs * transfer all export from page to dialog * remove old route and components * improve file name and fix loading state of icon button * basic implementation * refetch item status * status indicator for download items * changes for multichain * handle too many requests for downloads error * update button styles and spacing * fix tests * disable async export for multichain * Fix CSV export cancel flow and stabilize context updates Applied via @cursor push command * test and review fixes * design fixes * refactor file names --------- Co-authored-by: Hanzo Dev <[email protected]>
80 lines
2.4 KiB
TypeScript
80 lines
2.4 KiB
TypeScript
import { Box } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import CsvExport from 'client/features/csv-export/components/CsvExport';
|
|
import useIsMounted from 'lib/hooks/useIsMounted';
|
|
import InternalTxsList from 'ui/internalTxs/InternalTxsList';
|
|
import InternalTxsTable from 'ui/internalTxs/InternalTxsTable';
|
|
import ActionBar from 'ui/shared/ActionBar';
|
|
import DataListDisplay from 'ui/shared/DataListDisplay';
|
|
import Pagination from 'ui/shared/pagination/Pagination';
|
|
|
|
import AddressTxsFilter from './AddressTxsFilter';
|
|
import useAddressInternalTxsQuery from './useAddressInternalTxsQuery';
|
|
|
|
type Props = {
|
|
shouldRender?: boolean;
|
|
isQueryEnabled?: boolean;
|
|
};
|
|
const AddressInternalTxs = ({ shouldRender = true, isQueryEnabled = true }: Props) => {
|
|
const isMounted = useIsMounted();
|
|
|
|
const { hash, query, filterValue, onFilterChange } = useAddressInternalTxsQuery({ enabled: isQueryEnabled });
|
|
const { data, isPlaceholderData, isError, pagination } = query;
|
|
|
|
if (!isMounted || !shouldRender) {
|
|
return null;
|
|
}
|
|
|
|
const content = data?.items ? (
|
|
<>
|
|
<Box hideFrom="lg">
|
|
<InternalTxsList data={ data.items } currentAddress={ hash } isLoading={ isPlaceholderData }/>
|
|
</Box>
|
|
<Box hideBelow="lg">
|
|
<InternalTxsTable data={ data.items } currentAddress={ hash } isLoading={ isPlaceholderData }/>
|
|
</Box>
|
|
</>
|
|
) : null ;
|
|
|
|
const actionBar = (
|
|
<ActionBar mt={ -6 } justifyContent="left">
|
|
<AddressTxsFilter
|
|
initialValue={ filterValue }
|
|
onFilterChange={ onFilterChange }
|
|
hasActiveFilter={ Boolean(filterValue) }
|
|
isLoading={ pagination.isLoading }
|
|
/>
|
|
<CsvExport
|
|
type="address_internal_txs"
|
|
resourceName="general:address_csv_export_internal_txs"
|
|
pathParams={{ hash }}
|
|
queryParams={ filterValue ? {
|
|
filter_type: 'address',
|
|
filter_value: filterValue,
|
|
} : undefined }
|
|
loadingInitial={ pagination.isLoading }
|
|
ml={{ base: 2, lg: 3 }}
|
|
/>
|
|
<Pagination ml="auto" { ...pagination }/>
|
|
</ActionBar>
|
|
);
|
|
|
|
return (
|
|
<DataListDisplay
|
|
isError={ isError }
|
|
itemsNum={ data?.items.length }
|
|
hasActiveFilters={ Boolean(filterValue) }
|
|
emptyStateProps={{
|
|
term: 'transaction',
|
|
}}
|
|
emptyText="There are no internal transactions for this address."
|
|
actionBar={ actionBar }
|
|
>
|
|
{ content }
|
|
</DataListDisplay>
|
|
);
|
|
};
|
|
|
|
export default AddressInternalTxs;
|