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

+17 -14
View File
@@ -1,35 +1,38 @@
import type { TankEnvironment } from "@blitzkit/core";
import { Soapstone } from "soapstone";
import type { DuelMember } from "./duel";
import { resolveTankModules } from "../tankopedia/resolveTankModules";
import type { TankState } from "../tankopedia/tankState";
import { TankopediaSortDirection } from "./tankopediaPersistent";
import type { TankSort } from "./tankopediaSort";
export interface CompareMember extends DuelMember {
export interface CompareMember {
key: string;
state: TankState;
}
export interface CompareEphemeral {
crewSkills: Record<string, number>;
equalize: boolean;
environment: TankEnvironment;
syncShells: boolean;
members: CompareMember[];
sorting?: {
direction: "ascending" | "descending";
by: number;
};
sorting: TankSort;
}
export const CompareEphemeral = new Soapstone<
CompareEphemeral,
[Record<string, number>]
>((crewSkills) => ({
crewSkills,
equalize: false,
[TankEnvironment]
>((environment) => ({
environment,
syncShells: false,
members: [],
sorting: { by: null, direction: TankopediaSortDirection.Descending },
}));
// Picks the shell at the same slot on every member, where one exists
export function syncShellSlot(members: CompareMember[], slot: number) {
for (const member of members) {
const shell = member.gun.shells[slot];
const { gun } = resolveTankModules(member.state);
const shell = gun.shells[slot];
if (shell) member.shell = shell;
if (shell) member.state.shell = shell.id;
}
}
@@ -8,5 +8,5 @@ export interface ComparePersistent {
export const ComparePersistent = new Soapstone<ComparePersistent>(
{ deltaMode: "none" },
"compare-2"
"compare-2",
);