fix(app-shell): restore missing props on TopHeader, Sidebar, and SearchDialog to fix runtime error on rail click
This commit is contained in:
parent
fcd6a59a2c
commit
c012673659
1 changed files with 39 additions and 4 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import type { ReactNode } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { IconRail } from "@/components/layout/icon-rail";
|
||||
import { TopHeader } from "@/components/layout/top-header";
|
||||
|
|
@ -12,21 +13,55 @@ import { CreateObjectDialog } from "@/components/objects";
|
|||
import { SearchDialog } from "@/components/search";
|
||||
|
||||
export function AppShell({ children }: { children: ReactNode }) {
|
||||
// Simplified AppShell without chat logic for now
|
||||
const [searchOpen, setSearchOpen] = useState(false);
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
const [createType, setCreateType] = useState<string | undefined>();
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
const isSlash = e.key === "/" || e.code === "Slash";
|
||||
if (!isSlash || !(e.metaKey || e.ctrlKey)) return;
|
||||
const t = e.target as HTMLElement | null;
|
||||
if (t?.closest?.("[data-search-dialog-ignore-shortcut]")) return;
|
||||
e.preventDefault();
|
||||
setSearchOpen(true);
|
||||
};
|
||||
document.addEventListener("keydown", onKey, true);
|
||||
return () => document.removeEventListener("keydown", onKey, true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<div className="flex h-[100dvh] w-full flex-col overflow-hidden bg-background">
|
||||
<TopHeader />
|
||||
<TopHeader
|
||||
onOpenSearch={() => setSearchOpen(true)}
|
||||
onQuickAction={(type) => {
|
||||
setCreateType(type);
|
||||
setCreateOpen(true);
|
||||
}}
|
||||
/>
|
||||
<div className="flex min-h-0 flex-1 overflow-hidden">
|
||||
<IconRail />
|
||||
<Sidebar
|
||||
onOpenSearch={() => setSearchOpen(true)}
|
||||
onQuickAction={(type) => {
|
||||
setCreateType(type);
|
||||
setCreateOpen(true);
|
||||
}}
|
||||
/>
|
||||
<div className="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<Sidebar />
|
||||
<main className="flex-1 overflow-auto">{children}</main>
|
||||
</div>
|
||||
<RightPanel />
|
||||
</div>
|
||||
</div>
|
||||
<CommandPalette />
|
||||
<SearchDialog open={searchOpen} onOpenChange={setSearchOpen} />
|
||||
<CreateObjectDialog
|
||||
open={createOpen}
|
||||
onOpenChange={setCreateOpen}
|
||||
defaultType={createType}
|
||||
/>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue