Add Auth sign-in/sign-up page and InviteLanding page for invite acceptance. Add CloudAccessGate that checks deployment mode and redirects to /auth when session is required. Add CompanyRail with drag-and-drop company switching. Add MarkdownBody prose renderer. Redesign Inbox with category filters and inline join-request approval. Refactor AgentDetail to overview/configure/runs views with claude-login support. Replace navigate() anti-patterns with <Link> components in Dashboard and MetricCard. Add live-run indicators in sidebar agents. Fix LiveUpdatesProvider cache key resolution for issue identifiers. Add auth, health, and access API clients. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { useEffect } from "react";
|
|
|
|
interface ShortcutHandlers {
|
|
onNewIssue?: () => void;
|
|
onToggleSidebar?: () => void;
|
|
onTogglePanel?: () => void;
|
|
onSwitchCompany?: (index: number) => void;
|
|
}
|
|
|
|
export function useKeyboardShortcuts({ onNewIssue, onToggleSidebar, onTogglePanel, onSwitchCompany }: ShortcutHandlers) {
|
|
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;
|
|
}
|
|
|
|
// Cmd+1..9 → Switch company
|
|
if ((e.metaKey || e.ctrlKey) && e.key >= "1" && e.key <= "9") {
|
|
e.preventDefault();
|
|
onSwitchCompany?.(parseInt(e.key, 10) - 1);
|
|
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);
|
|
}, [onNewIssue, onToggleSidebar, onTogglePanel, onSwitchCompany]);
|
|
}
|