migrate compare and tankopedia loadout to new data-driven components, splitting the old monolithic loadout and compare UI into smaller pieces and adding shared Table, Dialog and Scroller primitives

This commit is contained in:
tresabhi committed 2026-11-14 01:17:38 -06:00
1 parent 287aba853f
commit c311a6ab8b
111 files changed
+4009 -3917

No files matched your search

@@ -0,0 +1,17 @@
import { api } from "../api/dynamic";
import type { TankState } from "./tankState";
const tanks = await api.tanks();
// Turns the ids held in a tank state into their definitions
export function resolveTankModules(state: TankState) {
// TODO: consider changing array to a map just like modules
const tank = tanks.tanks[state.tank];
const turret = tank.turrets.find(({ id }) => id === state.turret)!;
const gun = turret.guns.find(({ id }) => id === state.gun)!;
const shell = gun.shells.find(({ id }) => id === state.shell)!;
const engine = tank.engines.find(({ id }) => id === state.engine)!;
const track = tank.tracks.find(({ id }) => id === state.track)!;
return { tank, turret, gun, shell, engine, track };
}