Skip to content

Commit d2762a0

Browse files
authored
Merge pull request #2420 from oasisprotocol/mz/lintWarnings-2
Fix lint warnings around components
2 parents 5078a0c + 210d5c5 commit d2762a0

File tree

43 files changed

+276
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+276
-248
lines changed

.changelog/2420.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix lint warnings around components

src/app/components/AccountList/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
3-
import { Table, TableCellAlign, TableColProps } from '../../components/Table'
3+
import { Table, TableColProps } from '../../components/Table'
4+
import { TableCellAlign } from '../../components/Table/types'
45
import { RoundedBalance } from '../../components/RoundedBalance'
56
import { Account } from '../../../oasis-nexus/api'
67
import { TablePaginationProps } from '../Table/TablePagination'

src/app/components/Blocks/ConsensusBlocks.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useTranslation } from 'react-i18next'
22
import { Block, EntityMetadata } from '../../../oasis-nexus/api'
3-
import { Table, TableCellAlign, TableColProps } from '../../components/Table'
3+
import { Table, TableColProps } from '../../components/Table'
4+
import { TableCellAlign } from '../../components/Table/types'
45
import { TablePaginationProps } from '../Table/TablePagination'
56
import { BlockHashLink, BlockLink } from './BlockLink'
67
import { useScreenSize } from '../../hooks/useScreensize'

src/app/components/Blocks/RecentBlocks.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { RecentBlock } from '../../../oasis-nexus/api'
66
import { useScreenSize } from '../../hooks/useScreensize'
77
import { getLayerLabels } from '../../utils/content'
88
import { RouteUtils } from '../../utils/route-utils'
9-
import { Table, TableCellAlign, TableColProps } from '../Table'
9+
import { Table, TableColProps } from '../Table'
10+
import { TableCellAlign } from '../Table/types'
1011
import { TableCellAge } from '../TableCellAge'
1112
import { TableHeaderAge } from '../TableHeaderAge'
1213
import { BlockHashLink, BlockLink } from './BlockLink'

src/app/components/Blocks/RuntimeBlocks.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useTranslation } from 'react-i18next'
22
import { RuntimeBlock } from '../../../oasis-nexus/api'
3-
import { Table, TableCellAlign, TableColProps } from '../../components/Table'
3+
import { Table, TableColProps } from '../../components/Table'
4+
import { TableCellAlign } from '../../components/Table/types'
45
import { paraTimesConfig } from '../../../config'
56
import { TablePaginationProps } from '../Table/TablePagination'
67
import { BlockHashLink, BlockLink } from './BlockLink'
78
import { useScreenSize } from '../../hooks/useScreensize'
89
import { FC } from 'react'
9-
import { BlocksTableType } from './index'
10+
import { BlocksTableType } from './types'
1011
import { TableHeaderAge } from '../TableHeaderAge'
1112
import { TableCellAge } from '../TableCellAge'
1213
import { Progress } from '@oasisprotocol/ui-library/src/components/progress'

src/app/components/Blocks/index.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export enum BlocksTableType {
2+
Mobile,
3+
DesktopLite,
4+
Desktop,
5+
}

src/app/components/ConsensusEvents/ConsensusEventDetails.tsx

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,14 @@ import { useTranslation } from 'react-i18next'
33
import { ConsensusEvent, ConsensusEventType } from '../../../oasis-nexus/api'
44
import { ConsensusScope } from '../../../types/searchScope'
55
import { TransactionLink } from '../Transactions/TransactionLink'
6-
import { TFunction } from 'i18next'
7-
import { exhaustedTypeWarning } from '../../../types/errors'
86
import { MethodIcon } from '../ConsensusTransactionMethod'
97
import { ArrowRight, CopyCheck, LogOut } from 'lucide-react'
108
import { StyledDescriptionList } from '../StyledDescriptionList'
119
import { AccountLink } from '../Account/AccountLink'
1210
import { getPreciseNumberFormat } from '../../../locales/getPreciseNumberFormat'
1311
import { getTokensForScope } from '../../../config'
1412
import { RoundedBalance } from '../RoundedBalance'
15-
16-
export const getConsensusEventTypeLabel = (t: TFunction, type: ConsensusEventType | undefined): string => {
17-
switch (type) {
18-
case 'governance.proposal_executed':
19-
return t('consensusEvent.governanceProposalExecuted')
20-
case 'governance.proposal_finalized':
21-
return t('consensusEvent.governanceProposalFinalized')
22-
case 'governance.proposal_submitted':
23-
return t('consensusEvent.governanceProposalSubmitted')
24-
case 'governance.vote':
25-
return t('consensusEvent.governanceVote')
26-
case 'registry.entity':
27-
return t('consensusEvent.registryEntity')
28-
case 'registry.node':
29-
return t('consensusEvent.registryNode')
30-
case 'registry.node_unfrozen':
31-
return t('consensusEvent.registryNodeUnfrozen')
32-
case 'registry.runtime':
33-
return t('consensusEvent.registryRuntime')
34-
case 'registry.runtime_suspended':
35-
return t('consensusEvent.registryRuntimeSuspended')
36-
case 'roothash.execution_discrepancy':
37-
return t('consensusEvent.roothashExecution_discrepancy')
38-
case 'roothash.executor_committed':
39-
return t('consensusEvent.roothashExecutorCommitted')
40-
case 'roothash.finalized':
41-
return t('consensusEvent.roothashFinalized')
42-
case 'roothash.in_msg_processed':
43-
return t('consensusEvent.roothashInMsgProcessed')
44-
case 'roothash.message':
45-
return t('consensusEvent.roothashMessage')
46-
case 'staking.allowance_change':
47-
return t('consensusEvent.stakingAllowanceChange')
48-
case 'staking.burn':
49-
return t('consensusEvent.stakingBurn')
50-
case 'staking.escrow.add':
51-
return t('consensusEvent.stakingEscrowAdd')
52-
case 'staking.escrow.debonding_start':
53-
return t('consensusEvent.stakingEscrowDebondingStart')
54-
case 'staking.escrow.reclaim':
55-
return t('consensusEvent.stakingEscrowReclaim')
56-
case 'staking.escrow.take':
57-
return t('consensusEvent.stakingEscrowTake')
58-
case 'staking.transfer':
59-
return t('consensusEvent.stakingTransfer')
60-
case undefined:
61-
return t('common.unknown')
62-
default:
63-
exhaustedTypeWarning('Unexpected event type', type)
64-
return type
65-
}
66-
}
13+
import { getConsensusEventTypeLabel } from './helpers'
6714

