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

feat: add new label to swaps button [SWAP-86] #3763

Merged
merged 4 commits into from
May 29, 2024
Merged

Conversation

compojoom
Copy link
Collaborator

What it solves

Displays a "new" label next to the swap navitem

How to test it

Open a safe and in the menu on the right Swap should have a "new" badge/label.

Screenshots

grafik

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

Add new label

Copy link

github-actions bot commented May 28, 2024

@@ -12,7 +12,7 @@ const darkPalette = {
secondary: {
dark: '#636669',
main: '#FFFFFF',
light: '#12FF80',
light: '#B0FFC9',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was synced with @TanyaEfremova

Copy link

github-actions bot commented May 28, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Comment on lines 42 to 44
if (item.href === AppRoutes.swap) {
return <Chip label="New" color="success" sx={{ ml: 1 }} />
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should this be behind a feature flag or be a configuration constant somewhere? I don't know when we want to ermove it, but then we'll need to go in this file an delete this code.

Copy link

github-actions bot commented May 28, 2024

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

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

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 949.98 KB (🟡 +54 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

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

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Copy link

github-actions bot commented May 28, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.48% (+0% 🔼)
11286/14200
🔴 Branches
58.49% (-0.01% 🔻)
2697/4611
🟡 Functions
66.64% (-0.01% 🔻)
1820/2731
🟢 Lines
80.85% (-0.01% 🔻)
10177/12587
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / index.tsx
51.43% (-1.35% 🔻)
0% 0%
56.25% (-1.33% 🔻)

Test suite run success

1436 tests passing in 197 suites.

Report generated by 🧪jest coverage report action from a2de336

return <SidebarListItemCounter count={queueSize} />
}

if (item.href === AppRoutes.swap) {
Copy link
Member

Choose a reason for hiding this comment

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

Since this is just a static property, I would move it to the navItems config. The queue is in this dynamic code only because we need to count the queue size.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea! Please check again.

}

if (item.href === AppRoutes.swap) {
return <Chip label="New" color="success" sx={{ ml: 1 }} />
Copy link
Member

Choose a reason for hiding this comment

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

@TanyaEfremova what chip style should be used here? We've used this one in other places:
Screenshot 2024-05-29 at 10 38 37

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I initially went for the "new chip" that we have, but that is not what is in the figma design.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use the new chip for the navigation only. Also see the new chip used for pending transactions counter. The one on the screenshot would be too big for the navigation, so it will be re-used.

We can definitely merge the 'New' chip and use it for the newly released features

@@ -98,7 +101,7 @@ const Navigation = (): ReactElement => {
<SidebarListItemText data-testid="sidebar-list-item" bold>
{item.label}

<SidebarListItemCounter count={getCounter(item)} />
<NavItemTag item={item} />
Copy link
Member

Choose a reason for hiding this comment

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

You could pass queue size here to avoid calling the useQueuedTxsLength for each item.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, i've refactored it.

@@ -31,6 +33,7 @@ export const navItems: NavItem[] = [
label: 'Swap',
icon: <SvgIcon component={SwapIcon} inheritViewBox />,
href: AppRoutes.swap,
tag: <Chip label="New" color="success" sx={{ ml: 1 }} />,
Copy link
Member

Choose a reason for hiding this comment

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

Looks good! Alternatively it could be a boolean prop like isNew. Both are fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, I like it being a react component. This way we could add whatever we want to other items

@compojoom compojoom marked this pull request as ready for review May 29, 2024 11:05
@compojoom compojoom merged commit 3da9a4e into dev May 29, 2024
14 checks passed
@compojoom compojoom deleted the feat-add-new-badge branch May 29, 2024 16:00
@github-actions github-actions bot locked and limited conversation to collaborators May 29, 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.

3 participants