mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* integrate erc-7984 * minor fix * FHE operations and tags * upd * upd * fix mobile * upd * fix mobile * Update TxFHEOperations.tsx * upd * add hover text * Update Address.tsx * Update Address.tsx * add hover text * Revert "Merge branch 'both-prs' into fhe-operations" This reverts commit a8d48de2c077fed37581948ad07576ec751d2003, reversing changes made to f253cae03dc71d38c3fa92fcad29f7be11467521. * fix design of fhe ops page * fix design of fhe ops page * fix design of fhe ops page * fix design of fhe ops page * fix comments * fix: tab name * upd --------- Co-authored-by: Maksym Zub <[email protected]>
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
import { Box } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import useApiQuery from 'lib/api/useApiQuery';
|
|
import { FHE_OPERATIONS_RESPONSE } from 'stubs/fheOperations';
|
|
import DataFetchAlert from 'ui/shared/DataFetchAlert';
|
|
import DataListDisplay from 'ui/shared/DataListDisplay';
|
|
import TxFHEOperationsList from 'ui/tx/fheOperations/TxFHEOperationsList';
|
|
import TxFHEOperationsStats from 'ui/tx/fheOperations/TxFHEOperationsStats';
|
|
import TxFHEOperationsTable from 'ui/tx/fheOperations/TxFHEOperationsTable';
|
|
import TxPendingAlert from 'ui/tx/TxPendingAlert';
|
|
import TxSocketAlert from 'ui/tx/TxSocketAlert';
|
|
|
|
import type { TxQuery } from './useTxQuery';
|
|
|
|
interface Props {
|
|
txQuery: TxQuery;
|
|
}
|
|
|
|
const TxFHEOperations = ({ txQuery }: Props) => {
|
|
const hash = txQuery.data?.hash || '';
|
|
const isEnabled = Boolean(hash) && Boolean(txQuery.data?.status) && !txQuery.isPlaceholderData;
|
|
|
|
const { data, isError, isPlaceholderData } = useApiQuery('general:tx_fhe_operations', {
|
|
pathParams: { hash },
|
|
queryOptions: {
|
|
enabled: isEnabled,
|
|
retry: false,
|
|
placeholderData: FHE_OPERATIONS_RESPONSE,
|
|
},
|
|
});
|
|
|
|
if (!txQuery.isPending && !txQuery.isPlaceholderData && !txQuery.isError && txQuery.data && !txQuery.data.status) {
|
|
return txQuery.socketStatus ? <TxSocketAlert status={ txQuery.socketStatus }/> : <TxPendingAlert/>;
|
|
}
|
|
|
|
if (txQuery.isError || isError) {
|
|
return <DataFetchAlert/>;
|
|
}
|
|
|
|
const content = data ? (
|
|
<>
|
|
<TxFHEOperationsStats
|
|
totalHcu={ data.total_hcu }
|
|
maxDepthHcu={ data.max_depth_hcu }
|
|
operationCount={ data.operation_count }
|
|
isLoading={ isPlaceholderData }
|
|
/>
|
|
<Box>
|
|
<TxFHEOperationsTable data={ data.items } isLoading={ isPlaceholderData }/>
|
|
<TxFHEOperationsList data={ data.items } isLoading={ isPlaceholderData }/>
|
|
</Box>
|
|
</>
|
|
) : null;
|
|
|
|
return (
|
|
<DataListDisplay
|
|
isError={ isError }
|
|
itemsNum={ data?.items?.length ?? 0 }
|
|
emptyText="There are no FHE operations for this transaction."
|
|
>
|
|
{ content }
|
|
</DataListDisplay>
|
|
);
|
|
};
|
|
|
|
export default React.memo(TxFHEOperations);
|