migrate tier list

This commit is contained in:
tresabhi committed 2026-11-27 14:57:39 -06:00
1 parent be8e36c6fd
commit 5d9c07eb3a
108 files changed
+1238 -922

No files matched your search

@@ -1,5 +1,6 @@
import type { TankEnvironment } from "@blitzkit/core";
import { createDefaultEnvironment, type TankEnvironment } from "@blitzkit/core";
import { Soapstone } from "soapstone";
import { api } from "../api/dynamic";
import { resolveTankModules } from "../tankopedia/resolveTankModules";
import type { TankState } from "../tankopedia/tankState";
import { SortDirection } from "./tankopediaPersistent";
@@ -17,15 +18,14 @@ export interface CompareEphemeral {
sorting: TankSort;
}
export const CompareEphemeral = new Soapstone<
CompareEphemeral,
TankEnvironment
>((environment) => ({
environment,
const skills = await api.skills();
export const CompareEphemeral = new Soapstone<CompareEphemeral>({
environment: createDefaultEnvironment(skills),
syncShells: false,
members: [],
sorting: { by: null, direction: SortDirection.Descending },
}));
});
// Picks the shell at the same slot on every member, where one exists
export function syncShellSlot(members: CompareMember[], slot: number) {
@@ -2,7 +2,7 @@ import { EmbedState, type EmbedConfig, type ExtractEmbedConfigTypes } from ".";
import {
breakdownConfig,
extractEmbedConfigDefaults,
} from "../../constants/embeds";
} from "../../config/embeds";
import type { EmbedConfigItemType, EmbedItemType } from "./constants";
import { embedText } from "./tokens";
+27 -10
View File
@@ -1,17 +1,34 @@
import { enableMapSet } from "immer";
import { Soapstone } from "soapstone";
import { tierListRows } from "../components/TierList/Table/constants";
import {
tierListColors,
tierListDefaultRowCount,
tierListRowColors,
} from "../config/tierList";
import type { Color } from "../ui/color";
export interface TierListRowState {
name: string;
color: Color;
tanks: number[];
}
export interface TierList {
dragging: boolean;
rows: { name: string; tanks: number[] }[];
placedTanks: Set<number>;
rows: TierListRowState[];
}
const A_CODE = "A".charCodeAt(0);
// The first row is S, then the lettering runs from A
export function createTierListRow(index: number) {
const name = index === 0 ? "S" : String.fromCharCode(A_CODE + index - 1);
const color =
tierListRowColors[index] ?? tierListColors[index % tierListColors.length];
return { name, color, tanks: [] } satisfies TierListRowState;
}
export const TierList = new Soapstone<TierList>({
dragging: false,
rows: tierListRows.map((row) => ({ name: row.name, tanks: [] })),
placedTanks: new Set(),
rows: Array.from({ length: tierListDefaultRowCount }, (_, index) =>
createTierListRow(index),
),
});
enableMapSet();