-
Notifications
You must be signed in to change notification settings - Fork 405
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
[Multichain] feat: redesign of multiaccounts and context menu for multiaccounts #4125
Conversation
- Redesigns how sub-items are displayed under multi-accounts. - Adds context menu for multi accounts offering renaming and adding a new network - Some UX fixes around the context menu
Branch preview✅ Deploy successful! Storybook: |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
📦 Next.js Bundle Analysis for safe-wallet-webThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
979.08 KB (🟡 +38.67 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Nineteen Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/ |
507 B (🟢 -24.36 KB) |
979.57 KB |
/address-book |
26.11 KB (🟡 +3 B) |
1005.19 KB |
/apps/open |
54.74 KB (🟡 +1 B) |
1.01 MB |
/balances |
30.64 KB (-3 B) |
1009.72 KB |
/home |
60.28 KB (🟡 +31 B) |
1.01 MB |
/new-safe/advanced-create |
36.51 KB (🟡 +1.37 KB) |
1015.59 KB |
/new-safe/create |
35.76 KB (🟡 +1.36 KB) |
1014.84 KB |
/new-safe/load |
16.38 KB (🟢 -7 B) |
995.46 KB |
/settings/modules |
9.76 KB (🟢 -1 B) |
988.84 KB |
/settings/setup |
35.96 KB (🟡 +1 B) |
1015.03 KB |
/share/safe-app |
9.72 KB (🟢 -2 B) |
988.8 KB |
/terms |
11.24 KB (🟡 +60 B) |
990.32 KB |
/transactions |
73.47 KB (🟡 +1 B) |
1.03 MB |
/transactions/history |
73.44 KB (🟡 +1 B) |
1.03 MB |
/transactions/messages |
39.12 KB (-1 B) |
1018.2 KB |
/transactions/msg |
29.5 KB (-1 B) |
1008.58 KB |
/transactions/queue |
31.22 KB (🟡 +1 B) |
1010.3 KB |
/transactions/tx |
21.05 KB (🟡 +1 B) |
1000.13 KB |
/welcome |
6.77 KB (🟢 -1 B) |
985.84 KB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
Coverage report
Show files with reduced coverage 🔻
Test suite run success1525 tests passing in 206 suites. Report generated by 🧪jest coverage report action from de3c784 |
<IconButton data-testid="safe-options-btn" edge="end" size="small" onClick={handleOpenContextMenu}> | ||
<MoreVertIcon sx={({ palette }) => ({ color: palette.border.main })} /> | ||
</IconButton> | ||
<ContextMenu anchorEl={anchorEl} open={!!anchorEl} onClose={handleCloseContextMenu}> |
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.
<ContextMenu anchorEl={anchorEl} open={!!anchorEl} onClose={handleCloseContextMenu}> | |
<ContextMenu anchorEl={anchorEl.current}> |
|
||
return ( | ||
<> | ||
<IconButton data-testid="safe-options-btn" edge="end" size="small" onClick={handleOpenContextMenu}> |
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.
<IconButton data-testid="safe-options-btn" edge="end" size="small" onClick={handleOpenContextMenu}> | |
<IconButton data-testid="safe-options-btn" edge="end" size="small" onClick={handleOpenContextMenu} ref={anchorEl}> |
|
||
const defaultOpen = { [ModalType.RENAME]: false, [ModalType.ADD_CHAIN]: false } | ||
|
||
const MultiAccountContextMenu = ({ |
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.
about the architecture of this component, since it's a button that shows a dropdown with some options which triggers a modal, would be amazing if we can separate the dropdown in generic renderProps component which provides the openMenu
function to the rendered child and takes an array of options? something like:
<DropdownMenu items={items}>
{(openMenu) => (
<IconButton data-testid="safe-options-btn" edge="end" size="small" onClick={handleOpenContextMenu}>
<MoreVertIcon sx={({ palette }) => ({ color: palette.border.main })} />
</IconButton>
)}
</DropdownMenu>
in this case, items
would be a common type like this:
type item = {
onClick: (e: MouseEvent) => void,
label: string
icon?: React.ReactNode
}[]
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.
The architecture also comes from the MUI component library. I do not think we can easily rewrite it to this.
So I'll stick to how the examples use the component for the time being.
<Box> | ||
<Typography fontSize="14px">Multichain account on:</Typography> | ||
{safes.map((safeItem) => ( | ||
<Box p="4px 0px" key={safeItem.chainId}> | ||
<ChainIndicator chainId={safeItem.chainId} /> | ||
</Box> | ||
))} | ||
</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.
Would be nice if we can move it to be a separated component outside the MultiAccountItem
? So we just need to call the reference of the component inside the tooltip instead of re-creating the component every-time the parent has a re-render?
@@ -44,6 +44,12 @@ | |||
background-color: var(--color-background-light) !important; | |||
} | |||
|
|||
.currentListItem.multiListItem { | |||
border-left-width: 1px; |
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 think you don't need this first line, since the next one overwrites this one 🤔
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.
There is the single account component which uses only currentListItem
without the multiListItem
css class.
I think its needed there.
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.
@schmanu I mean, in the same selector, line 49, you overwrite it with border: 1px solid var(--color-border-light)
🤔
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.
Ah sorry I misunderstood. I thought you meant the entire block not just the line -.-
You are right. I will remove it :)
ESLint Summary View Full Report
Report generated by eslint-plus-action |
…/multi-account-context
ESLint Summary View Full Report
Report generated by eslint-plus-action |
} | ||
|
||
const handleOpenModal = | ||
(type: keyof typeof open, event: typeof OVERVIEW_EVENTS.SIDEBAR_RENAME | typeof OVERVIEW_EVENTS.SIDEBAR_RENAME) => |
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.
(type: keyof typeof open, event: typeof OVERVIEW_EVENTS.SIDEBAR_RENAME | typeof OVERVIEW_EVENTS.SIDEBAR_RENAME) => | |
(type: ModalType, event: typeof OVERVIEW_EVENTS.ADD_NEW_NETWORK | typeof OVERVIEW_EVENTS.SIDEBAR_RENAME) => |
Can we use the enum directly for the type?
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.
Also we have OVERVIEW_EVENTS.SIDEBAR_RENAME
twice in here
const trackingLabel = | ||
router.pathname === AppRoutes.welcome.accounts ? OVERVIEW_LABELS.login_page : OVERVIEW_LABELS.sidebar |
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 is only needed in handleOpenModal
so I suggest moving it there.
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.
✅
ESLint Summary View Full Report
Report generated by eslint-plus-action |
…/multi-account-context
What this PR changes
How to test it
Screenshots
Checklist