-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: signer vs plural signers #4675
Conversation
Branch preview✅ Deploy successful! Website: Storybook: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review by ChatGPT
@@ -43,7 +44,7 @@ export const RequiredConfirmation = ({ threshold, owners }: { threshold: number; | |||
pr: 2, | |||
}} | |||
> | |||
<b>{threshold}</b> out of <b>{owners}</b> signers. | |||
<b>{threshold}</b> out of <b>{owners}</b> signer{maybePlural(owners)}. | |||
</Typography> | |||
|
|||
{owners > 1 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving maybePlural
logic out of template literal for clarity. Refactor to use a single function call within the component to determine singular or plural form, to enhance readability and maintainability.
@@ -55,7 +56,7 @@ export const ReviewRemoveOwner = ({ params }: { params: RemoveOwnerFlowProps }): | |||
Any transaction requires the confirmation of: | |||
</Typography> | |||
<Typography> | |||
<b>{threshold}</b> out of <b>{newOwnerLength}</b> signers | |||
<b>{threshold}</b> out of <b>{newOwnerLength}</b> signer{maybePlural(newOwnerLength)} | |||
</Typography> | |||
</Box> | |||
<Divider className={commonCss.nestedDivider} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Consider renaming
maybePlural
to something more descriptive likepluralizeIfNeeded
to enhance readability. - Inline logic for pluralization could be moved to a utility file if used across multiple components, adhering to DRY principles.
@@ -331,7 +331,7 @@ exports[`SettingsChange should display the SettingsChange component with owner d | |||
|
|||
<b> | |||
1 | |||
signers | |||
signer | |||
</b> | |||
</p> | |||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the conditional for singular/plural form is accurate. Changing "signers" to "signer" might be incorrect if it's intended for a plural context. Verify the logic, handling both singular and plural cases to avoid linguistic errors.
<b>{safe.owners.length + ('removedOwner' in settingsInfo ? 0 : 1)} signers</b> | ||
<b> | ||
{newSignersLength} signer{maybePlural(newSignersLength)} | ||
</b> | ||
</Typography> | ||
</Box> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const newSignersLength = safe.owners.length + ('removedOwner' in settingsInfo ? 0 : 1);
Consider encapsulating the logic to determine the number of signers inside a function for clarity and reuse. This will simplify the component and improve code readability.
@@ -123,7 +123,7 @@ exports[`ConfirmationView should display a confirmation screen for a SETTINGS_CH | |||
|
|||
<b> | |||
1 | |||
signers | |||
signer | |||
</b> | |||
</p> | |||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the change from "signers" to "signer" does not impact any logic that depends on the plurality of signers. Verify surrounding code for logic that might assume a list or count of signers, and adjust business logic if applicable.
📦 Next.js Bundle Analysis for safe-wallet-webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 One Page Changed SizeThe following page changed size from the code in this PR compared to its base branch:
DetailsOnly the gzipped size is provided here based on an expert tip. First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If Any third party scripts you have added directly to your app using the Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. |
Coverage report
Test suite run success1707 tests passing in 231 suites. Report generated by 🧪jest coverage report action from e4a5f7a |
What it solves
Resolves a comment by Franco: