From 2bc4a981641e7a959ffb2028d7a786fd204e2150 Mon Sep 17 00:00:00 2001 From: LyAhn Date: Mon, 6 Jul 2026 20:42:06 +0100 Subject: [PATCH] fix(frontend): derive THEME_OPTIONS from an exhaustive AppTheme record The quick theme switcher's option list was a hand-maintained array that could drift from the AppTheme union. Derive it from a Record instead, so adding a theme forces this mapping to be updated too. --- src/components/TitleBar.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/TitleBar.tsx b/src/components/TitleBar.tsx index c9fcb8a..ce057c8 100644 --- a/src/components/TitleBar.tsx +++ b/src/components/TitleBar.tsx @@ -5,11 +5,15 @@ import { ContextMenu, MenuItem, MenuLabel } from './menu' import { PhokusMark } from './PhokusMark' import { Tooltip } from './Tooltip' -const THEME_OPTIONS: { value: AppTheme; label: string }[] = [ - { value: 'phokus', label: 'Phokus' }, - { value: 'subtle-light', label: 'Subtle Light' }, - { value: 'conventional-dark', label: 'Conventional Dark' }, -] +const THEME_LABELS: Record = { + phokus: 'Phokus', + 'subtle-light': 'Subtle Light', + 'conventional-dark': 'Conventional Dark', +} +const THEME_OPTIONS = (Object.keys(THEME_LABELS) as AppTheme[]).map((value) => ({ + value, + label: THEME_LABELS[value], +})) // SVG icons for window controls function MinimizeIcon() {