Type health tone so the fallback is gone
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / web-coverage (push) Waiting to run
repo-contract / repo contract (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWYNS1qAMRdgAtbr5Rq
This commit is contained in:
Krzysztof Rudnicki 2026-11-16 10:54:12 +01:00
parent fee4ccdd88
commit b1424a5bea

View File

@ -10,14 +10,14 @@ import { errorNotice, glyph } from '../ui/build'
import { ServerRestart } from './serverRestart'
const DAEMON_TONE = { running: 'success', restarting: 'warning', unreachable: 'danger' } as const
const STATE_ICON: Record<string, IconId> = { success: 'health.ok', warning: 'health.warn', danger: 'health.bad', neutral: 'health.unknown' }
const STATE_ICON = { success: 'health.ok', warning: 'health.warn', danger: 'health.bad', neutral: 'health.unknown' } as const satisfies Record<string, IconId>
/** A health pill: the subject and state icons painted, `text` (+ `extra`) spoken. `data-state` holds the words for tests. */
function badge(tone: string, subject: IconId, text: string, extra = ''): HTMLSpanElement {
function badge(tone: keyof typeof STATE_ICON, subject: IconId, text: string, extra = ''): HTMLSpanElement {
return h(
'span',
{ class: `pill pill-${tone}`, 'data-state': text },
h('span', { class: 'has-word', 'aria-hidden': 'true' }, iconInline(subject), iconInline(STATE_ICON[tone] ?? 'health.unknown')),
h('span', { class: 'has-word', 'aria-hidden': 'true' }, iconInline(subject), iconInline(STATE_ICON[tone])),
h('span', { class: 'sr-only' }, text + extra),
)
}