import { AgentToggleButton } from "@agent-native/core/client/agent-chat"; import { useT } from "@agent-native/core/client/i18n"; import { useHeaderTitle, useHeaderActions, } from "@agent-native/toolkit/app-shell"; import { IconMenu2 } from "@tabler/icons-react"; import { useLocation } from "react-router"; import { APP_TITLE } from "@/lib/app-config"; const pageTitleKeys: Record = { "/": "navigation.chat", "/observability": "navigation.observability", "/agent": "settings.agentTitle", "/settings": "navigation.settings", }; function resolveTitle(pathname: string, t: (key: string) => string): string { if (pageTitleKeys[pathname]) return t(pageTitleKeys[pathname]); if (pathname.startsWith("/extensions")) return t("navigation.extensions"); return APP_TITLE; } interface HeaderProps { onOpenMobileSidebar?: () => void; } export function Header({ onOpenMobileSidebar }: HeaderProps) { const location = useLocation(); const t = useT(); const title = useHeaderTitle(); const actions = useHeaderActions(); return (
{onOpenMobileSidebar && ( )}
{title ?? (

{resolveTitle(location.pathname, t)}

)}
{actions}
); }