mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-05 20:34:16 +01:00
- Remote Crew browser client rebuilt as a dark combat-information-centre layout for large desktop monitors: slim status bar (stations, mission, clocks, UTC, link state), pulsing alert band, the instrument as centrepiece and collapsible docks (contacts, station, contact detail, log drawer; keys , . L). Four columns from 2400 px, fluid type up to 4K; guide, lookout and contact library open as overlays (Esc closes). - app.js split into native ES modules under data/commander/js; the transport (net/*) no longer touches the DOM and talks to the views through synchronous topics (core/events.js, app/bindings.js); redraws share one frame scheduler. - style.css replaced by a token-based design system in data/commander/css. - Inter 4.1 and JetBrains Mono 2.304 bundled unmodified (OFL-1.1) with provenance in THIRD_PARTY_NOTICES.md; CSP allows font-src 'self'. - Server serves the css/js/fonts trees from one asset manifest (src/commander/assets.py); packaging, capture tool, help, manual and docs updated; tests share tests/commander_web.py and import modules directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.8 KiB
JavaScript
35 lines
1.8 KiB
JavaScript
import { S } from "../state/store.js";
|
|
import { $, reasons } from "../core/base.js";
|
|
import { t, unit } from "../core/format.js";
|
|
import { sendBridgeOrder } from "../net/commands.js";
|
|
import { bridgeOrderAvailable } from "../state/availability.js";
|
|
import { renderDisabledReasons } from "./controls.js";
|
|
import { metrics } from "./dom.js";
|
|
|
|
export function renderBridgeOrders() {
|
|
const panel = $("bridge-orders");
|
|
panel.hidden = S.session?.station !== "bridge";
|
|
if (panel.hidden) return;
|
|
const navigation = S.v2State?.bridge?.navigation || {};
|
|
metrics($("bridge-order-values"), [
|
|
["bridge_current_course", unit(navigation.course, "\u00b0", 0)],
|
|
["bridge_ordered_course", unit(navigation.target_course, "\u00b0", 0)],
|
|
["bridge_current_speed", unit(navigation.speed, "kn")],
|
|
["bridge_ordered_speed", unit(navigation.target_speed, "kn")],
|
|
]);
|
|
$("bridge-course").disabled = $("bridge-course-submit").disabled = !bridgeOrderAvailable("course");
|
|
$("bridge-speed").disabled = $("bridge-speed-submit").disabled = !bridgeOrderAvailable("speed");
|
|
const message = S.pending ? {key: S.pending.uncertain ? "bridge_order_uncertain" : "bridge_order_pending", status: "pending"} : S.commandMessage;
|
|
const reason = Object.hasOwn(reasons, message?.reasoncode) ? t(reasons[message.reasoncode]) : t("reason_action_rejected");
|
|
$("bridge-order-status").textContent = message ? t(message.key, {reason}) :
|
|
S.v2State?.bridge?.orders.station_down ? t("bridge_down") : "";
|
|
$("bridge-order-status").dataset.status = message?.status || "";
|
|
renderDisabledReasons();
|
|
}
|
|
// Reads and validates the order form, then hands the number to the transport.
|
|
export function submitBridgeOrder(kind) {
|
|
if (!bridgeOrderAvailable(kind)) return;
|
|
if (!$(`bridge-${kind}-form`).reportValidity()) return;
|
|
sendBridgeOrder(kind, $(`bridge-${kind}`).valueAsNumber);
|
|
}
|