Files
AgentHub/client/src/components/DocumentTitle.tsx
T
nntrivi2001 dd9b23106c feat: v2.5.4 — Query Explorer folded into Sessions, Windows picker and paths
- Sessions page tabs: Sessions · Events · Agents. QueryExplorer.tsx became
  AgentsTable.tsx (agents only — sessions and events already had tabs);
  /query redirects to /sessions?view=agents and leaves the sidebar.
  GET /api/query is unchanged and still answers all three entities.
- Windows picker opens in front: -EncodedCommand script spends the hidden
  first ShowWindow that windowsHide gives the process, then brings the TopMost
  owner forward via AttachThreadInput (v2.5.3's owner was itself hidden).
- Session page Resume/Fork/Open pane: owningLane and sessionWorktreeName
  match Windows folders (either separator), with a test.
2026-10-06 21:56:51 +07:00

38 lines
1.1 KiB
TypeScript

/**
* @file DocumentTitle.tsx
* @description Route-aware document title setter nested under BrowserRouter so
* `useLocation` works. Keeps multi-tab window switchers readable.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
import { useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { useDocumentTitle } from "../hooks/useDocumentTitle";
/**
* Maps the current pathname to a localized browser tab title.
*/
export function DocumentTitle() {
const { t } = useTranslation("nav");
const location = useLocation();
let title = t("dashboard");
const path = location.pathname;
const sessionId = path.match(/^\/sessions\/([^/]+)/)?.[1];
if (sessionId) {
title = `${t("sessions")} · ${sessionId.slice(0, 8)}`;
} else if (path.startsWith("/sessions")) {
title = t("sessions");
} else if (path.startsWith("/workspace")) {
title = t("workspace");
} else if (path.startsWith("/settings")) {
title = t("settings");
} else if (path !== "/") {
title = t("notFound");
}
useDocumentTitle(title);
return null;
}