fix(web): gateway strip's new labels are optional locale keys with an en fallback
`tsc -b` in the Docker image build failed on every non-en locale (TS2739: gatewayStrip missing degraded, heartbeatStale) because the new keys were declared required on Translations. The web locales are full objects, not partial overrides, so a new key must be optional and read through the `en` fallback — the pattern the existing 102 optional keys (loadFailed, gateway, gatewayHint, ...) already use. Before: web `tsc -b` -> 16 x TS2739. After: 0 locale errors.
This commit is contained in:
@@ -2,6 +2,7 @@ import { Link } from "react-router";
|
||||
import type { StatusResponse } from "@/lib/api";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useI18n } from "@/i18n";
|
||||
import { en } from "@/i18n/en";
|
||||
|
||||
/** Gateway + session summary for the System sidebar block (no separate strip chrome). */
|
||||
export function SidebarStatusStrip({ status }: SidebarStatusStripProps) {
|
||||
@@ -60,7 +61,7 @@ export function gatewayLine(
|
||||
// Live: some channels offline. Retained on a dead PID: a watchdog hard-exited a wedged
|
||||
// process (gateway_exit_reason names it) — same verdict `hermes gateway status` prints.
|
||||
degraded: {
|
||||
label: g.degraded,
|
||||
label: g.degraded ?? en.app.gatewayStrip.degraded!,
|
||||
tone: status.gateway_running ? "text-warning" : "text-destructive",
|
||||
},
|
||||
stopped: { label: g.stopped, tone: "text-muted-foreground" },
|
||||
@@ -68,7 +69,7 @@ export function gatewayLine(
|
||||
// Alive but housekeeping stopped stamping the heartbeat: 'Running' would be the lie the
|
||||
// reporter saw (loop/housekeeping wedged while gateway_state.json still said running).
|
||||
if (status.gateway_heartbeat_stale_s != null) {
|
||||
return { label: g.heartbeatStale, tone: "text-destructive" };
|
||||
return { label: g.heartbeatStale ?? en.app.gatewayStrip.heartbeatStale!, tone: "text-destructive" };
|
||||
}
|
||||
if (status.gateway_state && byState[status.gateway_state]) {
|
||||
return byState[status.gateway_state];
|
||||
|
||||
@@ -84,9 +84,9 @@ export interface Translations {
|
||||
activeSessionsLabel: string;
|
||||
gatewayStatusLabel: string;
|
||||
gatewayStrip: {
|
||||
degraded: string;
|
||||
degraded?: string;
|
||||
failed: string;
|
||||
heartbeatStale: string;
|
||||
heartbeatStale?: string;
|
||||
off: string;
|
||||
running: string;
|
||||
starting: string;
|
||||
|
||||
Reference in New Issue
Block a user