Files
AgentHub/client/src/components/DocumentTitle.tsx
T
nntrivi2001 744e9c6cda feat(ui): fold the Workflows page into Dashboard → Analytics → Workflow
The workflow analytics now render under the Analytics tab's Workflow
sub-tab; ?tab= and ?sub= deep-link the Dashboard, /workflows redirects there,
and the sidebar drops its Workflows item.
2026-10-01 22:05:55 +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;
}