import type { ReactNode } from "react"; import { Database, Flask, SignOut } from "@phosphor-icons/react"; import { Button } from "@/components/ui/Button"; import { Toggle } from "@/components/ui/Toggle"; import { ModelSelector } from "@/components/sidebar/ModelSelector"; import { RetrievalFilters } from "@/components/sidebar/RetrievalFilters"; import { OpenAlexSearch } from "@/components/sidebar/OpenAlexSearch"; import { PdfUpload } from "@/components/sidebar/PdfUpload"; import { KnowledgeBase } from "@/components/sidebar/KnowledgeBase"; import { useAuth } from "@/context/AuthContext"; import { useSettings } from "@/context/SettingsContext"; interface SidebarContentProps { /** Drawer-only: the identity block (the island nav owns it on desktop). */ showIdentity?: boolean; /** * Drawer-only: the view switcher pills. The island nav hides below `sm`, so * the drawer has to carry navigation — otherwise Semantic search becomes * unreachable on phones. */ nav?: ReactNode; /** Called after a nav pill is picked, so the drawer can close itself. */ onNavigate?: () => void; } /** * Source rail. Every section is its own double-bezel card instead of a flat * list divided by hairlines — the identity block, view switcher and scope * toggle only appear in the mobile drawer, since the island nav owns them on * desktop. */ export function SidebarContent({ showIdentity = false, nav, onNavigate }: SidebarContentProps) { const { session, logout } = useAuth(); const { kbOnly, setKbOnly } = useSettings(); return (
{showIdentity && (
{session?.displayName}
@{session?.userId}
)} {nav && (
View {/* Clicks bubble from the pills, so one handler closes the drawer. */}
{nav}
} label={kbOnly ? "Library only" : "Library + web"} hint={ kbOnly ? "Answers use your ingested papers only." : "Falls back to live OpenAlex / web when the library seems irrelevant." } />
)}
); } function RailCard({ children }: { children: ReactNode }) { return (
{children}
); }