Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdoming committed Oct 13, 2024
1 parent f3458d5 commit 3a22f20
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
33 changes: 15 additions & 18 deletions packages/desktop-client/src/components/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { useToggle } from 'usehooks-ts';
import { pushModal } from 'loot-core/client/actions/modals';

import { SvgHelp } from '../icons/v2/Help';
import { openUrl } from '../util/router-tools';

import { Button } from './common/Button2';
import { Menu } from './common/Menu';
import { Popover } from './common/Popover';
import { SpaceBetween } from './common/SpaceBetween';
import { View } from './common/View';

type HelpMenuItem = 'docs' | 'keyboard-shortcuts';

Expand All @@ -24,24 +24,21 @@ type HelpButtonProps = {

const HelpButton = forwardRef<HTMLButtonElement, HelpButtonProps>(
({ onPress }, ref) => {
const { t } = useTranslation();
const size = 15;
return (
<View title={t('Get help')}>
<Button
variant="bare"
ref={ref}
onPress={onPress}
style={{
display: 'flex',
alignItems: 'center',
gap: 4,
}}
>
<SvgHelp width={size} height={size} />
<Trans>Help</Trans>
</Button>
</View>
<Button
variant="bare"
ref={ref}
onPress={onPress}
style={{
display: 'flex',
alignItems: 'center',
gap: 4,
}}
>
<SvgHelp width={size} height={size} />
<Trans>Help</Trans>
</Button>
);
},
);
Expand Down Expand Up @@ -79,7 +76,7 @@ export const HelpMenu = () => {
const handleItemSelect = (item: HelpMenuItem) => {
switch (item) {
case 'docs':
window.open(getPageDocs(page), '_blank');
openUrl(getPageDocs(page));
break;
case 'keyboard-shortcuts':
dispatch(pushModal('keyboard-shortcuts'));
Expand Down
4 changes: 4 additions & 0 deletions packages/desktop-client/src/util/router-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ export function ExposeNavigate() {
}, [navigate]);
return null;
}

export function openUrl(url: string) {
window.open(url, '_blank', 'noopener,noreferrer');
}

0 comments on commit 3a22f20

Please sign in to comment.