diff options
| author | Oskar <oskar@mullvad.net> | 2024-08-30 10:57:22 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-08-30 10:57:22 +0200 |
| commit | 26b80bfab9e2415d9fcdb1fb4e694c628c0550ad (patch) | |
| tree | ab659e8fac396ab31b8f10da545122f0f82d4073 | |
| parent | 80ba0a368e61ae9c3718cf911bf1b1795e2de7e3 (diff) | |
| parent | 8d0f0d23bcc82267f36d7ea9ff820838242436f1 (diff) | |
| download | mullvadvpn-26b80bfab9e2415d9fcdb1fb4e694c628c0550ad.tar.xz mullvadvpn-26b80bfab9e2415d9fcdb1fb4e694c628c0550ad.zip | |
Merge branch 'add-connection-panel-back-action'
| -rw-r--r-- | gui/src/renderer/components/KeyboardNavigation.tsx | 10 | ||||
| -rw-r--r-- | gui/src/renderer/components/main-view/ConnectionPanel.tsx | 49 |
2 files changed, 30 insertions, 29 deletions
diff --git a/gui/src/renderer/components/KeyboardNavigation.tsx b/gui/src/renderer/components/KeyboardNavigation.tsx index fc11e54699..8ed3caa540 100644 --- a/gui/src/renderer/components/KeyboardNavigation.tsx +++ b/gui/src/renderer/components/KeyboardNavigation.tsx @@ -25,12 +25,10 @@ export default function KeyboardNavigation(props: IKeyboardNavigationProps) { (event: KeyboardEvent) => { if (event.key === 'Escape') { const path = location.pathname as RoutePath; - if (!disableDismissForRoutes.includes(path)) { - if (event.shiftKey) { - history.pop(true); - } else { - backAction?.(); - } + if (event.shiftKey && !disableDismissForRoutes.includes(path)) { + history.pop(true); + } else { + backAction?.(); } } }, diff --git a/gui/src/renderer/components/main-view/ConnectionPanel.tsx b/gui/src/renderer/components/main-view/ConnectionPanel.tsx index 1d5c549254..8754547e1f 100644 --- a/gui/src/renderer/components/main-view/ConnectionPanel.tsx +++ b/gui/src/renderer/components/main-view/ConnectionPanel.tsx @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { useBoolean } from '../../lib/utilityHooks'; import { useSelector } from '../../redux/store'; import CustomScrollbars from '../CustomScrollbars'; +import { BackAction } from '../KeyboardNavigation'; import ConnectionActionButton from './ConnectionActionButton'; import ConnectionDetails from './ConnectionDetails'; import ConnectionPanelChevron from './ConnectionPanelChevron'; @@ -86,28 +87,30 @@ export default function ConnectionPanel() { useEffect(collapse, [tunnelState.state, collapse]); return ( - <StyledConnectionPanel $expanded={expanded}> - {allowExpand && ( - <StyledConnectionPanelChevron pointsUp={!expanded} onToggle={toggleExpanded} /> - )} - <StyledConnectionStatusContainer - $expanded={expanded} - $hasFeatureIndicators={hasFeatureIndicators} - onClick={toggleExpanded}> - <ConnectionStatus /> - <Location /> - <Hostname /> - </StyledConnectionStatusContainer> - <StyledCustomScrollbars> - <FeatureIndicators expanded={expanded} expandIsland={expand} /> - <StyledAccordion expanded={expanded}> - <ConnectionDetails /> - </StyledAccordion> - </StyledCustomScrollbars> - <StyledConnectionButtonContainer> - <SelectLocationButton /> - <ConnectionActionButton /> - </StyledConnectionButtonContainer> - </StyledConnectionPanel> + <BackAction disabled={!expanded} action={collapse}> + <StyledConnectionPanel $expanded={expanded}> + {allowExpand && ( + <StyledConnectionPanelChevron pointsUp={!expanded} onToggle={toggleExpanded} /> + )} + <StyledConnectionStatusContainer + $expanded={expanded} + $hasFeatureIndicators={hasFeatureIndicators} + onClick={toggleExpanded}> + <ConnectionStatus /> + <Location /> + <Hostname /> + </StyledConnectionStatusContainer> + <StyledCustomScrollbars> + <FeatureIndicators expanded={expanded} expandIsland={expand} /> + <StyledAccordion expanded={expanded}> + <ConnectionDetails /> + </StyledAccordion> + </StyledCustomScrollbars> + <StyledConnectionButtonContainer> + <SelectLocationButton /> + <ConnectionActionButton /> + </StyledConnectionButtonContainer> + </StyledConnectionPanel> + </BackAction> ); } |
