-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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: 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to move methods like above to useAlerts
so they can be re-used.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above may be just a forEach
will be good.
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.
Done.
/> | ||
</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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Outdated
Show resolved
Hide resolved
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.
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.tsx
to use theAlertRow
component.PersonalSignAlertActions
usePersonalSignAlerts
to aggregate the alerts from the providers and add those into the new alert system.setConfirmationAlerts
hook to update and clean alerts based on the current confirmation.useConfirmationAlerts
hook to integrate the types of confirmations into the new alert system.SecurityAlertBanner
in thetitle.tsx
to render the general alerts coming from the new alert system.New Banner Alert component
SecurityAlertBanner
to support general alerts coming from a provider. This component was based on theSecurityProviderBannerAlert
.Folder reorganization
confirmations/alerts
toalerts-system
(ui/components/app/
should not have several subfolders)QA Design feedback
AlertModal
only alerts tied to a field, general alerts should be displayed in the banner on top of the confirmation.info
andwarning
.AlertModal
be in the same level of the navigation and close buttons.AlertModal
.Clean up, team feedback, QA tests and fixes
AlertSeverity
type to use in theAlert
type, also added aprovider
optional property.handleCloseModal
in thefooter.tsx
.getBannerAlertSeverity
,getProviderAlertSeverity
andproviderAlertNormalizer
functions and added Unit tests.undefined
to use primarily the severity from the alert.handleAcknowledgeClick
Related 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