mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-05 20:34:16 +01:00
- 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>
21 lines
992 B
JavaScript
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;
|
|
}
|