Add optional logoLightUrl/logoDarkUrl to InstalledTheme + resolveThemeLogo() helper; set logos on vnclagoon + src themes; login page and nav-rail prefer the active theme's logo, falling back to the global config logo. So switching theme switches the whole brand. 0 type errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
901 B
TypeScript
25 lines
901 B
TypeScript
import type { InstalledTheme } from './plugin-types';
|
|
|
|
/**
|
|
* Resolve which logo to show. When the active theme carries brand logos
|
|
* (logoLightUrl/logoDarkUrl), those win — so switching theme switches the whole
|
|
* brand (VNClagoon wordmark ↔ SRC mark). Otherwise falls back to the globally
|
|
* configured logo. Returns a raw path; the caller applies withBasePath().
|
|
*/
|
|
export function resolveThemeLogo(
|
|
themes: InstalledTheme[],
|
|
activeThemeId: string | null,
|
|
isDark: boolean,
|
|
fallbackLight: string,
|
|
fallbackDark: string,
|
|
): string {
|
|
const theme = activeThemeId ? themes.find((t) => t.id === activeThemeId) : undefined;
|
|
if (theme) {
|
|
const themed = isDark
|
|
? (theme.logoDarkUrl ?? theme.logoLightUrl)
|
|
: (theme.logoLightUrl ?? theme.logoDarkUrl);
|
|
if (themed) return themed;
|
|
}
|
|
return isDark ? (fallbackDark || fallbackLight) : (fallbackLight || fallbackDark);
|
|
}
|