chore(web): post-#363 cleanup — DRY tripwires, drop unused description, singular playlist title

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 ·.
This commit is contained in:
2026-05-03 19:04:59 -04:00
parent a8fd33d4ed
commit 180d85eec0
5 changed files with 14 additions and 28 deletions
+7 -16
View File
@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { appName, description, pageTitle } from './branding';
import { appName, pageTitle } from './branding';
const setGlobal = (g: { appName: string; description: string } | undefined) => {
const setGlobal = (g: { appName: string } | undefined) => {
if (g === undefined) {
delete (window as { __MINSTREL__?: unknown }).__MINSTREL__;
} else {
@@ -14,7 +14,7 @@ describe('branding helpers', () => {
afterEach(() => setGlobal(undefined));
it('appName returns the global value when set', () => {
setGlobal({ appName: 'Family Jukebox', description: 'home' });
setGlobal({ appName: 'Family Jukebox' });
expect(appName()).toBe('Family Jukebox');
});
@@ -23,31 +23,22 @@ describe('branding helpers', () => {
});
it('appName falls back to "Minstrel" when value contains an unrendered Go token', () => {
setGlobal({ appName: '{{ .AppName }}', description: 'x' });
setGlobal({ appName: '{{ .AppName }}' });
expect(appName()).toBe('Minstrel');
});
it('description returns the global value when set', () => {
setGlobal({ appName: 'Minstrel', description: 'Our home library.' });
expect(description()).toBe('Our home library.');
});
it('description falls back to a default tagline when unset', () => {
expect(description()).toContain('Self-hosted music server');
});
it('pageTitle with section returns "{appName} · {section}"', () => {
setGlobal({ appName: 'Minstrel', description: 'x' });
setGlobal({ appName: 'Minstrel' });
expect(pageTitle('Search')).toBe('Minstrel · Search');
});
it('pageTitle without section returns just the appName', () => {
setGlobal({ appName: 'Minstrel', description: 'x' });
setGlobal({ appName: 'Minstrel' });
expect(pageTitle()).toBe('Minstrel');
});
it('pageTitle composes nested sections via the · separator', () => {
setGlobal({ appName: 'Minstrel', description: 'x' });
setGlobal({ appName: 'Minstrel' });
expect(pageTitle('Library · Artists')).toBe('Minstrel · Library · Artists');
});
});