Skip to content

Commit 7e88d74

Browse files
authored
Fix: signer vs plural signers (#4675)
1 parent 6caca1d commit 7e88d74

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

src/components/settings/RequiredConfirmations/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ChangeThresholdFlow } from '@/components/tx-flow/flows'
55
import CheckWallet from '@/components/common/CheckWallet'
66
import { useContext } from 'react'
77
import { TxModalContext } from '@/components/tx-flow'
8+
import { maybePlural } from '@/utils/formatters'
89

910
export const RequiredConfirmation = ({ threshold, owners }: { threshold: number; owners: number }) => {
1011
const { setTxFlow } = useContext(TxModalContext)
@@ -43,7 +44,7 @@ export const RequiredConfirmation = ({ threshold, owners }: { threshold: number;
4344
pr: 2,
4445
}}
4546
>
46-
<b>{threshold}</b> out of <b>{owners}</b> signers.
47+
<b>{threshold}</b> out of <b>{owners}</b> signer{maybePlural(owners)}.
4748
</Typography>
4849

4950
{owners > 1 && (

src/components/tx-flow/flows/RemoveOwner/ReviewRemoveOwner.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import EthHashInfo from '@/components/common/EthHashInfo'
1414

1515
import commonCss from '@/components/tx-flow/common/styles.module.css'
1616
import { ChangeSignerSetupWarning } from '@/features/multichain/components/SignerSetupWarning/ChangeSignerSetupWarning'
17+
import { maybePlural } from '@/utils/formatters'
1718

1819
export const ReviewRemoveOwner = ({ params }: { params: RemoveOwnerFlowProps }): ReactElement => {
1920
const addressBook = useAddressBook()
@@ -55,7 +56,7 @@ export const ReviewRemoveOwner = ({ params }: { params: RemoveOwnerFlowProps }):
5556
Any transaction requires the confirmation of:
5657
</Typography>
5758
<Typography>
58-
<b>{threshold}</b> out of <b>{newOwnerLength}</b> signers
59+
<b>{threshold}</b> out of <b>{newOwnerLength}</b> signer{maybePlural(newOwnerLength)}
5960
</Typography>
6061
</Box>
6162
<Divider className={commonCss.nestedDivider} />

src/components/tx/confirmation-views/SettingsChange/__snapshots__/SettingsChange.test.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ exports[`SettingsChange should display the SettingsChange component with owner d
331331
332332
<b>
333333
1
334-
signers
334+
signer
335335
</b>
336336
</p>
337337
</div>

src/components/tx/confirmation-views/SettingsChange/index.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { SettingsInfoType, type SettingsChange } from '@safe-global/safe-gateway
99
import { ChangeSignerSetupWarning } from '@/features/multichain/components/SignerSetupWarning/ChangeSignerSetupWarning'
1010
import { useContext } from 'react'
1111
import { SettingsChangeContext } from '@/components/tx-flow/flows/AddOwner/context'
12+
import { maybePlural } from '@/utils/formatters'
1213

1314
export interface SettingsChangeProps extends NarrowConfirmationViewProps {
1415
txInfo: SettingsChange
@@ -22,6 +23,7 @@ const SettingsChange: React.FC<SettingsChangeProps> = ({ txInfo: { settingsInfo
2223

2324
const shouldShowChangeSigner = 'owner' in settingsInfo || 'newOwner' in params
2425
const hasNewOwner = 'newOwner' in params
26+
const newSignersLength = safe.owners.length + ('removedOwner' in settingsInfo ? 0 : 1)
2527

2628
return (
2729
<>
@@ -54,7 +56,9 @@ const SettingsChange: React.FC<SettingsChangeProps> = ({ txInfo: { settingsInfo
5456
<Typography variant="body2">Any transaction requires the confirmation of:</Typography>
5557
<Typography>
5658
<b>{settingsInfo.threshold}</b> out of{' '}
57-
<b>{safe.owners.length + ('removedOwner' in settingsInfo ? 0 : 1)} signers</b>
59+
<b>
60+
{newSignersLength} signer{maybePlural(newSignersLength)}
61+
</b>
5862
</Typography>
5963
</Box>
6064
</>

src/components/tx/confirmation-views/__snapshots__/ConfirmationView.test.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ exports[`ConfirmationView should display a confirmation screen for a SETTINGS_CH
123123
124124
<b>
125125
1
126-
signers
126+
signer
127127
</b>
128128
</p>
129129
</div>

0 commit comments

Comments
 (0)