From 50c7308ee72c6ed53f67629910a5b642951128ad Mon Sep 17 00:00:00 2001 From: Jeffrey Fisher Date: Sun, 17 May 2020 21:26:30 -0700 Subject: [PATCH] Allow double-clicking in header to maximize the app. Closes #4207 --- ui/component/header/view.jsx | 48 +++++++++++++++++++++++++- ui/component/navigationButton/view.jsx | 8 ++++- ui/component/wunderbar/view.jsx | 10 +++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/ui/component/header/view.jsx b/ui/component/header/view.jsx index 6d03397d1..7e972e3e9 100644 --- a/ui/component/header/view.jsx +++ b/ui/component/header/view.jsx @@ -13,6 +13,7 @@ import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button'; import Tooltip from 'component/common/tooltip'; import NavigationButton from 'component/navigationButton'; // @if TARGET='app' +import { remote } from 'electron'; import { IS_MAC } from 'component/app/view'; // @endif @@ -126,6 +127,11 @@ const Header = (props: Props) => { 'header--mac': IS_MAC, // @endif })} + // @if TARGET='app' + onDoubleClick={e => { + remote.getCurrentWindow().maximize(); + }} + // @endif >
@@ -136,6 +142,11 @@ const Header = (props: Props) => { onClick={() => { if (history.location.pathname === '/') window.location.reload(); }} + // @if TARGET='app' + onDoubleClick={e => { + e.stopPropagation(); + }} + // @endif {...homeButtonNavigationProps} /> @@ -160,12 +171,22 @@ const Header = (props: Props) => { navigate={`/$/${PAGES.WALLET}`} className="header__navigation-item menu__title header__navigation-item--balance" label={getWalletTitle()} + // @if TARGET='app' + onDoubleClick={e => { + e.stopPropagation(); + }} + // @endif /> { + e.stopPropagation(); + }} + // @endif > @@ -186,6 +207,11 @@ const Header = (props: Props) => { aria-label={__('Your account')} title={__('Your account')} className="header__navigation-item menu__title header__navigation-item--icon" + // @if TARGET='app' + onDoubleClick={e => { + e.stopPropagation(); + }} + // @endif > @@ -240,6 +266,11 @@ const Header = (props: Props) => { aria-label={__('Settings')} title={__('Settings')} className="header__navigation-item menu__title header__navigation-item--icon" + // @if TARGET='app' + onDoubleClick={e => { + e.stopPropagation(); + }} + // @endif > @@ -277,12 +308,27 @@ const Header = (props: Props) => { // className="button--header-close" icon={ICONS.REMOVE} {...closeButtonNavigationProps} + // @if TARGET='app' + onDoubleClick={e => { + e.stopPropagation(); + }} + // @endif />
) )} -
); diff --git a/ui/component/navigationButton/view.jsx b/ui/component/navigationButton/view.jsx index 72c9cb017..810e912e8 100644 --- a/ui/component/navigationButton/view.jsx +++ b/ui/component/navigationButton/view.jsx @@ -67,7 +67,13 @@ const NavigationButton = (props: Props) => { ); const slicedEntries = sliceEntries(currentIndex, entries, historyLength, isBackward, MAX_HISTORY_SIZE); return ( -
+
{ + e.stopPropagation(); + }} + // @endif + >