6815
const ConsensusEventDetailsContent: FC<{
6916
event: ConsensusEvent

src/app/components/ConsensusEvents/ConsensusEventTypeFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ConsensusEventFilteringType } from '../../hooks/useCommonParams'
55
import { TFunction } from 'i18next'
66
import { paraTimesConfig } from '../../../config'
77
import { ParamSetterFunction } from '../../hooks/useTypedSearchParam'
8-
import { getConsensusEventTypeLabel } from './ConsensusEventDetails'
8+
import { getConsensusEventTypeLabel } from './helpers'
99
import { FilterByType } from '../FilterByType'
1010

1111
type Option = {
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { ConsensusEventType } from '../../../oasis-nexus/api'
2+
import { TFunction } from 'i18next'
3+
import { exhaustedTypeWarning } from '../../../types/errors'
4+
5+
export const getConsensusEventTypeLabel = (t: TFunction, type: ConsensusEventType | undefined): string => {
6+
switch (type) {
7+
case 'governance.proposal_executed':
8+
return t('consensusEvent.governanceProposalExecuted')
9+
case 'governance.proposal_finalized':
10+
return t('consensusEvent.governanceProposalFinalized')
11+
case 'governance.proposal_submitted':
12+
return t('consensusEvent.governanceProposalSubmitted')
13+
case 'governance.vote':
14+
return t('consensusEvent.governanceVote')
15+
case 'registry.entity':
16+
return t('consensusEvent.registryEntity')
17+
case 'registry.node':
18+
return t('consensusEvent.registryNode')
19+
case 'registry.node_unfrozen':
20+
return t('consensusEvent.registryNodeUnfrozen')
21+
case 'registry.runtime':
22+
return t('consensusEvent.registryRuntime')
23+
case 'registry.runtime_suspended':
24+
return t('consensusEvent.registryRuntimeSuspended')
25+
case 'roothash.execution_discrepancy':
26+
return t('consensusEvent.roothashExecution_discrepancy')
27+
case 'roothash.executor_committed':
28+
return t('consensusEvent.roothashExecutorCommitted')
29+
case 'roothash.finalized':
30+
return t('consensusEvent.roothashFinalized')
31+
case 'roothash.in_msg_processed':
32+
return t('consensusEvent.roothashInMsgProcessed')
33+
case 'roothash.message':
34+
return t('consensusEvent.roothashMessage')
35+
case 'staking.allowance_change':
36+
return t('consensusEvent.stakingAllowanceChange')
37+
case 'staking.burn':
38+
return t('consensusEvent.stakingBurn')
39+
case 'staking.escrow.add':
40+
return t('consensusEvent.stakingEscrowAdd')
41+
case 'staking.escrow.debonding_start':
42+
return t('consensusEvent.stakingEscrowDebondingStart')
43+
case 'staking.escrow.reclaim':
44+
return t('consensusEvent.stakingEscrowReclaim')
45+
case 'staking.escrow.take':
46+
return t('consensusEvent.stakingEscrowTake')
47+
case 'staking.transfer':
48+
return t('consensusEvent.stakingTransfer')
49+
case undefined:
50+
return t('common.unknown')
51+
default:
52+
exhaustedTypeWarning('Unexpected event type', type)
53+
return type
54+
}
55+
}

0 commit comments

Comments
 (0)