Skip to content

Commit a571f5f

Browse files
NidhiKJhaameliejyc
andauthored
feat: added sidepanel icon (#37777)
This PR is to add sidepanel/popup icon to the DS component library. It also fixes an edge case with the Advanced Settings `Show extension in full-size view` button where users who have turned sidepanel on after enabling this will see sidepanel by default. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry:null ## **Related issues** Fixes: [https://consensyssoftware.atlassian.net/browse/CEUX-684](https://consensyssoftware.atlassian.net/browse/CEUX-684) ) ## **Manual testing steps** 1. In storybook, check sidepanel icon 2. Go to popup view or sidepanel and check the icon in global menu ## **Screenshots/Recordings** ### **Before** NA ### **After** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ![Screenshot 2025-11-13 at 4 36 06 PM](https://github.com/user-attachments/assets/127b771a-a5e8-4521-a508-ffa0afbf71d2) ![Screenshot 2025-11-13 at 10 10 04 PM](https://github.com/user-attachments/assets/d214efc2-2817-42ab-acf9-5e4ba1e307d7) ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds popup/sidepanel icons to the design system, uses them for the view toggle in the global menu, and enables the full-size opening behavior from sidepanel too. > > - **Design System / Icons**: > - Add `app/images/icons/popup.svg` and `app/images/icons/sidepanel.svg`. > - Expose `IconName.Popup` and `IconName.Sidepanel` in `ui/components/component-library/icon/icon.types.ts`. > - **Global Menu** (`ui/components/multichain/global-menu/global-menu.tsx`): > - Replace viewport toggle to use `IconName.Popup`/`IconName.Sidepanel` and `isSidePanelDefault` logic; update metrics payload and close behavior. > - Add divider after notifications section. > - **Routing / Behavior** (`ui/pages/routes/routes.component.tsx`): > - Extend "Show extension in full-size view" to trigger when in `ENVIRONMENT_TYPE_SIDEPANEL` as well as popup. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 592283c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: ameliejyc <amelie.chan@gmail.com>
1 parent c3cb78d commit a571f5f

File tree

5 files changed

+51
-30
lines changed

5 files changed

+51
-30
lines changed

app/images/icons/popup.svg

Lines changed: 3 additions & 0 deletions
Loading

app/images/icons/sidepanel.svg

Lines changed: 10 additions & 0 deletions
Loading

ui/components/component-library/icon/icon.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export enum IconName {
201201
Plug = 'plug',
202202
PlusAndMinus = 'plus-and-minus',
203203
PolicyAlert = 'policy-alert',
204+
Popup = 'popup',
204205
Print = 'print',
205206
PriorityHigh = 'priority-high',
206207
PrivacyTip = 'privacy-tip',
@@ -241,6 +242,7 @@ export enum IconName {
241242
ShieldLock = 'shield-lock',
242243
ShoppingBag = 'shopping-bag',
243244
ShoppingCart = 'shopping-cart',
245+
Sidepanel = 'sidepanel',
244246
SignalCellular = 'signal-cellular',
245247
Slash = 'slash',
246248
Sms = 'sms',

ui/components/multichain/global-menu/global-menu.tsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ export const GlobalMenu = ({
336336
<NotificationsTagCounter />
337337
</Box>
338338
</MenuItem>
339+
<Box
340+
borderColor={BorderColor.borderMuted}
341+
width={BlockSize.Full}
342+
style={{ height: '1px', borderBottomWidth: 0 }}
343+
></Box>
339344
</>
340345
)}
341346
{rewardsEnabled && (
@@ -394,6 +399,32 @@ export const GlobalMenu = ({
394399
width={BlockSize.Full}
395400
style={{ height: '1px', borderBottomWidth: 0 }}
396401
></Box>
402+
{/* Toggle between popup and sidepanel - only for Chrome when sidepanel is enabled */}
403+
{getBrowserName() !== PLATFORM_FIREFOX &&
404+
isSidePanelEnabled &&
405+
(getEnvironmentType() === ENVIRONMENT_TYPE_POPUP ||
406+
getEnvironmentType() === ENVIRONMENT_TYPE_SIDEPANEL) && (
407+
<MenuItem
408+
iconName={isSidePanelDefault ? IconName.Popup : IconName.Sidepanel}
409+
onClick={async () => {
410+
await toggleDefaultView();
411+
trackEvent({
412+
event: MetaMetricsEventName.ViewportSwitched,
413+
category: MetaMetricsEventCategory.Navigation,
414+
properties: {
415+
location: METRICS_LOCATION,
416+
to: isSidePanelDefault
417+
? ENVIRONMENT_TYPE_POPUP
418+
: ENVIRONMENT_TYPE_SIDEPANEL,
419+
},
420+
});
421+
closeMenu();
422+
}}
423+
data-testid="global-menu-toggle-view"
424+
>
425+
{isSidePanelDefault ? t('switchToPopup') : t('switchToSidePanel')}
426+
</MenuItem>
427+
)}
397428
<MenuItem
398429
to={
399430
isGatorPermissionsRevocationFeatureEnabled()
@@ -416,35 +447,6 @@ export const GlobalMenu = ({
416447
>
417448
{t('allPermissions')}
418449
</MenuItem>
419-
{/* Toggle between popup and sidepanel - only for Chrome when sidepanel is enabled */}
420-
{getBrowserName() !== PLATFORM_FIREFOX &&
421-
isSidePanelEnabled &&
422-
(getEnvironmentType() === ENVIRONMENT_TYPE_POPUP ||
423-
getEnvironmentType() === ENVIRONMENT_TYPE_SIDEPANEL) && (
424-
<MenuItem
425-
iconName={IconName.Expand}
426-
onClick={async () => {
427-
await toggleDefaultView();
428-
trackEvent({
429-
event: MetaMetricsEventName.ViewportSwitched,
430-
category: MetaMetricsEventCategory.Navigation,
431-
properties: {
432-
location: METRICS_LOCATION,
433-
to:
434-
getEnvironmentType() === ENVIRONMENT_TYPE_SIDEPANEL
435-
? ENVIRONMENT_TYPE_POPUP
436-
: ENVIRONMENT_TYPE_SIDEPANEL,
437-
},
438-
});
439-
closeMenu();
440-
}}
441-
data-testid="global-menu-toggle-view"
442-
>
443-
{getEnvironmentType() === ENVIRONMENT_TYPE_SIDEPANEL
444-
? t('switchToPopup')
445-
: t('switchToSidePanel')}
446-
</MenuItem>
447-
)}
448450
<MenuItem
449451
data-testid="global-menu-networks"
450452
iconName={IconName.Hierarchy}

ui/pages/routes/routes.component.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,11 @@ export default function Routes() {
614614

615615
useEffect(() => {
616616
const windowType = getEnvironmentType();
617-
if (showExtensionInFullSizeView && windowType === ENVIRONMENT_TYPE_POPUP) {
617+
if (
618+
showExtensionInFullSizeView &&
619+
(windowType === ENVIRONMENT_TYPE_POPUP ||
620+
windowType === ENVIRONMENT_TYPE_SIDEPANEL)
621+
) {
618622
global.platform?.openExtensionInBrowser?.();
619623
}
620624
}, [showExtensionInFullSizeView]);

0 commit comments

Comments
 (0)