import { useLocation, useNavigate } from "@remix-run/react"; import { Button } from "./button"; import { Plus } from "lucide-react"; import { SidebarTrigger } from "./sidebar"; const PAGE_TITLES: Record = { "/home/dashboard": "Memory graph", "/home/conversation": "Conversation", "/home/integrations": "Integrations", "/home/activity": "Activity", }; function getHeaderTitle(pathname: string): string { // Try to match the most specific path first for (const key of Object.keys(PAGE_TITLES)) { if (pathname.startsWith(key)) { return PAGE_TITLES[key]; } } // Default fallback return "Documents"; } function isConversationDetail(pathname: string): boolean { // Matches /home/conversation/ but not /home/conversation exactly return /^\/home\/conversation\/[^/]+$/.test(pathname); } export function SiteHeader() { const location = useLocation(); const navigate = useNavigate(); const title = getHeaderTitle(location.pathname); const showNewConversationButton = isConversationDetail(location.pathname); return (

{title}

{showNewConversationButton && ( )}
); }