Skip to content

Commit

Permalink
Merge branch 'add-connection-panel-back-action'
Browse files Browse the repository at this point in the history
  • Loading branch information
raksooo committed Aug 30, 2024
2 parents 80ba0a3 + 8d0f0d2 commit 26b80bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
10 changes: 4 additions & 6 deletions gui/src/renderer/components/KeyboardNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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?.();
}
}
},
Expand Down
49 changes: 26 additions & 23 deletions gui/src/renderer/components/main-view/ConnectionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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>
);
}

0 comments on commit 26b80bf

Please sign in to comment.