chore: remove board hotkeys from this PR (owned by #6393)

This commit is contained in:
Thomas Camlong committed 2026-08-03 17:16:50 +02:00
1 parent bc71cb7f16
commit 60b0f59fe7
4 files changed
+2 -99

No files matched your search

@@ -18,7 +18,7 @@ import type { Params } from "./(content)/_creator";
import { CustomCss } from "./(content)/_custom-css";
import { BoardReadyProvider } from "./(content)/_ready-context";
import { BoardMantineProvider } from "./(content)/_theme";
import { BoardHotkeys } from "~/components/board/use-board-hotkeys";
const logger = createLogger({ module: "createBoardLayout" });
@@ -70,7 +70,6 @@ export const createBoardLayout = <TParams extends Params>({
<EditModeProvider>
<BoardMantineProvider defaultColorScheme={colorScheme}>
<CustomCss />
<BoardHotkeys />
<BoardTourWrapper hasSession={withTour && !!session}>
<ClientShell hasNavigation={false}>
<MainHeader
@@ -1,74 +0,0 @@
"use client";
import { useCallback } from "react";
import { useRouter } from "next/navigation";
import { clientApi } from "@homarr/api/client";
import { useRequiredBoard } from "@homarr/boards/context";
import { hotkeys } from "@homarr/definitions";
import { useHotkeys } from "@mantine/hooks";
/**
* Client component that activates board keyboard shortcuts.
* Render it once inside the board provider tree.
*/
export const BoardHotkeys = () => {
useBoardHotkeys();
return null;
};
const useBoardHotkeys = () => {
const router = useRouter();
const currentBoard = useRequiredBoard();
const { data: boards = [] } = clientApi.board.getAllBoards.useQuery();
const navigateToBoard = useCallback(
(boardName: string) => {
if (boardName !== currentBoard.name) {
router.push(`/boards/${boardName}`);
}
},
[router, currentBoard.name],
);
const currentIndex = boards.findIndex((board) => board.id === currentBoard.id);
useHotkeys([
[hotkeys.nextBoard, () => navigateToNextBoard(boards, currentIndex, navigateToBoard)],
[hotkeys.previousBoard, () => navigateToPreviousBoard(boards, currentIndex, navigateToBoard)],
[hotkeys.switchBoard1, () => navigateToBoardByIndex(boards, 0, navigateToBoard)],
[hotkeys.switchBoard2, () => navigateToBoardByIndex(boards, 1, navigateToBoard)],
[hotkeys.switchBoard3, () => navigateToBoardByIndex(boards, 2, navigateToBoard)],
[hotkeys.switchBoard4, () => navigateToBoardByIndex(boards, 3, navigateToBoard)],
[hotkeys.switchBoard5, () => navigateToBoardByIndex(boards, 4, navigateToBoard)],
[hotkeys.switchBoard6, () => navigateToBoardByIndex(boards, 5, navigateToBoard)],
[hotkeys.switchBoard7, () => navigateToBoardByIndex(boards, 6, navigateToBoard)],
[hotkeys.switchBoard8, () => navigateToBoardByIndex(boards, 7, navigateToBoard)],
[hotkeys.switchBoard9, () => navigateToBoardByIndex(boards, 8, navigateToBoard)],
]);
};
const navigateToNextBoard = (boards: { name: string }[], currentIndex: number, navigate: (name: string) => void) => {
if (boards.length === 0) return;
const nextIndex = (currentIndex + 1) % boards.length;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
navigate(boards[nextIndex]!.name);
};
const navigateToPreviousBoard = (
boards: { name: string }[],
currentIndex: number,
navigate: (name: string) => void,
) => {
if (boards.length === 0) return;
const previousIndex = (currentIndex - 1 + boards.length) % boards.length;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
navigate(boards[previousIndex]!.name);
};
const navigateToBoardByIndex = (boards: { name: string }[], index: number, navigate: (name: string) => void) => {
if (index < boards.length) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
navigate(boards[index]!.name);
}
};
-11
View File
@@ -3,15 +3,4 @@ export const hotkeys = {
toggleColorScheme: "mod+j",
saveNotebook: "mod+s",
openSpotlight: "mod+k",
nextBoard: "mod+shift+ArrowRight",
previousBoard: "mod+shift+ArrowLeft",
switchBoard1: "mod+shift+1",
switchBoard2: "mod+shift+2",
switchBoard3: "mod+shift+3",
switchBoard4: "mod+shift+4",
switchBoard5: "mod+shift+5",
switchBoard6: "mod+shift+6",
switchBoard7: "mod+shift+7",
switchBoard8: "mod+shift+8",
switchBoard9: "mod+shift+9",
};
+1 -12
View File
@@ -5272,18 +5272,7 @@
"toggleBoardEdit": "Toggle board edit mode",
"toggleColorScheme": "Toggle light/dark mode",
"saveNotebook": "Save notebook (only inside notebook widget)",
"openSpotlight": "Open search",
"nextBoard": "Switch to next board",
"previousBoard": "Switch to previous board",
"switchBoard1": "Switch to first board",
"switchBoard2": "Switch to second board",
"switchBoard3": "Switch to third board",
"switchBoard4": "Switch to fourth board",
"switchBoard5": "Switch to fifth board",
"switchBoard6": "Switch to sixth board",
"switchBoard7": "Switch to seventh board",
"switchBoard8": "Switch to eighth board",
"switchBoard9": "Switch to ninth board"
"openSpotlight": "Open search"
},
"note": "Tip: Mod refers to both Ctrl key and ⌘ key on macOS"
}