From 3a22f208b20a909f8ce968279ae4641dbf59b210 Mon Sep 17 00:00:00 2001 From: Julian Dominguez-Schatz Date: Sat, 12 Oct 2024 19:58:22 -0400 Subject: [PATCH] PR feedback --- .../src/components/HelpMenu.tsx | 33 +++++++++---------- .../desktop-client/src/util/router-tools.ts | 4 +++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/packages/desktop-client/src/components/HelpMenu.tsx b/packages/desktop-client/src/components/HelpMenu.tsx index a447c643869..73aed99ef4c 100644 --- a/packages/desktop-client/src/components/HelpMenu.tsx +++ b/packages/desktop-client/src/components/HelpMenu.tsx @@ -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'; @@ -24,24 +24,21 @@ type HelpButtonProps = { const HelpButton = forwardRef( ({ onPress }, ref) => { - const { t } = useTranslation(); const size = 15; return ( - - - + ); }, ); @@ -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')); diff --git a/packages/desktop-client/src/util/router-tools.ts b/packages/desktop-client/src/util/router-tools.ts index 1bba51ee678..b47386270e9 100644 --- a/packages/desktop-client/src/util/router-tools.ts +++ b/packages/desktop-client/src/util/router-tools.ts @@ -9,3 +9,7 @@ export function ExposeNavigate() { }, [navigate]); return null; } + +export function openUrl(url: string) { + window.open(url, '_blank', 'noopener,noreferrer'); +}