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

Fix/18884 migrate avatar network #19079

Merged

Conversation

thebinij
Copy link
Contributor

@thebinij thebinij commented May 9, 2023

Explanation

Screenshots/Screencaps

Before

before.mp4

After

after.mp4

Manual Testing Steps

No functional changes

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@thebinij thebinij requested a review from a team as a code owner May 9, 2023 16:27
@thebinij thebinij requested a review from legobeat May 9, 2023 16:27
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2023

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.

@thebinij
Copy link
Contributor Author

thebinij commented May 9, 2023

Hi @georgewrmarshall, I have updated the code after you suggestions in the Old PR. Please review it. I need your help to understand causation of error in test-deps-depcheck. Thanks

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label May 10, 2023
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.

Looking good. Left one suggestion that I missed in my last review. And it will need a rebase

/**
* Props for the AvatarNetwork component
*/
export interface AvatarNetworkProps extends BoxProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could extend AvatarBaseProps here instead of BoxProps and remove backgroundColor, borderColor, color, as types altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that would be great.

@@ -20,7 +21,7 @@ export interface AvatarBaseProps extends TextProps {
* 'AvatarBaseSize.Md'(32px), 'AvatarBaseSize.Lg'(40px), 'AvatarBaseSize.Xl'(48px)
* Defaults to AvatarBaseSize.Md
*/
size?: AvatarBaseSize;
size?: AvatarBaseSize | AvatarNetworkSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this because if we carry on this pattern we will just end up with many variant types that AvatarBase accepts. There must be a TypeScript pattern that uses an argument type? I'm willing to proceed until we develop that pattern

@codecov
Copy link

codecov bot commented May 14, 2023

Codecov Report

Merging #19079 (763dc3d) into develop (e923110) will decrease coverage by 0.01%.
The diff coverage is 95.65%.

❗ Current head 763dc3d differs from pull request most recent head 6a0732f. Consider uploading reports for the commit 6a0732f to get more accurate results

@@             Coverage Diff             @@
##           develop   #19079      +/-   ##
===========================================
- Coverage    69.35%   69.34%   -0.01%     
===========================================
  Files          986      985       -1     
  Lines        37265    37263       -2     
  Branches     10002    10003       +1     
===========================================
- Hits         25843    25839       -4     
- Misses       11422    11424       +2     
Impacted Files Coverage Δ
ui/components/app/add-network/add-network.js 56.25% <ø> (ø)
...list-item/smart-transaction-list-item.component.js 3.12% <ø> (ø)
...ction-list-item/transaction-list-item.component.js 70.27% <ø> (ø)
...ents/component-library/avatar-base/avatar-base.tsx 100.00% <ø> (ø)
...component-library/picker-network/picker-network.js 100.00% <ø> (ø)
ui/components/multichain/nft-item/nft-item.js 100.00% <ø> (ø)
...ents/multichain/token-list-item/token-list-item.js 100.00% <ø> (ø)
...omponent-library/avatar-network/avatar-network.tsx 95.65% <95.65%> (ø)

... and 2 files with indirect coverage changes

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.

Hey @thebinij, one more suggestion

/**
* The name accepts the string to render the first alphabet of the Avatar Name
*/
name?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make this required so the AvatarNetwork always has a child

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I have made "name" to be required. And also omitted "children" from the Base like suggested in AvatarIcon's PR

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.

Hey @thebinij, code is looking good could you please add a screencast from storybook of the component docs and stories to the PR description. That way we can ensure there is no visual regression and everything works as expected. Thanks!

@thebinij
Copy link
Contributor Author

Hey @thebinij, code is looking good could you please add a screencast from storybook of the component docs and stories to the PR description. That way we can ensure there is no visual regression and everything works as expected. Thanks!

Hi @georgewrmarshall, I have included the before and after screencast to the description.

@thebinij thebinij force-pushed the fix/18884-Migrate-AvatarNetwork branch 2 times, most recently from 85379a1 to a962795 Compare May 29, 2023 06:55
@georgewrmarshall
Copy link
Contributor

Hey @thebinij, Thanks for your time and effort in creating this pull request. As you're probably aware we have identified an issue related to the typing of the Box component, specifically with the polymorphic as prop. To address this issue, we have an open ticket at #19239 and a draft pull request at #19363 that needs to be merged before we can proceed with your PR. Thanks for your patience

@thebinij thebinij force-pushed the fix/18884-Migrate-AvatarNetwork branch from a962795 to f87390c Compare June 13, 2023 17:02
@thebinij thebinij force-pushed the fix/18884-Migrate-AvatarNetwork branch from f87390c to 5ec399f Compare June 25, 2023 06:00
@thebinij
Copy link
Contributor Author

Hi @georgewrmarshall, Is there anything I can update in the PR before so you approve to merge it?

@georgewrmarshall
Copy link
Contributor

Blocked by #19572

fixing error

fix textAlign

added AvatarNetworkSize

NetworkProps extends BaseProps instead of Boxprops

omitted children from base, made name required

replace deprecated and fix lint
@garrettbear garrettbear force-pushed the fix/18884-Migrate-AvatarNetwork branch from 5ec399f to 724efad Compare July 20, 2023 20:54
@garrettbear
Copy link
Contributor

@thebinij jumped in to help you out with some of the recent updates made the Box component and AvatarBase

@@ -14,7 +14,7 @@ export enum AvatarBaseSize {
Xl = 'xl',
}

export interface Props extends TextStyleUtilityProps {
export interface AvatarBaseStyleUtilityProps extends TextStyleUtilityProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

@georgewrmarshall renamed the base props here to be consistent with how we have been doing it lately.

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.

Unfortunately we can't reassign enums you can sort of see what happens when using the storybook controls

Screenshot 2023-07-21 at 11 05 04 AM

Also not sure why the props table isn't showing up?

Screenshot 2023-07-21 at 11 04 39 AM

It would be helpful to update the Before/After screencasts to ensure the storybook still works
https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-avatarnetwork--docs

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.

Looking good! One suggestion to remove the JS version of the Box from avatar-network.stories.tsx

And can we update this line in the ui/components/component-library/avatar-network/README.mdx to point to the TS Box props

The `AvatarNetwork` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props

to

The `AvatarNetwork` accepts all props below as well as all [Box](/docs/components-componentlibrary-box--docs#props) component props

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! Thanks for your contribution @thebinij and supporting @garrettbear

@garrettbear garrettbear merged commit ceadfac into MetaMask:develop Jul 24, 2023
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external-contributor team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate components to TS: AvatarNetwork
4 participants