Files
uconsole_asw_game/data/commander/js/views/status.js
T
db9979andClaude Opus 5.5 f7e6d05e2a Web: overlap-free status bar, h:mm:ss clocks, overlays inside the viewport
- Status bar stays one row at every desktop width: short clock labels (full
  names as tooltips), mission remaining/elapsed as h:mm:ss, connection text
  truncated with the full text as tooltip; badge, mission name and UTC give
  way on narrower windows instead of overlapping.
- Guide, lookout and contact library overlays no longer inherit the panel's
  100 % size, so they fit the viewport and the close button is visible.
- Regression tests for status-bar overlap and overlay bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 14:09:13 +02:00

21 lines
992 B
JavaScript

import { S } from "../state/store.js";
import { $ } from "../core/base.js";
import { t } from "../core/format.js";
import { ESCALATE_AFTER_FAILURES, NOTICE_AFTER_FAILURES } from "../state/shared.js";
export function renderConnection() {
const displayState = S.linkState === "stale" && S.failures < NOTICE_AFTER_FAILURES
? "reconnecting" : S.linkState;
$("connection").dataset.state = displayState;
const age = S.lastSuccess ? Math.max(0, Math.floor((performance.now() - S.lastSuccess) / 1000)) : 0;
const key = displayState === "stale" ? "connection_stale"
: displayState === "protocol_error" ? "connection_protocol_error"
: `connection_${displayState}`;
let text = t(key, { age });
if ((S.linkState === "stale" || S.linkState === "protocol_error") && S.failures >= ESCALATE_AFTER_FAILURES) {
text += " " + t("connection_escalated_hint", { minutes: Math.max(1, Math.floor(age / 60)) });
}
$("connection").textContent = text;
$("connection").title = text;
}