Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

feat: add dropdown list for switching boards (#2042)

Yossi Hillali02dabfcd01e3
diff --git a/apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx b/apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx
index b0657e1e1..74c617d09 100644
--- a/apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx
+++ b/apps/nextjs/src/app/[locale]/boards/(content)/_header-actions.tsx
@@ -2,6 +2,7 @@
import type { MouseEvent } from "react";
import { useCallback, useEffect } from "react";
+import Link from "next/link";
import { useRouter } from "next/navigation";
import { Group, Menu } from "@mantine/core";
import { useHotkeys } from "@mantine/hooks";
@@ -9,9 +10,11 @@ import {
IconBox,
IconBoxAlignTop,
IconChevronDown,
+ IconLayoutBoard,
IconPencil,
IconPencilOff,
IconPlus,
+ IconReplace,
IconResize,
IconSettings,
} from "@tabler/icons-react";
@@ -49,6 +52,8 @@ export const BoardContentHeaderActions = () => {
<HeaderButton href={`/boards/${board.name}/settings`}>
<IconSettings stroke={1.5} />
</HeaderButton>
+
+ <SelectBoardsMenu />
</>
);
};
@@ -151,6 +156,32 @@ const EditModeMenu = () => {
);
};
+const SelectBoardsMenu = () => {
+ const { data: boards = [] } = clientApi.board.getAllBoards.useQuery();
+
+ return (
+ <Menu position="bottom-end" withArrow>
+ <Menu.Target>
+ <HeaderButton w="auto" px={4}>
+ <IconReplace stroke={1.5} />
+ </HeaderButton>
+ </Menu.Target>
+ <Menu.Dropdown style={{ transform: "translate(-7px, 0)" }}>
+ {boards.map((board) => (
+ <Menu.Item
+ key={board.id}
+ component={Link}
+ href={`/boards/${board.name}`}
+ leftSection={<IconLayoutBoard size={20} />}
+ >
+ {board.name}
+ </Menu.Item>
+ ))}
+ </Menu.Dropdown>
+ </Menu>
+ );
+};
+
const usePreventLeaveWithDirty = (isDirty: boolean) => {
const t = useI18n();
const { openConfirmModal } = useConfirmModal();