diff --git a/apps/k1-viewer/index.html b/apps/k1-viewer/index.html index 32cbe75..0395819 100644 --- a/apps/k1-viewer/index.html +++ b/apps/k1-viewer/index.html @@ -1,14 +1,14 @@ - + - K1 Live Console · NODE.DC + K1 · Облако точек в реальном времени · NODE.DC
diff --git a/apps/k1-viewer/src/App.tsx b/apps/k1-viewer/src/App.tsx index 17a090b..38276e4 100644 --- a/apps/k1-viewer/src/App.tsx +++ b/apps/k1-viewer/src/App.tsx @@ -23,33 +23,33 @@ type ConsoleSection = "monitor" | "connect" | "session"; type SessionIntent = "live" | "replay"; const sectionItems = [ - { value: "monitor", label: "Monitor" }, - { value: "connect", label: "Connect" }, - { value: "session", label: "Session" }, + { value: "monitor", label: "Монитор" }, + { value: "connect", label: "Подключение" }, + { value: "session", label: "Поток" }, ] as const; const sessionItems = [ - { value: "live", label: "Live scanner" }, - { value: "replay", label: "Replay capture" }, + { value: "live", label: "Сканер в реальном времени" }, + { value: "replay", label: "Повтор записи" }, ] satisfies Array<{ value: SessionIntent; label: string }>; const phaseLabels: Record = { - idle: "Idle", - scanning: "BLE scan", - device_selected: "Device selected", - provisioning: "Provisioning Wi-Fi", - connecting: "Connecting", - connected: "K1 connected", - starting_live: "Starting live", - live: "Live stream", - replay: "Replay", - stopping: "Stopping", - error: "Error", + idle: "Ожидание", + scanning: "Поиск по BLE", + device_selected: "K1 выбран", + provisioning: "Передача настроек Wi‑Fi", + connecting: "Подключение", + connected: "K1 подключён", + starting_live: "Запуск потока", + live: "Поток в реальном времени", + replay: "Повтор записи", + stopping: "Остановка", + error: "Ошибка", }; function phaseLabel(phase: string | null | undefined): string { - if (!phase) return "No state"; - return phaseLabels[phase] ?? phase.replaceAll("_", " "); + if (!phase) return "Нет состояния"; + return phaseLabels[phase] ?? "Неизвестное состояние"; } function phaseTone(phase: string | null | undefined): StatusTone { @@ -64,13 +64,22 @@ function phaseTone(phase: string | null | undefined): StatusTone { function backendLabel(status: BackendStatus): string { return { - checking: "Checking API", - online: "API online", - degraded: "API degraded", - offline: "API offline", + checking: "Проверка API", + online: "API работает", + degraded: "API работает частично", + offline: "API недоступен", }[status]; } +function eventStatusLabel(status: string): string { + return { + connecting: "подключение", + open: "подключён", + closed: "закрыт", + error: "ошибка", + }[status] ?? "неизвестно"; +} + function backendTone(status: BackendStatus): StatusTone { if (status === "online") return "success"; if (status === "degraded" || status === "checking") return "warning"; @@ -97,7 +106,7 @@ function pipelineLatency(metrics: K1Metrics | undefined): number | null { function formatNumber(value: number | null, digits = 1): string { if (value === null) return "—"; - return value.toLocaleString("en-US", { + return value.toLocaleString("ru-RU", { maximumFractionDigits: digits, minimumFractionDigits: digits, }); @@ -180,19 +189,19 @@ function DeviceRow({
- {finiteMetric(device.rssi) === null ? "RSSI —" : `${device.rssi} dBm`} + {finiteMetric(device.rssi) === null ? "RSSI —" : `${device.rssi} дБм`}
@@ -203,17 +212,17 @@ function LatencyTrace({ values }: { values: number[] }) { const ceiling = Math.max(16, ...values); return ( -
+
{values.length ? ( values.map((value, index) => ( )) ) : ( -

No latency samples yet. The chart remains empty until the backend reports metrics.

+

Измерений пока нет. График появится после получения первых данных от K1.

)}
); @@ -226,13 +235,13 @@ function FoxglovePanel({ state }: { state: ConsoleState | null }) {