|
| 1 | +import { FC } from 'react' |
| 2 | +import Box from '@mui/material/Box' |
| 3 | +import { useScreenSize } from '../../hooks/useScreensize' |
| 4 | +import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE } from '../../config' |
| 5 | +import { transactionsContainerId } from '../../utils/tabAnchors' |
| 6 | +import { LinkableCardLayout } from '../../components/LinkableCardLayout' |
| 7 | +import { RuntimeTransactions } from '../../components/Transactions' |
| 8 | +import { RuntimeTransactionTypeFilter } from '../../components/Transactions/RuntimeTransactionTypeFilter' |
| 9 | +import { RoflAppInstanceDetailsContext, useRoflAppInstanceRakTransactions } from './hooks' |
| 10 | + |
| 11 | +export const RoflAppInstanceRakTransactionsCard: FC<RoflAppInstanceDetailsContext> = context => { |
| 12 | + const { method, setMethod, scope } = context |
| 13 | + const { isMobile } = useScreenSize() |
| 14 | + |
| 15 | + return ( |
| 16 | + <LinkableCardLayout |
| 17 | + containerId={transactionsContainerId} |
| 18 | + title={ |
| 19 | + <Box |
| 20 | + sx={{ |
| 21 | + display: 'flex', |
| 22 | + justifyContent: 'end', |
| 23 | + }} |
| 24 | + > |
| 25 | + {!isMobile && ( |
| 26 | + <RuntimeTransactionTypeFilter layer={scope.layer} value={method} setValue={setMethod} /> |
| 27 | + )} |
| 28 | + </Box> |
| 29 | + } |
| 30 | + > |
| 31 | + {isMobile && ( |
| 32 | + <RuntimeTransactionTypeFilter layer={scope.layer} value={method} setValue={setMethod} expand /> |
| 33 | + )} |
| 34 | + <RoflAppInstanceRakTransactions {...context} /> |
| 35 | + </LinkableCardLayout> |
| 36 | + ) |
| 37 | +} |
| 38 | + |
| 39 | +const RoflAppInstanceRakTransactions: FC<RoflAppInstanceDetailsContext> = ({ scope, id, rak, method }) => { |
| 40 | + const { isLoading, transactions, pagination, totalCount, isTotalCountClipped } = |
| 41 | + useRoflAppInstanceRakTransactions(scope, id, rak, method) |
| 42 | + |
| 43 | + return ( |
| 44 | + <RuntimeTransactions |
| 45 | + transactions={transactions} |
| 46 | + isLoading={isLoading} |
| 47 | + limit={NUMBER_OF_ITEMS_ON_SEPARATE_PAGE} |
| 48 | + pagination={{ |
| 49 | + selectedPage: pagination.selectedPage, |
| 50 | + linkToPage: pagination.linkToPage, |
| 51 | + totalCount, |
| 52 | + isTotalCountClipped, |
| 53 | + rowsPerPage: NUMBER_OF_ITEMS_ON_SEPARATE_PAGE, |
| 54 | + }} |
| 55 | + filtered={method !== 'any'} |
| 56 | + /> |
| 57 | + ) |
| 58 | +} |
0 commit comments