Files
tom goriunovandGitHub 25a4c2a97e Replace OP Superchain feature with generic Multichain explorer (#3299)
* rename feature

* rename evn preset

* types, mocks and stubs renaming

* rename UI components
2026-02-25 18:02:52 +01:00

91 lines
2.6 KiB
TypeScript

import { Box } from '@chakra-ui/react';
import React from 'react';
import { MultichainProvider } from 'lib/contexts/multichain';
import useIsMobile from 'lib/hooks/useIsMobile';
import { FilterInput } from 'toolkit/components/filters/FilterInput';
import InternalTxsList from 'ui/internalTxs/InternalTxsList';
import InternalTxsTable from 'ui/internalTxs/InternalTxsTable';
import useInternalTxsQuery from 'ui/internalTxs/useInternalTxsQuery';
import ChainSelect from 'ui/multichain/components/ChainSelect';
import ActionBar from 'ui/shared/ActionBar';
import DataListDisplay from 'ui/shared/DataListDisplay';
import PageTitle from 'ui/shared/Page/PageTitle';
import Pagination from 'ui/shared/pagination/Pagination';
const MultichainInternalTxs = () => {
const isMobile = useIsMobile();
const { query, searchTerm, onSearchTermChange } = useInternalTxsQuery({ isMultichain: true });
const { isError, isPlaceholderData, data, pagination } = query;
const filterInput = (
<FilterInput
w={{ base: '100%', lg: '350px' }}
size="sm"
onChange={ onSearchTermChange }
placeholder="Search by transaction hash"
initialValue={ searchTerm }
ml={{ base: 0, lg: 2 }}
/>
);
const chainSelect = (
<ChainSelect
value={ query.chainValue }
onValueChange={ query.onChainValueChange }
/>
);
const actionBar = (
<>
{ isMobile && (
<Box mb={ 6 }>
{ filterInput }
</Box>
) }
<ActionBar mt={ -6 } justifyContent="flex-start">
{ chainSelect }
{ !isMobile && filterInput }
<Pagination ml="auto" { ...pagination }/>
</ActionBar>
</>
);
const content = data?.items ? (
<MultichainProvider chainId={ query.chainValue?.[0] }>
<Box hideBelow="lg">
<InternalTxsTable data={ data.items } isLoading={ isPlaceholderData }/>
</Box>
<Box hideFrom="lg">
<InternalTxsList data={ data.items } isLoading={ isPlaceholderData }/>
</Box>
</MultichainProvider>
) : null;
return (
<>
<PageTitle
title="Internal transactions"
withTextAd
/>
<DataListDisplay
isError={ isError }
itemsNum={ data?.items.length }
emptyText="There are no internal transactions."
hasActiveFilters={ Boolean(searchTerm) }
emptyStateProps={{
term: 'internal transaction',
}}
actionBar={ actionBar }
showActionBarIfError
showActionBarIfEmpty
>
{ content }
</DataListDisplay>
</>
);
};
export default React.memo(MultichainInternalTxs);