From dba5bb01a0d1a1867cffecbc72edfa074350cdcd Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 20 Apr 2023 17:19:24 +0100 Subject: [PATCH] account & network dropdown tweaks --- README.md | 4 + .../account-menu/account-menu.component.js | 198 ++---------------- ui/components/app/account-menu/index.scss | 40 +--- .../app/dropdowns/network-dropdown.js | 133 +++--------- ui/components/app/network-display/index.scss | 3 - .../app/network-display/network-display.js | 39 +--- ui/components/ui/chip/chip.js | 7 +- ui/helpers/constants/design-system.ts | 12 +- 8 files changed, 70 insertions(+), 366 deletions(-) diff --git a/README.md b/README.md index 5fde01191..ff92c69a3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ > 🦊 Minimalized version of MetaMask for my own personal use without the myriad of banners & buttons I will never use, and without that terrible Roboto typeface. +Screenshot 2023-04-20 at 17 04 11 + +Screenshot 2023-04-20 at 17 04 26 + Screenshot 2023-04-05 at 19 58 35 **Don't blindly trust me and double check the changes before installing this in your own browser.** diff --git a/ui/components/app/account-menu/account-menu.component.js b/ui/components/app/account-menu/account-menu.component.js index 7c0b98bc3..a0f0632cf 100644 --- a/ui/components/app/account-menu/account-menu.component.js +++ b/ui/components/app/account-menu/account-menu.component.js @@ -1,41 +1,26 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { debounce } from 'lodash'; import Fuse from 'fuse.js'; import InputAdornment from '@material-ui/core/InputAdornment'; import classnames from 'classnames'; import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'; -import { - MetaMetricsContextProp, - MetaMetricsEventAccountType, - MetaMetricsEventCategory, - MetaMetricsEventName, -} from '../../../../shared/constants/metametrics'; import { getEnvironmentType } from '../../../../app/scripts/lib/util'; import Identicon from '../../ui/identicon'; import SiteIcon from '../../ui/site-icon'; import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display'; -import { - PRIMARY, - ///: BEGIN:ONLY_INCLUDE_IN(beta,flask) - SUPPORT_REQUEST_LINK, - ///: END:ONLY_INCLUDE_IN -} from '../../../helpers/constants/common'; +import { PRIMARY } from '../../../helpers/constants/common'; import { SETTINGS_ROUTE, NEW_ACCOUNT_ROUTE, IMPORT_ACCOUNT_ROUTE, CONNECT_HARDWARE_ROUTE, - DEFAULT_ROUTE, ///: BEGIN:ONLY_INCLUDE_IN(flask) NOTIFICATIONS_ROUTE, ///: END:ONLY_INCLUDE_IN } from '../../../helpers/constants/routes'; import TextField from '../../ui/text-field'; -import Button from '../../ui/button'; import SearchIcon from '../../ui/icon/search-icon'; -import { SUPPORT_LINK } from '../../../../shared/lib/ui-utils'; import { IconColor } from '../../../helpers/constants/design-system'; import { Icon, IconName, IconSize } from '../../component-library'; import KeyRingLabel from './keyring-label'; @@ -82,7 +67,6 @@ export default class AccountMenu extends Component { history: PropTypes.object, isAccountMenuOpen: PropTypes.bool, keyrings: PropTypes.array, - lockMetamask: PropTypes.func, selectedAddress: PropTypes.string, setSelectedAccount: PropTypes.func, toggleAccountMenu: PropTypes.func, @@ -96,7 +80,6 @@ export default class AccountMenu extends Component { accountsRef; state = { - shouldShowScrollButton: false, searchQuery: '', }; @@ -113,22 +96,13 @@ export default class AccountMenu extends Component { ], }); - componentDidUpdate(prevProps, prevState) { + componentDidUpdate(prevProps) { const { isAccountMenuOpen: prevIsAccountMenuOpen } = prevProps; - const { searchQuery: prevSearchQuery } = prevState; const { isAccountMenuOpen } = this.props; - const { searchQuery } = this.state; if (!prevIsAccountMenuOpen && isAccountMenuOpen) { - this.setShouldShowScrollButton(); this.resetSearchQuery(); } - - // recalculate on each search query change - // whether we can show scroll down button - if (isAccountMenuOpen && prevSearchQuery !== searchQuery) { - this.setShouldShowScrollButton(); - } } renderAccountsSearch() { @@ -208,16 +182,7 @@ export default class AccountMenu extends Component { return ( - -
{shouldShowAccountsSearch ? this.renderAccountsSearch() : null}
{ this.accountsRef = ref; }} > {this.renderAccounts()}
- {this.renderScrollButton()}
{ toggleAccountMenu(); - trackEvent({ - category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.AccountAddSelected, - properties: { - account_type: MetaMetricsEventAccountType.Default, - location: 'Main Menu', - }, - }); history.push(NEW_ACCOUNT_ROUTE); }} icon={} @@ -376,14 +270,6 @@ export default class AccountMenu extends Component { { toggleAccountMenu(); - trackEvent({ - category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.AccountAddSelected, - properties: { - account_type: MetaMetricsEventAccountType.Imported, - location: 'Main Menu', - }, - }); history.push(IMPORT_ACCOUNT_ROUTE); }} icon={ @@ -394,14 +280,6 @@ export default class AccountMenu extends Component { { toggleAccountMenu(); - trackEvent({ - category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.AccountAddSelected, - properties: { - account_type: MetaMetricsEventAccountType.Hardware, - location: 'Main Menu', - }, - }); if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) { global.platform.openExtensionInBrowser(CONNECT_HARDWARE_ROUTE); } else { @@ -413,66 +291,32 @@ export default class AccountMenu extends Component { } text={t('connectHardwareWallet')} /> -
{ ///: BEGIN:ONLY_INCLUDE_IN(flask) - <> - { - toggleAccountMenu(); - history.push(NOTIFICATIONS_ROUTE); - }} - icon={ -
- - {unreadNotificationsCount > 0 && ( -
- {unreadNotificationsCount} -
- )} -
- } - text={t('notifications')} - /> -
- + { + toggleAccountMenu(); + history.push(NOTIFICATIONS_ROUTE); + }} + icon={ +
+ + {unreadNotificationsCount > 0 && ( +
+ {unreadNotificationsCount} +
+ )} +
+ } + text={t('notifications')} + /> ///: END:ONLY_INCLUDE_IN } - { - trackEvent( - { - category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.SupportLinkClicked, - properties: { - url: supportLink, - }, - }, - { - contextPropsIntoEventProperties: [ - MetaMetricsContextProp.PageTitle, - ], - }, - ); - global.platform.openTab({ url: supportLink }); - }} - icon={ - - } - text={supportText} - /> { toggleAccountMenu(); history.push(SETTINGS_ROUTE); - this.context.trackEvent({ - category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.NavSettingsOpened, - properties: { - location: 'Main Menu', - }, - }); }} icon={ -
- ) : null} -
-
{this.renderNetworkEntry(NETWORK_TYPES.MAINNET)} diff --git a/ui/components/app/network-display/index.scss b/ui/components/app/network-display/index.scss index 16755aa5f..0eda6e391 100644 --- a/ui/components/app/network-display/index.scss +++ b/ui/components/app/network-display/index.scss @@ -2,9 +2,6 @@ display: flex; align-items: center; justify-content: flex-start; - padding: 0 10px; - border-radius: 4px; - min-height: 25px; user-select: none; &--disabled { diff --git a/ui/components/app/network-display/network-display.js b/ui/components/app/network-display/network-display.js index 57670908a..a66f396eb 100644 --- a/ui/components/app/network-display/network-display.js +++ b/ui/components/app/network-display/network-display.js @@ -8,12 +8,10 @@ import { } from '../../../../shared/constants/network'; import LoadingIndicator from '../../ui/loading-indicator'; -import ColorIndicator from '../../ui/color-indicator'; import { BorderColor, - IconColor, - Size, - TypographyVariant, + FontWeight, + Color, } from '../../../helpers/constants/design-system'; import Chip from '../../ui/chip/chip'; import { useI18nContext } from '../../../hooks/useI18nContext'; @@ -21,7 +19,6 @@ import { isNetworkLoading } from '../../../selectors'; import { Icon, IconName, IconSize } from '../../component-library'; export default function NetworkDisplay({ - indicatorSize, disabled, labelProps, targetNetwork, @@ -39,31 +36,14 @@ export default function NetworkDisplay({ return ( - - + /> } rightIcon={ onClick ? : null @@ -78,17 +58,14 @@ export default function NetworkDisplay({ 'network-display--clickable': typeof onClick === 'function', })} labelProps={{ - variant: TypographyVariant.H7, + fontWeight: FontWeight.Medium, + color: Color.textDefault, ...labelProps, }} /> ); } NetworkDisplay.propTypes = { - /** - * The size of the indicator - */ - indicatorSize: PropTypes.oneOf(Object.values(Size)), /** * The label props of the label can use most of the Typography props */ @@ -115,7 +92,3 @@ NetworkDisplay.propTypes = { */ onClick: PropTypes.func, }; - -NetworkDisplay.defaultProps = { - indicatorSize: Size.LG, -}; diff --git a/ui/components/ui/chip/chip.js b/ui/components/ui/chip/chip.js index 3fbfaf5dd..b7d4f0065 100644 --- a/ui/components/ui/chip/chip.js +++ b/ui/components/ui/chip/chip.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { omit } from 'lodash'; -import Typography from '../typography'; +import { Text } from '../../component-library/text'; import UrlIcon from '../url-icon'; import { BackgroundColor, @@ -57,15 +57,14 @@ export default function Chip({ ) : null} {children ?? ( - {label} - + )} {rightIcon ?
{rightIcon}
: null}
diff --git a/ui/helpers/constants/design-system.ts b/ui/helpers/constants/design-system.ts index 2d5f2deb7..796bb6345 100644 --- a/ui/helpers/constants/design-system.ts +++ b/ui/helpers/constants/design-system.ts @@ -331,15 +331,15 @@ export const TEXT_TRANSFORM = { }; export enum FontWeight { - Bold = 'bold', - Medium = 'medium', - Normal = 'normal', + Bold = '600', + Medium = '500', + Normal = '400', } export const FONT_WEIGHT = { - BOLD: 'bold', - MEDIUM: 'medium', - NORMAL: 'normal', + BOLD: '600', + MEDIUM: '500', + NORMAL: '400', }; export enum OverflowWrap {