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>
43 lines
2.2 KiB
JavaScript
43 lines
2.2 KiB
JavaScript
import { S } from "../state/store.js";
|
|
import { $, phases } from "../core/base.js";
|
|
import { duration, enumText, number, t, timeOfDay } from "../core/format.js";
|
|
import { renderBridgeOrders } from "./bridge-orders.js";
|
|
import { queueDraw } from "./chart.js";
|
|
import { metrics } from "./dom.js";
|
|
import { queueLookoutDraw, renderLookoutStatus } from "./lookout.js";
|
|
import { renderStationView } from "./station-view.js";
|
|
import { flushSonarFocus, renderDetail, renderTracks } from "./tracks.js";
|
|
import { renderWeatherStation } from "./weather.js";
|
|
|
|
export function renderSnapshot(resetDraft = false) {
|
|
renderWeatherStation();
|
|
$("mission-name").textContent = S.snapshot.mission.name;
|
|
$("objective").textContent = S.snapshot.mission.objective;
|
|
$("phase").textContent = enumText(phases, S.snapshot.phase);
|
|
$("command-permission").textContent = t(S.session?.grants.command ? "commands_enabled" : "commands_disabled");
|
|
$("autocrew-status").textContent = S.v2State?.autocrew ? t("autocrew_status", {
|
|
status: t(`autocrew_${S.v2State.autocrew.status}`),
|
|
}) : "";
|
|
$("autocrew-overview").textContent = S.v2State?.autocrew_overview?.some((row) => row.enabled)
|
|
? t("autocrew_overview", {stations: S.v2State.autocrew_overview.filter((row) => row.enabled)
|
|
.map((row) => `${t(`station_${row.station}`)}: ${t(`autocrew_${row.status}`)}`).join(", ")})
|
|
: t("autocrew_overview_none");
|
|
// Compact status-bar clocks; the full names are the tooltips.
|
|
metrics($("mission-metrics"), [
|
|
["status_remaining", duration(S.snapshot.mission.remaining_s)],
|
|
["status_elapsed", duration(S.snapshot.clock.mission)],
|
|
["status_world", timeOfDay(S.snapshot.clock.world)],
|
|
]);
|
|
for (const [row, key] of [...$("mission-metrics").children].map((row, index) => [row, ["remaining", "mission_clock", "world_clock"][index]])) row.title = t(key);
|
|
renderStationView();
|
|
renderBridgeOrders();
|
|
$("chart-disclaimer").textContent = S.chart.disclaimer;
|
|
$("snapshot-meta").textContent = t("snapshot_meta", { version: S.snapshot.version, seq: S.snapshot.seq, revision: S.snapshot.revision, sim: number(S.snapshot.clock.sim, 1) });
|
|
renderTracks();
|
|
renderDetail(resetDraft);
|
|
queueDraw();
|
|
renderLookoutStatus();
|
|
queueLookoutDraw();
|
|
flushSonarFocus();
|
|
}
|