Compare commits

...

2 Commits

Author SHA1 Message Date
Jiayuan Zhang
f9d65cc6fb fix(views): match "C" shortcut badge style to search ⌘K badge
Use the same kbd styling (rounded border, bg-muted, font-mono) as the
search trigger so the two shortcut hints look consistent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:41:03 +08:00
Jiayuan Zhang
0e095e3618 feat(views): add "C" keyboard shortcut to open new issue modal
Adds a global keyboard shortcut matching Linear's convention — pressing
"C" when not focused on an input/editor opens the create-issue modal.
Also displays the shortcut hint in the sidebar button.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:26:28 +08:00

View File

@@ -1,6 +1,6 @@
"use client";
import React from "react";
import React, { useEffect } from "react";
import { cn } from "@multica/ui/lib/utils";
import { AppLink, useNavigation } from "../navigation";
import {
@@ -112,6 +112,26 @@ export function AppSidebar({ topSlot, searchSlot, headerClassName, headerStyle }
useWorkspaceStore.getState().clearWorkspace();
};
// Global "C" shortcut to open create-issue modal (like Linear)
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === "c" && !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) {
const tag = (e.target as HTMLElement)?.tagName;
const isEditable =
tag === "INPUT" ||
tag === "TEXTAREA" ||
tag === "SELECT" ||
(e.target as HTMLElement)?.isContentEditable;
if (isEditable) return;
if (useModalStore.getState().modal) return;
e.preventDefault();
useModalStore.getState().open("create-issue");
}
};
document.addEventListener("keydown", handleKeyDown);
return () => document.removeEventListener("keydown", handleKeyDown);
}, []);
return (
<Sidebar variant="inset">
{topSlot}
@@ -203,6 +223,7 @@ export function AppSidebar({ topSlot, searchSlot, headerClassName, headerStyle }
<DraftDot />
</span>
<span>New Issue</span>
<kbd className="pointer-events-none ml-auto inline-flex h-5 select-none items-center gap-0.5 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground">C</kbd>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>