mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 03:04:03 +00:00
Reflect active tab in document.title
Every Pulse route rendered as a browser tab labeled "Pulse" — the
title never changed even when navigating between Infrastructure,
Workloads, Storage, Recovery, Alerts, Patrol, and Settings. Multi-tab
users couldn't tell tabs apart, browser history showed identical
entries, and screen-reader page-title announcements gave no useful
context.
Add a createEffect in AppLayout that maps the active tab id (resolved
via getActiveTabForPath on location.pathname) to a label and writes
"{label} · Pulse" to document.title. Verified live: all seven top-level
routes update correctly.
Title:
/infrastructure → Infrastructure · Pulse
/workloads → Workloads · Pulse
/storage → Storage · Pulse
/recovery → Recovery · Pulse
/alerts → Alerts · Pulse
/patrol → Patrol · Pulse
/settings/... → Settings · Pulse
This commit is contained in:
@@ -184,6 +184,24 @@ export function AppLayout(props: AppLayoutProps) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reflect the active tab in the browser tab title so multi-tab use,
|
||||||
|
// browser history, and screen-reader page-title announcements all
|
||||||
|
// identify the current Pulse surface instead of every page reading
|
||||||
|
// as the bare app name.
|
||||||
|
const tabTitleByActive: Record<NonNullable<ReturnType<typeof getActiveTabForPath>>, string> = {
|
||||||
|
infrastructure: 'Infrastructure',
|
||||||
|
workloads: 'Workloads',
|
||||||
|
storage: 'Storage',
|
||||||
|
recovery: 'Recovery',
|
||||||
|
alerts: 'Alerts',
|
||||||
|
ai: 'Patrol',
|
||||||
|
settings: 'Settings',
|
||||||
|
};
|
||||||
|
createEffect(() => {
|
||||||
|
const active = getActiveTabForPath(location.pathname);
|
||||||
|
document.title = active ? `${tabTitleByActive[active]} · Pulse` : 'Pulse';
|
||||||
|
});
|
||||||
|
|
||||||
const toggleKioskMode = () => {
|
const toggleKioskMode = () => {
|
||||||
setKioskMode(!kioskMode());
|
setKioskMode(!kioskMode());
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user