Files
silo-server/web/src/lib/documentTitle.ts
T
QuickandClaude Opus 4.8 f8493a47f1 fix(web): accessibility & UX fixes from visual QA pass
Accessibility (WCAG AA):
- Lighten the Standard-theme `--muted-foreground` (#6e6e78 -> #9696a0,
  ~3.4:1 -> >=5.3:1) and darken the light-theme equivalent so secondary
  text meets 1.4.3 contrast app-wide; the opt-in High Contrast mode is no
  longer the only conformant path.
- Give icon-only controls accessible names (4.1.2): the password show/hide
  toggle (also drop tabIndex={-1} so it's keyboard reachable), and the
  Edit/Delete/health/copy/refresh actions across the Users, Libraries,
  Nodes, API Keys, Catalog Maintenance and Job History admin tables.
- Fix the Switch off-state (invisible track -> visible border + fill) and
  the PlaybackSettings SettingRow label association (the <label htmlFor>
  pointed at a wrapping <div>; the id now lands on the Switch/SelectTrigger).
- Login: wrap the card in <main> and add an <h1>; Profiles: add an
  accessible PIN-protected label and a corner lock badge.
- Player + catalog: role="status" on the initial loading overlay; scope the
  catalog count ("0 in library" for search) and announce it via aria-live;
  trim the verbose poster-link name to the title.

UX / consistency:
- Emphasize overdue scheduled tasks (warning colour + icon + word, not
  colour alone).
- Per-source catalog subtitles instead of one shared string.
- Add a Reconnect affordance when the admin log stream drops (it does not
  auto-retry).
- Page titles for Watch Party + all admin sub-pages (incl. plugins); admin
  heading capitalisation normalised to Title Case.
- Show "dev build" instead of "unavailable" when no build revision is
  stamped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-28 18:47:11 -04:00

86 lines
2.4 KiB
TypeScript

/** Default app name, overridable by admin branding settings. */
export let APP_DOCUMENT_TITLE = "Silo";
/** Called by the branding provider to update the document title prefix. */
export function setAppDocumentTitle(name: string) {
APP_DOCUMENT_TITLE = name || "Silo";
}
const SETTINGS_TITLES: Record<string, string> = {
appearance: "Appearance Settings",
accessibility: "Accessibility Settings",
playback: "Playback Settings",
profiles: "Profile Settings",
libraries: "Library Settings",
"history-import": "History Import Settings",
"plex-webhooks": "Webhook Sync Settings",
"webhook-sync": "Webhook Sync Settings",
"subtitle-appearance": "Subtitle Settings",
"home-screen": "Home Screen Settings",
"card-overlays": "Card Overlay Settings",
};
const ADMIN_TITLES: Record<string, string> = {
activity: "Admin Activity",
"api-keys": "Admin API Keys",
collections: "Admin Collections",
devices: "Admin Devices",
history: "Admin Playback History",
"history-import": "Admin History Import",
libraries: "Admin Libraries",
logs: "Admin Logs",
maintenance: "Admin Maintenance",
nodes: "Admin Nodes",
plugins: "Admin Plugins",
recommendations: "Admin Recommendations",
requests: "Admin Requests",
sections: "Admin Sections",
subtitles: "Admin Subtitles",
settings: "Admin Settings",
tasks: "Admin Tasks",
users: "Admin Users",
};
export function formatDocumentTitle(label?: string | null): string {
const normalized = label?.trim();
if (!normalized) {
return APP_DOCUMENT_TITLE;
}
return `${normalized} · ${APP_DOCUMENT_TITLE}`;
}
export function resolveSettingsDocumentTitle(pathname: string): string {
const segments = pathname.split("/").filter(Boolean);
const settingsSegment = segments[1];
return SETTINGS_TITLES[settingsSegment ?? ""] ?? "Settings";
}
export function resolveAdminDocumentTitle(pathname: string): string {
const segments = pathname.split("/").filter(Boolean);
const adminSegment = segments[1];
const nestedSegment = segments[2];
if (!adminSegment) {
return "Admin";
}
if (adminSegment === "collections") {
if (nestedSegment === "new") {
return "New Admin Collection";
}
if (segments[3] === "edit") {
return "Edit Admin Collection";
}
}
if (adminSegment === "tasks" && nestedSegment) {
return "Admin Task";
}
if (adminSegment === "users" && nestedSegment) {
return "Admin User";
}
return ADMIN_TITLES[adminSegment] ?? "Admin";
}