Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
import { useEffect } from "react";
|
|
|
|
|
|
|
|
|
|
interface ShortcutHandlers {
|
|
|
|
|
onNewIssue?: () => void;
|
|
|
|
|
onToggleSidebar?: () => void;
|
|
|
|
|
onTogglePanel?: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-11 15:32:39 -04:00
|
|
|
export function useKeyboardShortcuts({ onNewIssue, onToggleSidebar, onTogglePanel }: ShortcutHandlers) {
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
useEffect(() => {
|
|
|
|
|
function handleKeyDown(e: KeyboardEvent) {
|
|
|
|
|
// Don't fire shortcuts when typing in inputs
|
|
|
|
|
const target = e.target as HTMLElement;
|
|
|
|
|
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// C → New Issue
|
|
|
|
|
if (e.key === "c" && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
onNewIssue?.();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// [ → Toggle Sidebar
|
|
|
|
|
if (e.key === "[" && !e.metaKey && !e.ctrlKey) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
onToggleSidebar?.();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ] → Toggle Panel
|
|
|
|
|
if (e.key === "]" && !e.metaKey && !e.ctrlKey) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
onTogglePanel?.();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.addEventListener("keydown", handleKeyDown);
|
|
|
|
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
2026-03-11 15:32:39 -04:00
|
|
|
}, [onNewIssue, onToggleSidebar, onTogglePanel]);
|
Add shared UI primitives, contexts, and reusable components
Add shadcn components: avatar, breadcrumb, checkbox, collapsible,
command, dialog, dropdown-menu, label, popover, scroll-area, sheet,
skeleton, tabs, textarea, tooltip. Add shared components: BreadcrumbBar,
CommandPalette, CompanySwitcher, CommentThread, EmptyState, EntityRow,
FilterBar, InlineEditor, MetricCard, PageSkeleton, PriorityIcon,
PropertiesPanel, StatusIcon, SidebarNavItem/Section. Add contexts for
breadcrumbs, dialogs, and side panels. Add keyboard shortcut hook and
utility helpers. Update layout, sidebar, and main app shell.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:00 -06:00
|
|
|
}
|