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

Add min-width support to Box DS component; Fix Blockaid Security Alert overflow issue; Fix missing Box width-max breakpoint styles #21317

Merged
merged 16 commits into from
Oct 13, 2023

Conversation

digiwand
Copy link
Contributor

@digiwand digiwand commented Oct 11, 2023

Description

  • Fix Blockaid Security Alert Overflow Issue
  • Fix missing ".mm-box--width-max" breakpoint styles. Discovered while adding min-width styles
  • Add min-width support to Box DS component to support fix
  • Add 0 value to $fractions

Manual testing steps

One way to test this:

  1. yarn storybook
  2. go to Blockaid Security Alert page
  3. update "Features" value with the example or another long text.
    example:

"The address 0x07Be9763a718C0539017E2Ab6fC42853b4aEeb6B is malicious"

Screenshots/Recordings

Before

Screenshot 2023-10-11 at 10 45 46 AM

After

Screenshot 2023-10-11 at 10 45 18 AM

Related issues

Fixes #21316

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained:
    • What problem this PR is solving.
    • How this problem was solved.
    • How reviewers can test my changes.
  • I’ve indicated what issue this PR is linked to: Fixes #???
  • I’ve included tests if applicable.
  • I’ve documented any added code.
  • I’ve applied the right labels on the PR (see labeling guidelines).
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@digiwand digiwand added team-design-system All issues relating to design system in Extension team-confirmations-secure-ux-PR PRs from the confirmations team needs-ux-ds-review labels Oct 11, 2023
@digiwand digiwand requested a review from a team as a code owner October 11, 2023 08:51
@github-actions
Copy link
Contributor

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.

jpuri
jpuri previously approved these changes Oct 11, 2023
DDDDDanica
DDDDDanica previously approved these changes Oct 11, 2023
@garrettbear
Copy link
Contributor

LGTM, looks like need to update another snapshot

@digiwand digiwand dismissed stale reviews from DDDDDanica and jpuri via d18484f October 11, 2023 19:46
Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

This looks really great! Because the Box component is central to all of our component library components we are super sensitive to changes. Would it be possible to add some unit tests to ensure coverage is 100% for the minWidth prop? Then we can merge. It would also be great to add some documentation so other engineers can use this technique when they come across the issue but that could be another PR

Edit: I was expecting to see this prop not covered in jest coverage but it looks like it is so maybe coverage was the wrong term here. Nevertheless I think it would be great to add a unit test to test his prop

box

Co-authored-by: George Marshall <[email protected]>
:) adding after syncing & realizing we created nearly the same code here
@digiwand
Copy link
Contributor Author

@georgewrmarshall good call! Thank you. Funny we had nearly the same code when we synced 🚀 also since you're here and I think you built a lot of this, it was really interesting following how the code for this system works!

re: documenting the technique
Happy to add it somewhere if there's a good location for it. I'm not sure where would be a good place though. I will also say that it is a common solution to managing flex elements. Not intuitive though fairly easy to find searching for flex overflow issues

@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ConfirmAddSuggestedNFT Component should match snapshot 1`] = `
{
Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unsure of why Object has been added here?

Copy link
Contributor Author

@digiwand digiwand Oct 12, 2023

Choose a reason for hiding this comment

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

hmm not sure but it caused the test to fail. I ran yarn test:unit:jest:watch --updateSnapshot* earlier which I believe added this

Copy link
Contributor Author

@digiwand digiwand Oct 12, 2023

Choose a reason for hiding this comment

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

This was interesting because it was added by --updateSnapshot. When I ran the test locally, the test wasn't failing with Object.

Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

LGTM! Really nice work

not sure why it's failling in my PR rather than before this
not sure why yarn lint:fix added this
@@ -240,6 +240,7 @@ const ConfirmAddSuggestedNFT = () => {
return (
<Box
className="confirm-add-suggested-nft__nft-single"
key={`confirm-add-suggested-nft__nft-single-${id}`}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-10-12 at 11 18 22 AM

Fixed this during the quest to fix CI/CD tests.

@digiwand
Copy link
Contributor Author

quite the stubborn tests 😅

running yarn test:unit:jest:watch --updateSnapshots stalls at ~341 out of 568 test suites. When they fail in CircleCI I'm only seeing the latest test failure. When I update an individual test, it has been prepending Objector Array on the test wrapper. Need to remove and then "Save without formatting". Something is also strange with my VSCode. I disabled ESLint, Prettier, and the related settings, and still, when I save, it will remove the white lines from the .snap files.

guess I'm doing these one at a time until I can unlock a better way

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (d6d324b) 68.61% compared to head (f9ddc7c) 68.61%.
Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #21317   +/-   ##
========================================
  Coverage    68.61%   68.61%           
========================================
  Files         1020     1020           
  Lines        40929    40929           
  Branches     10920    10920           
========================================
  Hits         28080    28080           
  Misses       12849    12849           
Files Coverage Δ
...ert/blockaid-banner-alert/blockaid-banner-alert.js 95.83% <100.00%> (ø)
...ents/component-library/banner-base/banner-base.tsx 100.00% <ø> (ø)
ui/components/component-library/box/box.tsx 100.00% <ø> (ø)
ui/helpers/constants/design-system.ts 100.00% <ø> (ø)
...irm-add-suggested-nft/confirm-add-suggested-nft.js 86.30% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [f9ddc7c]
Page Load Metrics (1255 ± 404 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint932291152914
domContentLoaded771941032512
load8822001255840404
domInteractive771941032512
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 113 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@digiwand
Copy link
Contributor Author

the tests are passing 🤘🏼 Thanks for the reviews! May we get 2 more reviews/approvals again plz? ty in advance
@DDDDDanica @garrettbear @georgewrmarshall @jpuri

@brad-decker brad-decker merged commit a3b78f0 into develop Oct 13, 2023
9 checks passed
@brad-decker brad-decker deleted the fix-blockaid-banner-alert-overflowing-text branch October 13, 2023 14:36
@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2023
@metamaskbot metamaskbot added the release-11.5.0 Issue or pull request that will be included in release 11.5.0 label Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.5.0 Issue or pull request that will be included in release 11.5.0 team-confirmations-secure-ux-PR PRs from the confirmations team team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: PPOM Blockaid Security Alert UI See Details content overflows
8 participants