diff --git a/app/components/DesktopEventHandler.tsx b/app/components/DesktopEventHandler.tsx index 453a546b6..2e4fec7b6 100644 --- a/app/components/DesktopEventHandler.tsx +++ b/app/components/DesktopEventHandler.tsx @@ -1,12 +1,17 @@ import * as React from "react"; +import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; +import KeyboardShortcuts from "~/scenes/KeyboardShortcuts"; import { useDesktopTitlebar } from "~/hooks/useDesktopTitlebar"; +import useStores from "~/hooks/useStores"; import useToasts from "~/hooks/useToasts"; import Desktop from "~/utils/Desktop"; export default function DesktopEventHandler() { useDesktopTitlebar(); + const { t } = useTranslation(); const history = useHistory(); + const { dialogs } = useStores(); const { showToast } = useToasts(); React.useEffect(() => { @@ -38,7 +43,14 @@ export default function DesktopEventHandler() { Desktop.bridge?.blur(() => { window.document.body.classList.add("backgrounded"); }); - }, [history, showToast]); + + Desktop.bridge?.openKeyboardShortcuts(() => { + dialogs.openGuide({ + title: t("Keyboard shortcuts"), + content: , + }); + }); + }, [t, history, dialogs, showToast]); return null; } diff --git a/app/typings/window.d.ts b/app/typings/window.d.ts index d746642d8..e8dd0a084 100644 --- a/app/typings/window.d.ts +++ b/app/typings/window.d.ts @@ -62,6 +62,11 @@ declare global { */ updateDownloaded: (callback: () => void) => void; + /** + * Registers a callback to be called when the application wants to open keyboard shortcuts. + */ + openKeyboardShortcuts: (callback: () => void) => void; + /** * Go back in history, if possible */