codeburn/app/renderer/lib/modelSeries.ts
iamtoruk 015a1a069a polish(app): shared empty states, type ladder, AA contrast, honest affordances, a11y semantics
D1 one shared EmptyNote (7 copies removed); CliErrorPanel on canonical
   tokens; dead code deleted (CapsuleChart, stale SERIES_HEX palette,
   Stat tone API, unused rail/doc-chrome CSS)
D2 type ladder tokens (--fs-*/--fw-*); panel titles unified 13/600/ink;
   high-visibility sizes/weights snapped to rungs
D3 contrast: --mut2 5.00:1 light / 5.74:1 dark (was 2.37/3.11); new
   --accent-text 5.07:1 + persistent underline on text links; last
   prose em-dash removed
D4 'See all' and 'Most expensive sessions' navigate to Sessions; 'add
   alias' jumps to Settings/Aliases; chevrons only on clickable rows;
   inline confirm replaces window.confirm; default-period setting
   honored at boot; Sankey caption no longer promises a click; Optimize
   'improving' trend badges; cursor + Space-key fixes
D5 aria-current on nav, SegTabs as real tablist, aria-pressed toggles,
   ProviderPop rebuilt on Dropdown (one tab stop, arrow keys, focus ring)

191/191, typecheck + build green. Contrast ratios independently
recomputed. Net -93 lines.
2026-07-16 02:27:41 -07:00

55 lines
1.5 KiB
TypeScript

export type SeriesKey = 'opus' | 'fable' | 'sonnet' | 'haiku' | 'gpt' | 'other'
export const SERIES_LABELS: Record<SeriesKey, string> = {
opus: 'Opus',
fable: 'Fable',
sonnet: 'Sonnet',
haiku: 'Haiku',
gpt: 'GPT / Codex',
other: 'Other',
}
const SERIES_CSS_VAR: Record<SeriesKey, string> = {
opus: 'var(--s-opus)',
fable: 'var(--s-fable)',
sonnet: 'var(--s-sonnet)',
haiku: 'var(--s-haiku)',
gpt: 'var(--s-gpt)',
other: 'var(--s-other)',
}
const SERIES_CLASS: Record<SeriesKey, string> = {
opus: 's-opus',
fable: 's-fable',
sonnet: 's-son',
haiku: 's-hai',
gpt: 's-gpt',
other: 's-other',
}
export function seriesKeyForModel(model?: string): SeriesKey {
const m = (model ?? '').toLowerCase()
if (m.includes('opus')) return 'opus'
if (m.includes('fable')) return 'fable'
if (m.includes('sonnet')) return 'sonnet'
if (m.includes('haiku')) return 'haiku'
if (m.includes('gpt') || m.includes('codex')) return 'gpt'
return 'other'
}
export function seriesColorForModel(model?: string): string {
return SERIES_CSS_VAR[seriesKeyForModel(model)]
}
export function seriesClassForModel(model?: string): string {
return SERIES_CLASS[seriesKeyForModel(model)]
}
export function seriesClassForKey(series: SeriesKey): string {
return SERIES_CLASS[series]
}
export function isOtherNode(idOrLabel?: string): boolean {
const value = (idOrLabel ?? '').trim().toLowerCase()
return value === '__other__' || value === 'other' || value === 'others'
}