fix(frontend): derive THEME_OPTIONS from an exhaustive AppTheme record
github/actions/ci GitHub Actions CI finished: failure
github/actions/ci GitHub Actions CI finished: failure
The quick theme switcher's option list was a hand-maintained array that could drift from the AppTheme union. Derive it from a Record<AppTheme, string> instead, so adding a theme forces this mapping to be updated too.
This commit is contained in:
@@ -5,11 +5,15 @@ import { ContextMenu, MenuItem, MenuLabel } from './menu'
|
|||||||
import { PhokusMark } from './PhokusMark'
|
import { PhokusMark } from './PhokusMark'
|
||||||
import { Tooltip } from './Tooltip'
|
import { Tooltip } from './Tooltip'
|
||||||
|
|
||||||
const THEME_OPTIONS: { value: AppTheme; label: string }[] = [
|
const THEME_LABELS: Record<AppTheme, string> = {
|
||||||
{ value: 'phokus', label: 'Phokus' },
|
phokus: 'Phokus',
|
||||||
{ value: 'subtle-light', label: 'Subtle Light' },
|
'subtle-light': 'Subtle Light',
|
||||||
{ value: 'conventional-dark', label: 'Conventional Dark' },
|
'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
|
// SVG icons for window controls
|
||||||
function MinimizeIcon() {
|
function MinimizeIcon() {
|
||||||
|
|||||||
Reference in New Issue
Block a user