From ba595c9ebc37f964c18026221f058403ef1f4c63 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Thu, 23 Jan 2025 00:04:18 +0100 Subject: [PATCH] Rename WantedConsensusTxMethod to ConsensusTxMethodFilterOption --- .../ConsensusTransactionMethod/index.tsx | 4 ++-- .../ConsensusTransactionTypeFilter.tsx | 6 +++--- .../pages/ConsensusAccountDetailsPage/hooks.tsx | 6 +++--- .../pages/ConsensusAccountDetailsPage/index.tsx | 4 ++-- .../ConsensusBlockTransactionsCard.tsx | 14 +++++++------- .../LatestConsensusTransactions.tsx | 6 +++--- src/app/pages/ConsensusDashboardPage/index.tsx | 4 ++-- src/app/pages/ConsensusTransactionsPage/index.tsx | 4 ++-- src/app/pages/ValidatorDetailsPage/hooks.ts | 6 +++--- src/app/pages/ValidatorDetailsPage/index.tsx | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/app/components/ConsensusTransactionMethod/index.tsx b/src/app/components/ConsensusTransactionMethod/index.tsx index 342b3dc46..1f5488685 100644 --- a/src/app/components/ConsensusTransactionMethod/index.tsx +++ b/src/app/components/ConsensusTransactionMethod/index.tsx @@ -379,8 +379,8 @@ export const ConsensusTransactionMethod: FC = ( return <>{getConsensusTransactionMethod(t, method, truncate)} } -export type WantedConsensusTxMethod = ConsensusTxMethod | 'any' +export type ConsensusTxMethodFilterOption = ConsensusTxMethod | 'any' export const getConsensusTransactionMethodFilteringParam = ( - method: WantedConsensusTxMethod, + method: ConsensusTxMethodFilterOption, ): Partial => (method === 'any' ? {} : { method }) diff --git a/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx b/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx index 3518d1a6a..baacf32a1 100644 --- a/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx +++ b/src/app/components/Transactions/ConsensusTransactionTypeFilter.tsx @@ -1,5 +1,5 @@ import { FC } from 'react' -import { getConsensusTxMethodOptions, WantedConsensusTxMethod } from '../ConsensusTransactionMethod' +import { getConsensusTxMethodOptions, ConsensusTxMethodFilterOption } from '../ConsensusTransactionMethod' import { useTranslation } from 'react-i18next' import { Select } from '../Select' import Typography from '@mui/material/Typography' @@ -23,8 +23,8 @@ const FilterLabel: FC = () => { } export const ConsensusTransactionTypeFilter: FC<{ - value: WantedConsensusTxMethod - setValue: (value: WantedConsensusTxMethod) => void + value: ConsensusTxMethodFilterOption + setValue: (value: ConsensusTxMethodFilterOption) => void expand?: boolean }> = ({ value, setValue, expand }) => { const { t } = useTranslation() diff --git a/src/app/pages/ConsensusAccountDetailsPage/hooks.tsx b/src/app/pages/ConsensusAccountDetailsPage/hooks.tsx index 0bed81498..649744e8d 100644 --- a/src/app/pages/ConsensusAccountDetailsPage/hooks.tsx +++ b/src/app/pages/ConsensusAccountDetailsPage/hooks.tsx @@ -1,12 +1,12 @@ import { useOutletContext } from 'react-router-dom' import { SearchScope } from '../../../types/searchScope' -import { WantedConsensusTxMethod } from '../../components/ConsensusTransactionMethod' +import { ConsensusTxMethodFilterOption } from '../../components/ConsensusTransactionMethod' export type ConsensusAccountDetailsContext = { scope: SearchScope address: string - method: WantedConsensusTxMethod - setMethod: (value: WantedConsensusTxMethod) => void + method: ConsensusTxMethodFilterOption + setMethod: (value: ConsensusTxMethodFilterOption) => void } export const useConsensusAccountDetailsProps = () => useOutletContext() diff --git a/src/app/pages/ConsensusAccountDetailsPage/index.tsx b/src/app/pages/ConsensusAccountDetailsPage/index.tsx index 5f79afbca..e4716c8ed 100644 --- a/src/app/pages/ConsensusAccountDetailsPage/index.tsx +++ b/src/app/pages/ConsensusAccountDetailsPage/index.tsx @@ -13,7 +13,7 @@ import { BalanceDistribution } from './BalanceDistribution' import { Staking } from './Staking' import { ConsensusAccountDetailsContext } from './hooks' import { eventsContainerId } from './ConsensusAccountEventsCard' -import { WantedConsensusTxMethod } from '../../components/ConsensusTransactionMethod' +import { ConsensusTxMethodFilterOption } from '../../components/ConsensusTransactionMethod' import { useTypedSearchParam } from '../../hooks/useTypedSearchParam' export const ConsensusAccountDetailsPage: FC = () => { @@ -22,7 +22,7 @@ export const ConsensusAccountDetailsPage: FC = () => { const scope = useRequiredScopeParam() const { network } = scope const { address, searchTerm } = useLoaderData() as AddressLoaderData - const [method, setMethod] = useTypedSearchParam('method', 'any', { + const [method, setMethod] = useTypedSearchParam('method', 'any', { deleteParams: ['page'], }) const accountQuery = useGetConsensusAccountsAddress(network, address) diff --git a/src/app/pages/ConsensusBlockDetailPage/ConsensusBlockTransactionsCard.tsx b/src/app/pages/ConsensusBlockDetailPage/ConsensusBlockTransactionsCard.tsx index 46f0c8d04..f6f3f2e70 100644 --- a/src/app/pages/ConsensusBlockDetailPage/ConsensusBlockTransactionsCard.tsx +++ b/src/app/pages/ConsensusBlockDetailPage/ConsensusBlockTransactionsCard.tsx @@ -13,17 +13,17 @@ import { ConsensusTransactionTypeFilter } from '../../components/Transactions/Co import { useScreenSize } from '../../hooks/useScreensize' import { getConsensusTransactionMethodFilteringParam, - WantedConsensusTxMethod, + ConsensusTxMethodFilterOption, } from '../../components/ConsensusTransactionMethod' import Box from '@mui/material/Box' export const transactionsContainerId = 'transactions' -const TransactionList: FC<{ scope: SearchScope; blockHeight: number; method: WantedConsensusTxMethod }> = ({ - scope, - blockHeight, - method, -}) => { +const TransactionList: FC<{ + scope: SearchScope + blockHeight: number + method: ConsensusTxMethodFilterOption +}> = ({ scope, blockHeight, method }) => { const txsPagination = useSearchParamsPagination('page') const txsOffset = (txsPagination.selectedPage - 1) * NUMBER_OF_ITEMS_ON_SEPARATE_PAGE const transactionsQuery = useGetConsensusTransactions(scope.network, { @@ -58,7 +58,7 @@ const TransactionList: FC<{ scope: SearchScope; blockHeight: number; method: Wan export const ConsensusBlockTransactionsCard: FC = ({ scope, blockHeight }) => { const { t } = useTranslation() - const [method, setMethod] = useTypedSearchParam('method', 'any', { + const [method, setMethod] = useTypedSearchParam('method', 'any', { deleteParams: ['page'], }) const { isMobile } = useScreenSize() diff --git a/src/app/pages/ConsensusDashboardPage/LatestConsensusTransactions.tsx b/src/app/pages/ConsensusDashboardPage/LatestConsensusTransactions.tsx index d562aae4a..1080e3e79 100644 --- a/src/app/pages/ConsensusDashboardPage/LatestConsensusTransactions.tsx +++ b/src/app/pages/ConsensusDashboardPage/LatestConsensusTransactions.tsx @@ -12,7 +12,7 @@ import { NUMBER_OF_ITEMS_ON_DASHBOARD as limit, FILTERING_ON_DASHBOARD as should import { RouteUtils } from '../../utils/route-utils' import { getConsensusTransactionMethodFilteringParam, - WantedConsensusTxMethod, + ConsensusTxMethodFilterOption, } from '../../components/ConsensusTransactionMethod' import Box from '@mui/material/Box' import { ConsensusTransactionTypeFilter } from '../../components/Transactions/ConsensusTransactionTypeFilter' @@ -20,8 +20,8 @@ import { useScreenSize } from '../../hooks/useScreensize' export const LatestConsensusTransactions: FC<{ scope: SearchScope - method: WantedConsensusTxMethod - setMethod: (value: WantedConsensusTxMethod) => void + method: ConsensusTxMethodFilterOption + setMethod: (value: ConsensusTxMethodFilterOption) => void }> = ({ scope, method, setMethod }) => { const { isMobile } = useScreenSize() const { t } = useTranslation() diff --git a/src/app/pages/ConsensusDashboardPage/index.tsx b/src/app/pages/ConsensusDashboardPage/index.tsx index 21a86fa2e..07f26065f 100644 --- a/src/app/pages/ConsensusDashboardPage/index.tsx +++ b/src/app/pages/ConsensusDashboardPage/index.tsx @@ -18,13 +18,13 @@ import { LatestConsensusTransactions } from './LatestConsensusTransactions' import { ParaTimesCard } from './ParaTimesCard' import { SearchScope } from 'types/searchScope' import { useTypedSearchParam } from '../../hooks/useTypedSearchParam' -import { WantedConsensusTxMethod } from '../../components/ConsensusTransactionMethod' +import { ConsensusTxMethodFilterOption } from '../../components/ConsensusTransactionMethod' export const ConsensusDashboardPage: FC = () => { const { isMobile } = useScreenSize() const scope = useRequiredScopeParam() const isLocal = isLocalnet(scope.network) - const [method, setMethod] = useTypedSearchParam('tx_method', 'any') + const [method, setMethod] = useTypedSearchParam('tx_method', 'any') return ( diff --git a/src/app/pages/ConsensusTransactionsPage/index.tsx b/src/app/pages/ConsensusTransactionsPage/index.tsx index 0337ab3e7..42c77505e 100644 --- a/src/app/pages/ConsensusTransactionsPage/index.tsx +++ b/src/app/pages/ConsensusTransactionsPage/index.tsx @@ -20,7 +20,7 @@ import { useTypedSearchParam } from '../../hooks/useTypedSearchParam' import { ConsensusTransactionTypeFilter } from '../../components/Transactions/ConsensusTransactionTypeFilter' import { getConsensusTransactionMethodFilteringParam, - WantedConsensusTxMethod, + ConsensusTxMethodFilterOption, } from '../../components/ConsensusTransactionMethod' import Box from '@mui/material/Box' @@ -29,7 +29,7 @@ export const ConsensusTransactionsPage: FC = () => { const { t } = useTranslation() const { isMobile } = useScreenSize() const pagination = useSearchParamsPagination('page') - const [method, setMethod] = useTypedSearchParam('method', 'any', { + const [method, setMethod] = useTypedSearchParam('method', 'any', { deleteParams: ['date'], }) const offset = (pagination.selectedPage - 1) * limit diff --git a/src/app/pages/ValidatorDetailsPage/hooks.ts b/src/app/pages/ValidatorDetailsPage/hooks.ts index d6885daae..187aeb6d2 100644 --- a/src/app/pages/ValidatorDetailsPage/hooks.ts +++ b/src/app/pages/ValidatorDetailsPage/hooks.ts @@ -1,12 +1,12 @@ import { useOutletContext } from 'react-router-dom' import { SearchScope } from '../../../types/searchScope' -import { WantedConsensusTxMethod } from '../../components/ConsensusTransactionMethod' +import { ConsensusTxMethodFilterOption } from '../../components/ConsensusTransactionMethod' export type ValidatorDetailsContext = { scope: SearchScope address: string - method: WantedConsensusTxMethod - setMethod: (method: WantedConsensusTxMethod) => void + method: ConsensusTxMethodFilterOption + setMethod: (method: ConsensusTxMethodFilterOption) => void } export const useValidatorDetailsProps = () => useOutletContext() diff --git a/src/app/pages/ValidatorDetailsPage/index.tsx b/src/app/pages/ValidatorDetailsPage/index.tsx index 77ee55a57..4d6fcc9a4 100644 --- a/src/app/pages/ValidatorDetailsPage/index.tsx +++ b/src/app/pages/ValidatorDetailsPage/index.tsx @@ -32,7 +32,7 @@ import { eventsContainerId } from './../../pages/ConsensusAccountDetailsPage/Con import { PercentageValue } from '../../components/PercentageValue' import { BalancesDiff } from '../../components/BalancesDiff' import { RoundedBalance } from '../../components/RoundedBalance' -import { WantedConsensusTxMethod } from '../../components/ConsensusTransactionMethod' +import { ConsensusTxMethodFilterOption } from '../../components/ConsensusTransactionMethod' import { useTypedSearchParam } from '../../hooks/useTypedSearchParam' export const StyledGrid = styled(Grid)(({ theme }) => ({ @@ -45,7 +45,7 @@ export const ValidatorDetailsPage: FC = () => { const { t } = useTranslation() const { isMobile } = useScreenSize() const scope = useRequiredScopeParam() - const [method, setMethod] = useTypedSearchParam('method', 'any', { + const [method, setMethod] = useTypedSearchParam('method', 'any', { deleteParams: ['page'], })