Skip to content
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

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Fix: signer vs plural signers #4675

merged 1 commit into from
Dec 17, 2024

Conversation

katspaugh
Copy link
Member

What it solves

Resolves a comment by Franco:

minor issue

There is a ticket where we changed signer/signers depending on if there was more than 1 signer.
There is the situation where if a user is removed from a safe with 2 owners, the ending result should say "1 out of 1 signer" but it still says signers:
- Have a safe with 2 owners
- Remove one
- In the review step, just before executing, see the wording

image

Copy link

github-actions bot commented Dec 17, 2024

Copy link

@github-actions github-actions bot left a 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 && (

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} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Consider renaming maybePlural to something more descriptive like pluralizeIfNeeded to enhance readability.
  2. 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>

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>
</>

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>

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.

Copy link

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/settings/setup 30.81 KB (🟡 +12 B) 1.02 MB
Details

Only 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 next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

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.

Copy link

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
73.84% (+0% 🔼)
14385/19480
🔴 Branches 51.39% 3433/6680
🔴 Functions 56.77% 2041/3595
🟡 Lines
75.37% (+0% 🔼)
13045/17308

Test suite run success

1707 tests passing in 231 suites.

Report generated by 🧪jest coverage report action from e4a5f7a

@katspaugh katspaugh merged commit 7e88d74 into dev Dec 17, 2024
16 checks passed
@katspaugh katspaugh deleted the signers branch December 17, 2024 07:20
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant