feat: v0.9.0 — single-screen 3-pane shell + left Assets pane (wallet/reputation/fleet/time controls) from a single /api/state poll; right pane placeholder
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// Pure display formatters for the client panes (v0.9.0) — no game logic, unit-testable in node.
|
||||
|
||||
const CURRENCY = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'EUR' });
|
||||
|
||||
export function formatCash(value: number): string {
|
||||
return CURRENCY.format(value);
|
||||
}
|
||||
|
||||
// "6300 / 6300 L" — current value rounded (live fuel is fractional mid-flight).
|
||||
export function formatFuel(fuel: number, maxFuel: number): string {
|
||||
return `${Math.round(fuel)} / ${maxFuel} L`;
|
||||
}
|
||||
|
||||
// The sim clock is epoch ms (seeded from real time) — shown as a UTC wall-clock so the
|
||||
// display is deterministic regardless of the viewer's timezone.
|
||||
export function formatSimClock(clockMs: number): string {
|
||||
const d = new Date(clockMs);
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())} UTC`;
|
||||
}
|
||||
Reference in New Issue
Block a user