MCPcopy
hub / github.com/ifandelse/machina.js / renderStatus

Function renderStatus

examples/connectivity/src/ui.ts:43–60  ·  view source on GitHub ↗
(state: ConnectivityState)

Source from the content-addressed store, hash-verified

41 * Called from main.ts on every FSM `transitioned` event.
42 */
43export function renderStatus(state: ConnectivityState): void {
44 const indicator = document.getElementById("status-indicator");
45 const label = document.getElementById("status-label");
46
47 if (!indicator || !label) {
48 return;
49 }
50
51 // Remove all state classes first, then apply the new one.
52 // This keeps the element clean regardless of what state we came from.
53 ALL_STATE_CLASSES.forEach(cls => {
54 indicator.classList.remove(cls);
55 });
56 indicator.classList.add(`${STATE_CLASS_PREFIX}${state}`);
57
58 label.textContent = STATE_LABELS[state];
59 label.style.color = getStateColor(state);
60}
61
62/**
63 * Updates the check count display. Only meaningful when offline or checking.

Callers 1

main.tsFile · 0.90

Calls 1

getStateColorFunction · 0.85

Tested by

no test coverage detected