feedback5 R5: split the in-match UI logic into modules
public/js/ui/gameLogic.js becomes a re-export barrel. The bodies move verbatim into public/js/ui/gameLogic/*.js (shared, phases, camera, watch, bonds, shop, placement, draft, enemies, format, shortcuts, settings, result, loadout, panel). The barrel re-exports the same 96 names in the same order. isObj and int gain export on shared.js so sibling modules can import them; they stay off the barrel. No importer changes.
This commit is contained in:
1 parent
8ab6d021da
commit
eb04f5dfa4
16 files changed
+1864
-1778
No files matched your search
@@ -0,0 +1,16 @@
|
||||
// ui/gameLogic/shared.js — small helpers and seat order. Public names are re-exported from ../gameLogic.js.
|
||||
|
||||
// ---- small helpers -------------------------------------------------------------------------------
|
||||
|
||||
export const isObj = (v) => !!v && typeof v === 'object';
|
||||
export const int = (v, d = 0) => (Number.isInteger(v) ? v : d);
|
||||
export const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
|
||||
|
||||
/** Stable key of a board tile. */
|
||||
export const tileKey = (row, col) => `${row},${col}`;
|
||||
|
||||
/** Players sorted by seat (nulls dropped). */
|
||||
export function sortedPlayers(pub) {
|
||||
const list = Array.isArray(pub?.players) ? pub.players.filter(isObj) : [];
|
||||
return [...list].sort((a, b) => int(a.seat, 99) - int(b.seat, 99));
|
||||
}
|
||||
Reference in new issue
Block a user