(props: ShellProps)
| 429 | // ── Shell ───────────────────────────────────────────────────────────────── |
| 430 | |
| 431 | export function Shell(props: ShellProps) { |
| 432 | const pathname = useScopeRelativePathname(); |
| 433 | const lastPathname = useRef(pathname); |
| 434 | const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false); |
| 435 | const [commandPaletteOpen, setCommandPaletteOpen] = useState(false); |
| 436 | const navigate = useNavigate(); |
| 437 | // The connect dialog became the full-page picker; the sidebar affordance |
| 438 | // navigates instead of opening a modal. |
| 439 | const openIntegrationBrowse = () => { |
| 440 | trackEvent("integration_browse_opened", { via: "sidebar" }); |
| 441 | void navigate({ to: "/{-$orgSlug}/integrations/browse" }); |
| 442 | }; |
| 443 | if (lastPathname.current !== pathname) { |
| 444 | lastPathname.current = pathname; |
| 445 | if (mobileSidebarOpen) setMobileSidebarOpen(false); |
| 446 | } |
| 447 | |
| 448 | useEffect(() => { |
| 449 | if (!mobileSidebarOpen) return; |
| 450 | const prev = document.body.style.overflow; |
| 451 | document.body.style.overflow = "hidden"; |
| 452 | return () => { |
| 453 | document.body.style.overflow = prev; |
| 454 | }; |
| 455 | }, [mobileSidebarOpen]); |
| 456 | |
| 457 | return ( |
| 458 | <div className="flex h-screen overflow-hidden"> |
| 459 | <CommandPalette open={commandPaletteOpen} onOpenChange={setCommandPaletteOpen} /> |
| 460 | {/* Desktop sidebar */} |
| 461 | <aside className="hidden w-52 shrink-0 border-r border-sidebar-border bg-sidebar md:flex md:flex-col lg:w-56"> |
| 462 | <SidebarContent |
| 463 | {...props} |
| 464 | pathname={pathname} |
| 465 | onOpenCommands={() => setCommandPaletteOpen(true)} |
| 466 | onOpenIntegrationConnect={openIntegrationBrowse} |
| 467 | /> |
| 468 | </aside> |
| 469 | |
| 470 | {/* Mobile sidebar overlay */} |
| 471 | {mobileSidebarOpen && ( |
| 472 | <div className="fixed inset-0 z-50 flex md:hidden"> |
| 473 | {/* oxlint-disable-next-line react/forbid-elements */} |
| 474 | <button |
| 475 | type="button" |
| 476 | aria-label="Close navigation" |
| 477 | className="absolute inset-0 bg-black/45 backdrop-blur-[1px]" |
| 478 | onClick={() => setMobileSidebarOpen(false)} |
| 479 | /> |
| 480 | <div className="relative flex h-full w-[84vw] max-w-xs flex-col border-r border-sidebar-border bg-sidebar shadow-2xl"> |
| 481 | <div className="flex h-12 shrink-0 items-center justify-between border-b border-sidebar-border px-4"> |
| 482 | <Brand onNavigate={() => setMobileSidebarOpen(false)} /> |
| 483 | <Button |
| 484 | variant="ghost" |
| 485 | size="icon-sm" |
| 486 | type="button" |
| 487 | aria-label="Close navigation" |
| 488 | onClick={() => setMobileSidebarOpen(false)} |
nothing calls this directly
no test coverage detected