{/* repeat for each key in hotkey */} -{/* @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message */} {availableHotkeys[hotkeyGroup][ hotkey -// @ts-expect-error TS(7006): Parameter 'comboKey' implicitly has an 'any' type. - ].combo.map((comboKey, key) => ( - <> - + ].sequence.map((comboKey, key) => ( + + {t( "HOTKEYS.KEYS." + @@ -62,23 +77,20 @@ const HotKeyCheatSheet = ({ {comboKey === -// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message availableHotkeys[hotkeyGroup][hotkey] - .combo[ -// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message + .sequence[ availableHotkeys[hotkeyGroup][hotkey] - .combo.length - 1 + .sequence.length - 1 ] ? "" : " + "} - > + ))} |
{t(
-// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
availableHotkeys[hotkeyGroup][hotkey]
.description
)}
diff --git a/src/components/shared/MainNav.tsx b/src/components/shared/MainNav.tsx
index 6735f83b00..93ffee601d 100644
--- a/src/components/shared/MainNav.tsx
+++ b/src/components/shared/MainNav.tsx
@@ -21,7 +21,7 @@ import { getUserInformation } from "../../selectors/userInfoSelectors";
import { hasAccess } from "../../utils/utils";
import { fetchServices } from "../../slices/serviceSlice";
import { fetchGroups } from "../../slices/groupSlice";
-import { GlobalHotKeys } from "react-hotkeys";
+import { useHotkeys } from "react-hotkeys-hook";
import { availableHotkeys } from "../../configs/hotkeysConfig";
import { fetchAcls } from "../../slices/aclSlice";
import { useAppDispatch, useAppSelector } from "../../store";
@@ -206,26 +206,29 @@ const MainNav = ({
loadingThemesIntoTable();
};
- const hotkeyLoadEvents = () => {
- navigate("/events/events");
- };
-
- const hotkeyLoadSeries = () => {
- navigate("/events/series");
- };
+ useHotkeys(
+ availableHotkeys.general.EVENT_VIEW.sequence,
+ () => navigate("/events/events"),
+ { description: t(availableHotkeys.general.EVENT_VIEW.description) ?? undefined },
+ []
+ );
+
+ useHotkeys(
+ availableHotkeys.general.SERIES_VIEW.sequence,
+ () => navigate("/events/series"),
+ { description: t(availableHotkeys.general.SERIES_VIEW.description) ?? undefined },
+ []
+ );
+
+ useHotkeys(
+ availableHotkeys.general.MAIN_MENU.sequence,
+ () => toggleMenu(),
+ { description: t(availableHotkeys.general.MAIN_MENU.description) ?? undefined },
+ [toggleMenu]
+ );
- const hotKeyHandlers = {
- EVENT_VIEW: hotkeyLoadEvents,
- SERIES_VIEW: hotkeyLoadSeries,
- MAIN_MENU: toggleMenu,
- };
return (
<>
- toggleMenu()}>
{isOpen && (
|