import { AgentToggleButton } from "@agent-native/core/client/agent-chat"; import { useT } from "@agent-native/core/client/i18n"; import { IconMenu2 } from "@tabler/icons-react"; import { useLocation } from "react-router"; import { APP_TITLE } from "@/lib/app-config"; import { useHeaderTitle, useHeaderActions } from "./HeaderActions"; type Translate = ReturnType; function resolveTitle(t: Translate, pathname: string): string { if (pathname === "/tasks") return t("header.pageTasks"); if (pathname === "/settings") return t("header.pageSettings"); if (pathname === "/team") return t("header.pageTeam"); if (pathname.startsWith("/extensions")) return t("header.pageExtensions"); return APP_TITLE; } interface HeaderProps { onOpenMobileSidebar?: () => void; } export function Header({ onOpenMobileSidebar }: HeaderProps) { const t = useT(); const location = useLocation(); const title = useHeaderTitle(); const actions = useHeaderActions(); return (
{onOpenMobileSidebar && ( )}
{title ?? (

{resolveTitle(t, location.pathname)}

)}
{actions}
); }