fix(traffic): проверять live-срез и прекращать опрос выключенных устройств

This commit is contained in:
Denozordec committed 2026-10-12 21:35:55 +07:00
1 parent 1275dd7b9b
commit 2358ecef60
29 files changed
+1620 -114

No files matched your search

+3 -2
View File
@@ -1,9 +1,10 @@
/** Receipt time is not the timestamp of a network measurement. */
export function TrafficDataTime({ label, receivedAt, source, serverAt }: {
export function TrafficDataTime({ label, receivedAt, source, serverAt, serverTimeLabel = "метка сервера" }: {
label: string
receivedAt?: number | null
source: "API" | "live-поток"
serverAt?: string
serverTimeLabel?: string
}) {
if (receivedAt == null || !Number.isFinite(receivedAt)) return null
const date = new Date(receivedAt)
@@ -11,7 +12,7 @@ export function TrafficDataTime({ label, receivedAt, source, serverAt }: {
<p aria-label={label} className="text-xs text-muted-foreground mb-3 break-words">
Получено ({source}): <time dateTime={date.toISOString()}>{date.toLocaleString("ru-RU")}</time>
{serverAt && Number.isFinite(Date.parse(serverAt))
? <> · метка сервера: <time dateTime={serverAt}>{new Date(serverAt).toLocaleString("ru-RU")}</time></>
? <> · {serverTimeLabel}: <time dateTime={serverAt}>{new Date(serverAt).toLocaleString("ru-RU")}</time></>
: " · время измерения не предоставлено"}
</p>
)