-
Notifications
You must be signed in to change notification settings - Fork 5k
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: Update the counter over the fox to handle notifications #25093
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #25093 +/- ##
===========================================
- Coverage 65.42% 65.40% -0.01%
===========================================
Files 1380 1380
Lines 54688 54715 +27
Branches 14339 14348 +9
===========================================
+ Hits 35776 35786 +10
- Misses 18912 18929 +17 ☔ View full report in Codecov by Sentry. |
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.
Looks good. I have 1 comment on badge counter try/catch part (since I'm paranoid)
Builds ready [2f4d365]
Page Load Metrics (243 ± 259 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
app/scripts/background.js
Outdated
// eslint-disable-next-line @metamask/design-tokens/color-no-hex | ||
const BADGE_COLOR_APPROVAL = '#0376C9'; | ||
// eslint-disable-next-line @metamask/design-tokens/color-no-hex | ||
const BADGE_COLOR_NOTIFICATION = '#D73847'; | ||
const BADGE_LABEL_APPROVAL = '\u22EF'; // unicode ellipsis | ||
const BADGE_MAX_NOTIFICATION_COUNT = '9'; |
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.
These are nice constants!
label = BADGE_LABEL_APPROVAL; | ||
} else if (unreadNotificationsCount > 0) { | ||
label = | ||
unreadNotificationsCount > BADGE_MAX_NOTIFICATION_COUNT |
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.
BADGE_MAX_NOTIFICATION_COUNT
seems to be a string, seems a little odd to do string greater than here.
JS probably converts this to a number when doing this check.
Instead change BADGE_MAX_NOTIFICATION_COUNT
to a number for valid conditional.
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.
(Prith note, this is just me rambling to myself) why don't we use // @ts-check
in our JS files? I guess this will force JS files to be passed through our compiler and might give us false sense of security (since not true TS)... but I think it would still be handy to prevent type mismatch.
Builds ready [843a2d5]
Page Load Metrics (51 ± 3 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [7e13ad5]
Page Load Metrics (51 ± 8 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [2d8d36a]
Page Load Metrics (40 ± 1 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR introduces a new type of counter over the Fox icon to display the number of unread notifications within the extension. This new counter interacts with the existing counter for unapproved transactions in the following way:
The two badges are not shown together, and the badge for unapproved transactions takes priority over the badge for unread notifications.
Related issues
Fixes:
Manual testing steps
In the video, I demonstrate how to test this new feature.
Screenshots/Recordings
https://www.loom.com/share/9a32ec2bd02447e8a29adc4ac1cd3522?sid=d1f74163-54f0-4513-948c-1faa158bd601
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist