Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

feat(web): move keyboard shortcuts inside the profile options menu

Mohamed Bassema698724705d4
diff --git a/apps/web/components/dashboard/GlobalActions.tsx b/apps/web/components/dashboard/GlobalActions.tsx
index c9bda561..d385111a 100644
--- a/apps/web/components/dashboard/GlobalActions.tsx
+++ b/apps/web/components/dashboard/GlobalActions.tsx
@@ -3,37 +3,17 @@
import BulkBookmarksAction from "@/components/dashboard/BulkBookmarksAction";
import SortOrderToggle from "@/components/dashboard/SortOrderToggle";
import ViewOptions from "@/components/dashboard/ViewOptions";
-import { useTranslation } from "@/lib/i18n/client";
import { useInBookmarkGridStore } from "@/lib/store/useInBookmarkGridStore";
-import { useKeyboardNavigationStore } from "@/lib/store/useKeyboardNavigationStore";
-import { Keyboard } from "lucide-react";
-
-import { ButtonWithTooltip } from "../ui/button";
export default function GlobalActions() {
- const { t } = useTranslation();
const inBookmarkGrid = useInBookmarkGridStore(
(state) => state.inBookmarkGrid,
);
- const setShortcutsDialogOpen = useKeyboardNavigationStore(
- (state) => state.setShortcutsDialogOpen,
- );
return (
<div className="flex min-w-max flex-wrap overflow-hidden">
{inBookmarkGrid && <ViewOptions />}
{inBookmarkGrid && <BulkBookmarksAction />}
{inBookmarkGrid && <SortOrderToggle />}
- {inBookmarkGrid && (
- <ButtonWithTooltip
- variant="ghost"
- onClick={() => setShortcutsDialogOpen(true)}
- tooltip={t("keyboard_shortcuts.title")}
- delayDuration={100}
- aria-label={t("keyboard_shortcuts.title")}
- >
- <Keyboard size={18} />
- </ButtonWithTooltip>
- )}
</div>
);
}
diff --git a/apps/web/components/dashboard/header/ProfileOptions.tsx b/apps/web/components/dashboard/header/ProfileOptions.tsx
index 8a2b0165..3d77dd08 100644
--- a/apps/web/components/dashboard/header/ProfileOptions.tsx
+++ b/apps/web/components/dashboard/header/ProfileOptions.tsx
@@ -15,8 +15,11 @@ import { Separator } from "@/components/ui/separator";
import { UserAvatar } from "@/components/ui/user-avatar";
import { useSession } from "@/lib/auth/client";
import { useTranslation } from "@/lib/i18n/client";
+import { useInBookmarkGridStore } from "@/lib/store/useInBookmarkGridStore";
+import { useKeyboardNavigationStore } from "@/lib/store/useKeyboardNavigationStore";
import {
BookOpen,
+ Keyboard,
LogOut,
Moon,
Paintbrush,
@@ -59,6 +62,12 @@ export default function SidebarProfileOptions() {
const { data: session } = useSession();
const { data: whoami } = useWhoAmI();
const router = useRouter();
+ const inBookmarkGrid = useInBookmarkGridStore(
+ (state) => state.inBookmarkGrid,
+ );
+ const setShortcutsDialogOpen = useKeyboardNavigationStore(
+ (state) => state.setShortcutsDialogOpen,
+ );
const avatarImage = whoami?.image ?? null;
const avatarUrl = useMemo(() => avatarImage ?? null, [avatarImage]);
@@ -121,6 +130,12 @@ export default function SidebarProfileOptions() {
<DropdownMenuItem onClick={toggleTheme}>
<DarkModeToggle />
</DropdownMenuItem>
+ {inBookmarkGrid && (
+ <DropdownMenuItem onClick={() => setShortcutsDialogOpen(true)}>
+ <Keyboard className="mr-2 size-4" />
+ {t("keyboard_shortcuts.title")}
+ </DropdownMenuItem>
+ )}
<Separator className="my-2" />
<DropdownMenuItem asChild>
<a href="https://karakeep.app/apps" target="_blank" rel="noreferrer">