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>
36 lines
948 B
TypeScript
36 lines
948 B
TypeScript
import { createContext, useCallback, useContext, useState, type ReactNode } from "react";
|
|
|
|
export interface Breadcrumb {
|
|
label: string;
|
|
href?: string;
|
|
}
|
|
|
|
interface BreadcrumbContextValue {
|
|
breadcrumbs: Breadcrumb[];
|
|
setBreadcrumbs: (crumbs: Breadcrumb[]) => void;
|
|
}
|
|
|
|
const BreadcrumbContext = createContext<BreadcrumbContextValue | null>(null);
|
|
|
|
export function BreadcrumbProvider({ children }: { children: ReactNode }) {
|
|
const [breadcrumbs, setBreadcrumbsState] = useState<Breadcrumb[]>([]);
|
|
|
|
const setBreadcrumbs = useCallback((crumbs: Breadcrumb[]) => {
|
|
setBreadcrumbsState(crumbs);
|
|
}, []);
|
|
|
|
return (
|
|
<BreadcrumbContext.Provider value={{ breadcrumbs, setBreadcrumbs }}>
|
|
{children}
|
|
</BreadcrumbContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useBreadcrumbs() {
|
|
const ctx = useContext(BreadcrumbContext);
|
|
if (!ctx) {
|
|
throw new Error("useBreadcrumbs must be used within BreadcrumbProvider");
|
|
}
|
|
return ctx;
|
|
}
|