feat: Implement alerts for personal sign#24469
Conversation
…lert-modal-component
…lert-modal-component
…ne-alert-info-row-component
…ne-alert-info-row-component
…al.tsx Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
…al.tsx Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
…al.test.tsx Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
…lert-modal-component
| const hasUnconfirmedAlerts = alerts.some( | ||
| (alert: Alert) => | ||
| !isAlertConfirmed(alert.key) && alert.severity === Severity.Danger, | ||
| ); |
There was a problem hiding this comment.
It might be useful to move methods like above to useAlerts so they can be re-used.
There was a problem hiding this comment.
100%, I should have done that before. I didn't push it because I saw this improvement in your PR.
| } | ||
| return highestSeverity; | ||
| }, Severity.Info); | ||
| } |
There was a problem hiding this comment.
Above may be just a forEach will be good.
| /> | ||
| </Box> | ||
| ); | ||
| } |
There was a problem hiding this comment.
It will be useful to extract above component into separate file. We try to keep confirmation code lesser number of lines per file and smaller well defined components.
There was a problem hiding this comment.
This makes sense, is it ok to extract in a different PR? I'm happy to do it.
ui/pages/confirmations/components/confirm/alert-system/alert-provider/alert-provider.tsx
Show resolved
Hide resolved
jpuri
left a comment
There was a problem hiding this comment.
I left some small feedbacks, changes largely look good.
Builds ready [555e858]
Page Load Metrics (1426 ± 599 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [3e092e3]
Page Load Metrics (788 ± 528 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
6568ea8 to
fc35032
Compare
Builds ready [fc35032]
Page Load Metrics (554 ± 470 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [05041ce]
Page Load Metrics (414 ± 392 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR aims to implement alerts for personal sign.
Context
The confirmation supporting the personal sign operation was one of the first confirmations implemented using the new confirmation architecture.
In order to test and demonstrate the use of the new alert system, we can incorporate suitable alerts into the personal sign confirmation.
Changes
Implementation
personal-sign.tsxto use theAlertRowcomponent.PersonalSignAlertActionsusePersonalSignAlertsto aggregate the alerts from the providers and add those into the new alert system.setConfirmationAlertshook to update and clean alerts based on the current confirmation.useConfirmationAlertshook to integrate the types of confirmations into the new alert system.SecurityAlertBannerin thetitle.tsxto render the general alerts coming from the new alert system.New Banner Alert component
SecurityAlertBannerto support general alerts coming from a provider. This component was based on theSecurityProviderBannerAlert.Folder reorganization
confirmations/alertstoalerts-system(ui/components/app/should not have several subfolders)QA Design feedback
AlertModalonly alerts tied to a field, general alerts should be displayed in the banner on top of the confirmation.infoandwarning.AlertModalbe in the same level of the navigation and close buttons.AlertModal.Clean up, team feedback, QA tests and fixes
AlertSeveritytype to use in theAlerttype, also added aprovideroptional property.handleCloseModalin thefooter.tsx.getBannerAlertSeverity,getProviderAlertSeverityandproviderAlertNormalizerfunctions and added Unit tests.undefinedto use primarily the severity from the alert.handleAcknowledgeClickRelated issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2412
Manual testing steps
PRs Related
#23719
#23625
#23664
#24049
#24214
#24400
Screenshots/Recordings
personal-sign-alert-system.webm
Security banner alert

Multiple alerts

Before
After
Pre-merge author checklist
Pre-merge reviewer checklist