From f1ffc24c8d06278c623c3f757968fc97c8f27c95 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Fri, 10 Jan 2025 13:00:50 +0100 Subject: [PATCH] Extend transaction method filtering to consensus and validators --- .changelog/1679.trivial.md | 2 +- .../ConsensusTransactionTypeFilter.tsx | 44 +++++++++++++++++ .../Transactions/ConsensusTransactions.tsx | 3 ++ .../ConsensusAccountEventsCard.tsx | 4 +- .../ConsensusAccountTransactionsCard.tsx | 49 ++++++++++--------- .../ConsensusAccountDetailsPage/hooks.tsx | 3 ++ .../ConsensusAccountDetailsPage/index.tsx | 7 ++- .../ConsensusBlockTransactionsCard.tsx | 27 ++++++++-- .../LatestConsensusTransactions.tsx | 1 + .../pages/ConsensusTransactionsPage/index.tsx | 25 +++++++++- src/app/pages/ValidatorDetailsPage/hooks.ts | 3 ++ src/app/pages/ValidatorDetailsPage/index.tsx | 8 ++- src/stories/Transactions.stories.tsx | 1 + 13 files changed, 143 insertions(+), 34 deletions(-) create mode 100644 src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx diff --git a/.changelog/1679.trivial.md b/.changelog/1679.trivial.md index c79d4d9db..04b3a718e 100644 --- a/.changelog/1679.trivial.md +++ b/.changelog/1679.trivial.md @@ -1 +1 @@ -Add support for filtering latest TX list for method type +Add support for filtering transactions by method type diff --git a/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx b/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx new file mode 100644 index 000000000..81a043e23 --- /dev/null +++ b/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx @@ -0,0 +1,44 @@ +import { FC } from 'react' +import { getConsensusTxMethodOptions } from '../ConsensusTransactionMethod' +import { useTranslation } from 'react-i18next' +import { Select } from '../Select' +import Typography from '@mui/material/Typography' +import { ConsensusTxMethod } from 'oasis-nexus/api' + +const FilterLabel: FC = () => { + const { t } = useTranslation() + return ( + + {t('transactions.filterByType')} + + ) +} + +export type WantedConsensusTxMethod = ConsensusTxMethod | 'all' + +export const ConsensusTransactionTypeFilter: FC<{ + value: WantedConsensusTxMethod + setValue: (value: WantedConsensusTxMethod) => void + expand?: boolean +}> = ({ value, setValue, expand }) => { + const { t } = useTranslation() + return ( +