180d85eec0
M2 — Add TODO(#375) tripwire comments where the dark/light theme-color hex pair is duplicated outside tokens.json (vite.config.ts and applyMetaThemeColor.svelte.ts). Refactoring is out of scope for #363; the comments are stop signs for the next person who edits these. M5 — The SPA never reads window.__MINSTREL__.description. The OG meta description is server-rendered and complete on its own. Drop the dead inline-script field and the corresponding helpers in branding.ts. Server-side BrandingConfig.Description stays — it's still used for <meta name="description"> and og:description. Copy nit — Playlist detail page title becomes "Playlist · Foo" matching the singular form already used by Artist · / Album ·.
25 lines
708 B
TypeScript
25 lines
708 B
TypeScript
declare global {
|
|
interface Window {
|
|
__MINSTREL__?: { appName: string };
|
|
}
|
|
}
|
|
|
|
const DEFAULT_APP_NAME = 'Minstrel';
|
|
|
|
const isRenderedToken = (v: string | undefined): v is string =>
|
|
typeof v === 'string' && v.length > 0 && !v.includes('{{');
|
|
|
|
export const appName = (): string => {
|
|
if (typeof window === 'undefined') return DEFAULT_APP_NAME;
|
|
return isRenderedToken(window.__MINSTREL__?.appName)
|
|
? window.__MINSTREL__!.appName
|
|
: DEFAULT_APP_NAME;
|
|
};
|
|
|
|
export const pageTitle = (section?: string): string =>
|
|
section ? `${appName()} · ${section}` : appName();
|
|
|
|
// Ensure this file is treated as a module (the global declaration above
|
|
// otherwise turns it into a global script).
|
|
export {};
|