Skip to content

Commit

Permalink
Rename WantedConsensusTxMethod to ConsensusTxMethodFilterOption
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Jan 22, 2025
1 parent 7b3805e commit ba595c9
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/app/components/ConsensusTransactionMethod/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ export const ConsensusTransactionMethod: FC<ConsensusTransactionMethodProps> = (
return <>{getConsensusTransactionMethod(t, method, truncate)}</>
}

export type WantedConsensusTxMethod = ConsensusTxMethod | 'any'
export type ConsensusTxMethodFilterOption = ConsensusTxMethod | 'any'

export const getConsensusTransactionMethodFilteringParam = (
method: WantedConsensusTxMethod,
method: ConsensusTxMethodFilterOption,
): Partial<GetConsensusTransactionsParams> => (method === 'any' ? {} : { method })
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/ConsensusAccountDetailsPage/hooks.tsx
Original file line number Diff line number Diff line change
@@ -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<ConsensusAccountDetailsContext>()
4 changes: 2 additions & 2 deletions src/app/pages/ConsensusAccountDetailsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -22,7 +22,7 @@ export const ConsensusAccountDetailsPage: FC = () => {
const scope = useRequiredScopeParam()
const { network } = scope
const { address, searchTerm } = useLoaderData() as AddressLoaderData
const [method, setMethod] = useTypedSearchParam<WantedConsensusTxMethod>('method', 'any', {
const [method, setMethod] = useTypedSearchParam<ConsensusTxMethodFilterOption>('method', 'any', {
deleteParams: ['page'],
})
const accountQuery = useGetConsensusAccountsAddress(network, address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -58,7 +58,7 @@ const TransactionList: FC<{ scope: SearchScope; blockHeight: number; method: Wan

export const ConsensusBlockTransactionsCard: FC<ConsensusBlockDetailsContext> = ({ scope, blockHeight }) => {
const { t } = useTranslation()
const [method, setMethod] = useTypedSearchParam<WantedConsensusTxMethod>('method', 'any', {
const [method, setMethod] = useTypedSearchParam<ConsensusTxMethodFilterOption>('method', 'any', {
deleteParams: ['page'],
})
const { isMobile } = useScreenSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ 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'
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()
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/ConsensusDashboardPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<WantedConsensusTxMethod>('tx_method', 'any')
const [method, setMethod] = useTypedSearchParam<ConsensusTxMethodFilterOption>('tx_method', 'any')

return (
<PageLayout>
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/ConsensusTransactionsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -29,7 +29,7 @@ export const ConsensusTransactionsPage: FC = () => {
const { t } = useTranslation()
const { isMobile } = useScreenSize()
const pagination = useSearchParamsPagination('page')
const [method, setMethod] = useTypedSearchParam<WantedConsensusTxMethod>('method', 'any', {
const [method, setMethod] = useTypedSearchParam<ConsensusTxMethodFilterOption>('method', 'any', {
deleteParams: ['date'],
})
const offset = (pagination.selectedPage - 1) * limit
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/ValidatorDetailsPage/hooks.ts
Original file line number Diff line number Diff line change
@@ -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<ValidatorDetailsContext>()
4 changes: 2 additions & 2 deletions src/app/pages/ValidatorDetailsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => ({
Expand All @@ -45,7 +45,7 @@ export const ValidatorDetailsPage: FC = () => {
const { t } = useTranslation()
const { isMobile } = useScreenSize()
const scope = useRequiredScopeParam()
const [method, setMethod] = useTypedSearchParam<WantedConsensusTxMethod>('method', 'any', {
const [method, setMethod] = useTypedSearchParam<ConsensusTxMethodFilterOption>('method', 'any', {
deleteParams: ['page'],
})

Expand Down

0 comments on commit ba595c9

Please sign in to comment.