) => {
- if (!card.current) return;
-
- event.preventDefault();
-
- const rect = card.current.getBoundingClientRect();
-
- card.current.style.position = "fixed";
- card.current.style.cursor = "grabbing";
- card.current.style.zIndex = "1";
- card.current.style.left = `${rect.left}px`;
- card.current.style.top = `${rect.top}px`;
-
- lastPosition.current = { x: event.clientX, y: event.clientY };
-
- window.scrollTo({ behavior: "instant", top: 124 });
-
- window.addEventListener("pointermove", handlePointerMove);
- window.addEventListener("pointerup", handlePointerUp);
-
- TierList.mutate((draft) => {
- draft.dragging = true;
- });
-
- autoScroll.current = true;
- lastT.current = performance.now();
- autoScrollLoop();
- },
- [],
- );
- const handlePointerMove = useCallback((event: PointerEvent) => {
- if (!card.current) return;
-
- event.preventDefault();
-
- const rect = card.current.getBoundingClientRect();
- const dx = event.clientX - lastPosition.current.x;
- const dy = event.clientY - lastPosition.current.y;
-
- card.current.style.left = `${rect.left + dx}px`;
- card.current.style.top = `${rect.top + dy}px`;
-
- lastPosition.current = { x: event.clientX, y: event.clientY };
- }, []);
- const handlePointerUp = useCallback(() => {
- if (!card.current) return;
-
- const cardRect = card.current.getBoundingClientRect();
- const cardX = (cardRect.left + cardRect.right) / 2;
- const cardY = (cardRect.top + cardRect.bottom) / 2;
- let wasPlaced = false;
-
- rowLoop: for (const row of tierListRowElements) {
- const rowRect = row.getBoundingClientRect();
- const isWithinRow =
- cardX >= rowRect.left &&
- cardX <= rowRect.right &&
- cardY >= rowRect.top &&
- cardY <= rowRect.bottom;
-
- if (!isWithinRow) continue;
-
- const rowIndex = Number(row.dataset.index);
-
- for (const tile of tierListCardElements[rowIndex]) {
- const tileId = Number(tile.dataset.tileId);
-
- if (tileId === props.tank.id) continue;
-
- const tileRect = tile.getBoundingClientRect();
- const isWithinTile =
- cardX >= tileRect.left &&
- cardX <= tileRect.right &&
- cardY >= tileRect.top &&
- cardY <= tileRect.bottom;
-
- if (!isWithinTile) continue;
-
- const tileIndex = Number(tile.dataset.tileIndex);
-
- TierList.mutate((draft) => {
- draft.dragging = false;
- draft.rows.forEach((row) => {
- row.tanks = row.tanks.filter((tankId) => tankId !== props.tank.id);
- });
- draft.rows[rowIndex].tanks.splice(tileIndex, 0, props.tank.id);
- draft.placedTanks.add(props.tank.id);
- });
-
- wasPlaced = true;
-
- break rowLoop;
- }
-
- TierList.mutate((draft) => {
- draft.dragging = false;
- draft.rows.forEach((row) => {
- row.tanks = row.tanks.filter((tankId) => tankId !== props.tank.id);
- });
- draft.rows[rowIndex].tanks.push(props.tank.id);
- draft.placedTanks.add(props.tank.id);
- });
-
- wasPlaced = true;
-
- break;
- }
-
- if (!wasPlaced) {
- TierList.mutate((draft) => {
- draft.dragging = false;
- draft.rows.forEach((row) => {
- row.tanks = row.tanks.filter((tankId) => tankId !== props.tank.id);
- });
- draft.placedTanks.delete(props.tank.id);
- });
- }
-
- card.current.style.position = "static";
- card.current.style.zIndex = "unset";
- card.current.style.cursor = "grab";
-
- window.removeEventListener("pointermove", handlePointerMove);
- window.removeEventListener("pointerup", handlePointerUp);
-
- autoScroll.current = false;
- }, []);
-
- useEffect(() => {
- if (!props.isPlaced || !card.current) return;
-
- tierListCardElements[props.rowIndex].add(card.current);
-
- return () => {
- if (!card.current) return;
-
- tierListCardElements[props.rowIndex].delete(card.current);
- };
- }, []);
-
- return (
-
-
-
- );
-}
diff --git a/packages/website/src/components/TierList/Tiles.tsx b/packages/website/src/components/TierList/Tiles.tsx
deleted file mode 100644
index 332d40f1f..000000000
--- a/packages/website/src/components/TierList/Tiles.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { metaSortTank } from "@blitzkit/core";
-import { times } from "lodash-es";
-import { useMemo, useState } from "react";
-import usePromise from "react-promise-suspense";
-import { api } from "../../api/dynamic";
-import { filterTanks } from "../../core/blitzkit/filterTanks";
-import { TankFilters } from "../../stores/tankFilters";
-import { TierList } from "../../stores/tierList";
-import { TankCardSkeleton } from "../TankCardSkeleton";
-import { TankCardWrapper } from "../TankCardWrapper";
-import { TierListTile } from "./Tile";
-
-const [tankDefinitions, gameDefinitions] = await Promise.all([
- api.tanks(),
- api.game(),
-]);
-
-const tanks = Object.values(tankDefinitions.tanks);
-
-const PREVIEW_COUNT = 32;
-const DEFAULT_LOADED_CARDS = 75;
-
-export function TierListTiles() {
- const filters = TankFilters.use();
- const placedTanks = TierList.use((state) => state.placedTanks);
- const filteredTanks = usePromise(
- () =>
- filterTanks(filters, tanks).then((tanks) =>
- tanks.filter(({ id }) => !placedTanks.has(id)),
- ),
- // react-promise-suspense has awful type annotations
- [filters, placedTanks] as any,
- );
- const sorted = useMemo(
- () => metaSortTank(filteredTanks, gameDefinitions).reverse(),
- [filters, placedTanks],
- );
- const [loadedTiles, setLoadedTiles] = useState(DEFAULT_LOADED_CARDS);
-
- return (
-
- {sorted.slice(0, loadedTiles).map((tank) => (
-
- ))}
-
- {times(Math.min(PREVIEW_COUNT, sorted.length - loadedTiles), (index) => {
- return (
- {
- setLoadedTiles((state) => Math.min(state + 2, sorted.length));
- }}
- />
- );
- })}
-
- );
-}
diff --git a/packages/website/src/components/TierList/URLManager.tsx b/packages/website/src/components/TierList/URLManager.tsx
deleted file mode 100644
index 615ae912d..000000000
--- a/packages/website/src/components/TierList/URLManager.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useEffect } from "react";
-import { api } from "../../api/dynamic";
-import { generateTierListParams } from "../../core/blitzkit/generateTierListParams";
-import { TierList } from "../../stores/tierList";
-
-const tankDefinitions = await api.tanks();
-
-export function URLManager() {
- const rows = TierList.use((state) => state.rows);
-
- useEffect(() => {
- const params = new URLSearchParams(window.location.search);
-
- params.forEach((value, key) => {
- if (key.startsWith("row-")) {
- const index = Number.parseInt(key.slice(4), 10);
- const values = value
- .split(",")
- .map(Number)
- .filter((id) => id in tankDefinitions.tanks);
-
- TierList.mutate((draft) => {
- draft.rows[index].tanks = values;
- });
- }
- });
- }, []);
-
- useEffect(() => {
- window.history.replaceState(null, "", `?${generateTierListParams(rows)}`);
- }, [rows]);
-
- return null;
-}
diff --git a/packages/website/src/components/TierListControls/index.module.css b/packages/website/src/components/TierListControls/index.module.css
new file mode 100644
index 000000000..34cb77bc9
--- /dev/null
+++ b/packages/website/src/components/TierListControls/index.module.css
@@ -0,0 +1,5 @@
+.controls {
+ display: flex;
+ justify-content: center;
+ gap: var(--space-3);
+}
diff --git a/packages/website/src/components/TierListControls/index.tsx b/packages/website/src/components/TierListControls/index.tsx
new file mode 100644
index 000000000..54861f050
--- /dev/null
+++ b/packages/website/src/components/TierListControls/index.tsx
@@ -0,0 +1,34 @@
+import { ReloadIcon, Share2Icon } from "@radix-ui/react-icons";
+import { withLocale } from "../../hocs/withLocale";
+import { useStrings } from "../../hooks/useStrings";
+import { TierList } from "../../stores/tierList";
+import { Button } from "../Button";
+import { CopyButton } from "../CopyButton";
+import styles from "./index.module.css";
+
+export const TierListControls = withLocale(Content);
+
+function Content() {
+ const strings = useStrings();
+
+ return (
+
+ {
+ TierList.set(TierList.initial);
+ }}
+ >
+
+ {strings.tier_list.reset}
+
+
+ {/* The url is kept in sync with the rows */}
+ location.href}>
+
+ {strings.tier_list.share}
+
+
+ );
+}
diff --git a/packages/website/src/components/TierListRow/index.module.css b/packages/website/src/components/TierListRow/index.module.css
new file mode 100644
index 000000000..95326cd35
--- /dev/null
+++ b/packages/website/src/components/TierListRow/index.module.css
@@ -0,0 +1,3 @@
+.tanks {
+ width: 100%;
+}
diff --git a/packages/website/src/components/TierListRow/index.tsx b/packages/website/src/components/TierListRow/index.tsx
new file mode 100644
index 000000000..4c409713e
--- /dev/null
+++ b/packages/website/src/components/TierListRow/index.tsx
@@ -0,0 +1,27 @@
+import type { TierListRowState } from "../../stores/tierList";
+import { Table } from "../Table";
+import { TankCardWrapper } from "../TankCardWrapper";
+import { TierListRowHeader } from "../TierListRowHeader";
+import { TierListTile } from "../TierListTile";
+import styles from "./index.module.css";
+
+interface TierListRowProps {
+ index: number;
+ row: TierListRowState;
+}
+
+export function TierListRow({ index, row }: TierListRowProps) {
+ return (
+
+
+
+
+
+ {row.tanks.map((id) => (
+
+ ))}
+
+
+
+ );
+}
diff --git a/packages/website/src/components/TierListRowHeader/index.module.css b/packages/website/src/components/TierListRowHeader/index.module.css
new file mode 100644
index 000000000..44ab71a1f
--- /dev/null
+++ b/packages/website/src/components/TierListRowHeader/index.module.css
@@ -0,0 +1,35 @@
+/* A plain cell, since a row header's own background would cover the accent */
+.header {
+ vertical-align: middle;
+
+ background-color: var(--accent-9);
+ cursor: pointer;
+
+ /* Table cells ignore max-width, so the content carries the size: the widest name, within limits */
+ .content {
+ width: max-content;
+ min-width: 5rem;
+ max-width: 12rem;
+ min-height: 8rem;
+
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ gap: var(--space-2);
+ }
+}
+
+.swatches {
+ /* Adds no width of its own, filling and wrapping within what the rest of the popover sets */
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-2);
+ width: 0;
+ min-width: 100%;
+
+ /* Every swatch keeps its check so the buttons stay the same size; only the selected one shows it */
+ .swatch[data-selected="false"] svg {
+ visibility: hidden;
+ }
+}
diff --git a/packages/website/src/components/TierListRowHeader/index.tsx b/packages/website/src/components/TierListRowHeader/index.tsx
new file mode 100644
index 000000000..4c4e744fb
--- /dev/null
+++ b/packages/website/src/components/TierListRowHeader/index.tsx
@@ -0,0 +1,139 @@
+import {
+ CheckIcon,
+ Cross1Icon,
+ Pencil2Icon,
+ TrashIcon,
+} from "@radix-ui/react-icons";
+import { useState, type KeyboardEvent } from "react";
+import { tierListColors } from "../../config/tierList";
+import { useStrings } from "../../hooks/useStrings";
+import { TierList, type TierListRowState } from "../../stores/tierList";
+import { Button } from "../Button";
+import { Heading } from "../Heading";
+import { IconButton } from "../IconButton";
+import { Popover } from "../Popover";
+import { Table } from "../Table";
+import { TextField } from "../TextField";
+import styles from "./index.module.css";
+
+interface TierListRowHeaderProps {
+ index: number;
+ row: TierListRowState;
+}
+
+export function TierListRowHeader({ index, row }: TierListRowHeaderProps) {
+ const strings = useStrings();
+ const rowCount = TierList.useDeferred(
+ (state) => state.rows.length,
+ TierList.initial.rows.length,
+ );
+ const [open, setOpen] = useState(false);
+ const [name, setName] = useState(row.name);
+ const [color, setColor] = useState(row.color);
+
+ function apply() {
+ TierList.mutate((draft) => {
+ draft.rows[index].name = name;
+ draft.rows[index].color = color;
+ });
+
+ setOpen(false);
+ }
+
+ function remove() {
+ TierList.mutate((draft) => {
+ draft.rows.splice(index, 1);
+ });
+
+ setOpen(false);
+ }
+
+ function handleKeyDown(event: KeyboardEvent) {
+ if (event.key === "Enter") apply();
+ }
+
+ return (
+ {
+ if (open) {
+ setName(row.name);
+ setColor(row.color);
+ }
+
+ setOpen(open);
+ }}
+ >
+
+
+
+
+ {row.name}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setName((event.target as HTMLInputElement).value)
+ }
+ onKeyDown={handleKeyDown}
+ />
+
+
+
+
+ {tierListColors.map((swatch) => (
+ setColor(swatch)}
+ >
+
+
+ ))}
+
+
+
+
+
+
+
+ {strings.tier_list.edit.cancel}
+
+
+
+
+
+ {strings.tier_list.edit.remove}
+
+
+
+
+ {strings.tier_list.edit.apply}
+
+
+
+
+
+ );
+}
diff --git a/packages/website/src/components/TierListTable/index.module.css b/packages/website/src/components/TierListTable/index.module.css
new file mode 100644
index 000000000..344133d5a
--- /dev/null
+++ b/packages/website/src/components/TierListTable/index.module.css
@@ -0,0 +1,17 @@
+.table {
+ width: 100%;
+ background-color: var(--gray-2);
+
+ .body {
+ scroll-margin-top: var(--page-padding);
+ }
+
+ .add {
+ padding: var(--space-3);
+
+ /* Stretches the button across the table */
+ .button {
+ width: 100%;
+ }
+ }
+}
diff --git a/packages/website/src/components/TierListTable/index.tsx b/packages/website/src/components/TierListTable/index.tsx
new file mode 100644
index 000000000..160e95756
--- /dev/null
+++ b/packages/website/src/components/TierListTable/index.tsx
@@ -0,0 +1,51 @@
+import { PlusIcon } from "@radix-ui/react-icons";
+import { tierListInsertionMarker, tierListTable } from "../../config/tierList";
+import { withLocale } from "../../hocs/withLocale";
+import { useStrings } from "../../hooks/useStrings";
+import { createTierListRow, TierList } from "../../stores/tierList";
+import { Button } from "../Button";
+import { InsertionMarker } from "../InsertionMarker";
+import { Table } from "../Table";
+import { TierListRow } from "../TierListRow";
+import styles from "./index.module.css";
+
+export const TierListTable = withLocale(Content);
+
+function Content() {
+ const strings = useStrings();
+ const rows = TierList.useDeferred(
+ (state) => state.rows,
+ TierList.initial.rows,
+ );
+
+ return (
+ <>
+
+
+ {rows.map((row, index) => (
+
+ ))}
+
+
+
+ {
+ TierList.mutate((draft) => {
+ draft.rows.push(createTierListRow(draft.rows.length));
+ });
+ }}
+ >
+
+ {strings.tier_list.add}
+
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/packages/website/src/components/TierListTile/index.module.css b/packages/website/src/components/TierListTile/index.module.css
new file mode 100644
index 000000000..071af2b90
--- /dev/null
+++ b/packages/website/src/components/TierListTile/index.module.css
@@ -0,0 +1,11 @@
+.tile {
+ cursor: grab;
+ touch-action: none;
+
+ &[data-dragging="true"] {
+ position: fixed;
+ z-index: 1;
+
+ cursor: grabbing;
+ }
+}
diff --git a/packages/website/src/components/TierListTile/index.tsx b/packages/website/src/components/TierListTile/index.tsx
new file mode 100644
index 000000000..723cf38bd
--- /dev/null
+++ b/packages/website/src/components/TierListTile/index.tsx
@@ -0,0 +1,227 @@
+import { useCallback, useRef, type PointerEvent } from "react";
+import { api } from "../../api/dynamic";
+import { tierListInsertionMarker, tierListTable } from "../../config/tierList";
+import {
+ showInsertionMarker,
+ type InsertionMarkerPlacement,
+} from "../../core/blitzkit/showInsertionMarker";
+import { TierList } from "../../stores/tierList";
+import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
+import { TankCard } from "../TankCard";
+import { TankCardSkeleton } from "../TankCardSkeleton";
+import styles from "./index.module.css";
+
+// Fraction of the viewport at either edge that scrolls the page while dragging
+const SCROLL_ZONE = 1 / 3;
+const SCROLL_ZONE_END = 1 - SCROLL_ZONE;
+
+const tankDefinitions = await api.tanks();
+
+export interface TierListTileProps {
+ id: number;
+}
+
+interface TierListDropTarget {
+ row: number;
+ index: number;
+ marker: InsertionMarkerPlacement;
+}
+
+export function TierListTile(
+ props: MaybeSkeletonComponentProps,
+) {
+ const card = useRef(null);
+ const pointer = useRef({ x: 0, y: 0 });
+ const dragging = useRef(false);
+ const lastFrame = useRef(0);
+ const tankId = props.skeleton ? undefined : props.id;
+
+ // Where the card would land if dropped now; undefined sends it back to the pool
+ const target = useRef(undefined);
+
+ // Hit tests the cursor against the rows and the tanks already in them
+ const updateTarget = useCallback(() => {
+ const { x, y } = pointer.current;
+ const below = document
+ .elementsFromPoint(x, y)
+ .filter((element) => !card.current!.contains(element)) as HTMLElement[];
+
+ // Hit testing skips table rows themselves, so the row is found from a cell inside it
+ const hit = below.find((element) => element.closest("[data-row]") !== null);
+
+ if (hit === undefined) {
+ target.current = undefined;
+ showInsertionMarker(tierListInsertionMarker.current!, undefined);
+ return;
+ }
+
+ const row = hit.closest("[data-row]")!;
+ const cell = row.querySelector("[data-tier-cell]")!;
+ const grid = cell.querySelector("[data-tier-grid]")!;
+ const cellRect = cell.getBoundingClientRect();
+ const gap = parseFloat(getComputedStyle(grid).columnGap);
+ const padding = parseFloat(getComputedStyle(cell).paddingLeft);
+
+ // Indexed without the dragged card since it leaves its spot when placed
+ const siblings = [
+ ...grid.querySelectorAll("[data-tank-id]"),
+ ].filter((element) => element !== card.current);
+ const tile = below.find((element) => siblings.includes(element));
+
+ let index = siblings.length;
+
+ if (tile !== undefined) {
+ const tileRect = tile.getBoundingClientRect();
+
+ index =
+ siblings.indexOf(tile) +
+ (x > tileRect.left + tileRect.width / 2 ? 1 : 0);
+ }
+
+ // An empty row marks its start, otherwise the gap beside the nearest tank
+ const start = cellRect.left + padding / 2;
+ let marker: InsertionMarkerPlacement = {
+ position: [start, cellRect.top],
+ height: cellRect.height,
+ };
+
+ if (siblings.length > 0) {
+ const before = index < siblings.length;
+ const anchor =
+ siblings[before ? index : index - 1].getBoundingClientRect();
+ const left = before ? anchor.left - gap / 2 : anchor.right + gap / 2;
+
+ marker = { position: [left, anchor.top], height: anchor.height };
+ }
+
+ target.current = { row: Number(row.dataset.row), index, marker };
+ showInsertionMarker(tierListInsertionMarker.current!, marker);
+ }, []);
+
+ const autoScroll = useCallback(() => {
+ if (!dragging.current) return;
+
+ const v = pointer.current.y / window.innerHeight;
+ let speed = 0;
+
+ if (v <= SCROLL_ZONE) {
+ speed = v / SCROLL_ZONE - 1;
+ } else if (v >= SCROLL_ZONE_END) {
+ speed = 1 - (1 - v) / SCROLL_ZONE;
+ }
+
+ const now = performance.now();
+ const dt = now - lastFrame.current;
+ lastFrame.current = now;
+
+ window.scrollBy({ behavior: "instant", top: speed * dt });
+
+ // The page moves under a still pointer, so the target can change too
+ updateTarget();
+
+ requestAnimationFrame(autoScroll);
+ }, []);
+
+ const startAutoScroll = useCallback(() => {
+ if (!dragging.current) return;
+
+ lastFrame.current = performance.now();
+ autoScroll();
+ }, []);
+
+ const handlePointerMove = useCallback((event: globalThis.PointerEvent) => {
+ event.preventDefault();
+
+ const rect = card.current!.getBoundingClientRect();
+ const dx = event.clientX - pointer.current.x;
+ const dy = event.clientY - pointer.current.y;
+
+ card.current!.style.left = `${rect.left + dx}px`;
+ card.current!.style.top = `${rect.top + dy}px`;
+
+ pointer.current = { x: event.clientX, y: event.clientY };
+
+ updateTarget();
+ }, []);
+
+ const handlePointerUp = useCallback(() => {
+ updateTarget();
+
+ TierList.mutate((draft) => {
+ for (const row of draft.rows) {
+ row.tanks = row.tanks.filter((id) => id !== tankId);
+ }
+
+ // No target sends the tank back to the pool
+ if (target.current === undefined) return;
+
+ draft.rows[target.current.row].tanks.splice(
+ target.current.index,
+ 0,
+ tankId!,
+ );
+ });
+
+ showInsertionMarker(tierListInsertionMarker.current!, undefined);
+
+ delete card.current!.dataset.dragging;
+ card.current!.style.removeProperty("left");
+ card.current!.style.removeProperty("top");
+ card.current!.style.removeProperty("width");
+
+ window.removeEventListener("pointermove", handlePointerMove);
+ window.removeEventListener("pointerup", handlePointerUp);
+ window.removeEventListener("scrollend", startAutoScroll);
+
+ dragging.current = false;
+ target.current = undefined;
+ }, [tankId]);
+
+ const handlePointerDown = useCallback(
+ (event: PointerEvent) => {
+ event.preventDefault();
+
+ const rect = card.current!.getBoundingClientRect();
+
+ card.current!.style.left = `${rect.left}px`;
+ card.current!.style.top = `${rect.top}px`;
+ card.current!.style.width = `${rect.width}px`;
+ card.current!.dataset.dragging = "true";
+
+ pointer.current = { x: event.clientX, y: event.clientY };
+ dragging.current = true;
+
+ window.addEventListener("pointermove", handlePointerMove);
+ window.addEventListener("pointerup", handlePointerUp);
+
+ // Edge scrolling only kicks in once the table has been scrolled to
+ const table = tierListTable.current!;
+ const margin = parseFloat(getComputedStyle(table).scrollMarginTop);
+ const distance = table.getBoundingClientRect().top - margin;
+
+ if (Math.abs(distance) < 1 || !("onscrollend" in window)) {
+ table.scrollIntoView({ behavior: "instant", block: "start" });
+ startAutoScroll();
+ } else {
+ window.addEventListener("scrollend", startAutoScroll, { once: true });
+ table.scrollIntoView({ behavior: "smooth", block: "start" });
+ }
+ },
+ [handlePointerUp],
+ );
+
+ if (props.skeleton) {
+ return ;
+ }
+
+ return (
+
+
+
+ );
+}
diff --git a/packages/website/src/components/TierListTiles/index.tsx b/packages/website/src/components/TierListTiles/index.tsx
new file mode 100644
index 000000000..d5cd4a2e3
--- /dev/null
+++ b/packages/website/src/components/TierListTiles/index.tsx
@@ -0,0 +1,58 @@
+import { metaSortTanks } from "@blitzkit/core";
+import { useMemo } from "react";
+import usePromise from "react-promise-suspense";
+import { api } from "../../api/dynamic";
+import { filterTanks } from "../../core/blitzkit/filterTanks";
+import { withLocale } from "../../hocs/withLocale";
+import { App } from "../../stores/app";
+import { TankFilters } from "../../stores/tankFilters";
+import { TierList } from "../../stores/tierList";
+import { IncrementalLoader } from "../IncrementalLoader";
+import { TankCardWrapper } from "../TankCardWrapper";
+import { TankSearchNoResults } from "../TankSearchNoResults";
+import { TierListTile } from "../TierListTile";
+
+const [tankDefinitions, gameDefinitions] = await Promise.all([
+ api.tanks(),
+ api.game(),
+]);
+const tanks = Object.values(tankDefinitions.tanks);
+
+// Tanks not yet placed in any tier, ready to be dragged in
+export const TierListTiles = withLocale(Content);
+
+function Content() {
+ const filters = TankFilters.use();
+ const rows = TierList.useDeferred(
+ (state) => state.rows,
+ TierList.initial.rows,
+ );
+ const wargaming = App.use((state) => state.logins.wargaming);
+ const filtered = usePromise(
+ () => filterTanks(filters, tanks, wargaming?.id),
+ // react-promise-suspense has awful type annotations
+ [filters] as any,
+ );
+
+ const data = useMemo(() => {
+ const placed = new Set(rows.flatMap((row) => row.tanks));
+ const unplaced = filtered.filter(({ id }) => !placed.has(id));
+
+ return metaSortTanks(unplaced, gameDefinitions)
+ .reverse()
+ .map(({ id }) => ({ key: `${id}`, id }));
+ }, [filtered, rows]);
+
+ if (data.length === 0) return ;
+
+ return (
+
+
+
+ );
+}
diff --git a/packages/website/src/components/TierListURLManager.astro b/packages/website/src/components/TierListURLManager.astro
new file mode 100644
index 000000000..ce5aedd43
--- /dev/null
+++ b/packages/website/src/components/TierListURLManager.astro
@@ -0,0 +1,44 @@
+
+
diff --git a/packages/website/src/components/ToolBanner.astro b/packages/website/src/components/ToolBanner.astro
index 9fbfe9802..e493337c1 100644
--- a/packages/website/src/components/ToolBanner.astro
+++ b/packages/website/src/components/ToolBanner.astro
@@ -1,7 +1,7 @@
---
import { alias } from "@blitzkit/core";
import { api } from "../api/dynamic";
-import type { Tool } from "../constants/tools";
+import type { Tool } from "../config/tools";
import { Logo } from "../icons/Logo";
import { Heading } from "./Heading";
diff --git a/packages/website/src/components/ToolCard.astro b/packages/website/src/components/ToolCard.astro
index 143f55b26..0ea08ab35 100644
--- a/packages/website/src/components/ToolCard.astro
+++ b/packages/website/src/components/ToolCard.astro
@@ -1,7 +1,7 @@
---
import { alias } from "@blitzkit/core";
import { api } from "../api/dynamic";
-import type { Tool } from "../constants/tools";
+import type { Tool } from "../config/tools";
import { Heading } from "./Heading";
import { LinkI18n } from "./LinkI18n";
diff --git a/packages/website/src/components/ToolOpenGraph.astro b/packages/website/src/components/ToolOpenGraph.astro
index 42e0bc11b..1eb668e98 100644
--- a/packages/website/src/components/ToolOpenGraph.astro
+++ b/packages/website/src/components/ToolOpenGraph.astro
@@ -1,7 +1,7 @@
---
import { AstroSeo } from "@astrolib/seo";
import { api } from "../api/dynamic";
-import type { Tool } from "../constants/tools";
+import type { Tool } from "../config/tools";
interface Props {
tool: Tool;
diff --git a/packages/website/src/config/compare.ts b/packages/website/src/config/compare.ts
new file mode 100644
index 000000000..c37d5233b
--- /dev/null
+++ b/packages/website/src/config/compare.ts
@@ -0,0 +1,4 @@
+import { createRef } from "react";
+
+// One shared bar showing where a dragged tank would land
+export const compareInsertionMarker = createRef();
diff --git a/packages/website/src/constants/dialog.ts b/packages/website/src/config/dialog.ts
similarity index 100%
rename from packages/website/src/constants/dialog.ts
rename to packages/website/src/config/dialog.ts
diff --git a/packages/website/src/constants/embeds.ts b/packages/website/src/config/embeds.ts
similarity index 100%
rename from packages/website/src/constants/embeds.ts
rename to packages/website/src/config/embeds.ts
diff --git a/packages/website/src/constants/navbar.ts b/packages/website/src/config/navbar.ts
similarity index 100%
rename from packages/website/src/constants/navbar.ts
rename to packages/website/src/config/navbar.ts
diff --git a/packages/website/src/constants/skinNumber.ts b/packages/website/src/config/skinNumber.ts
similarity index 100%
rename from packages/website/src/constants/skinNumber.ts
rename to packages/website/src/config/skinNumber.ts
diff --git a/packages/website/src/config/tierList.ts b/packages/website/src/config/tierList.ts
new file mode 100644
index 000000000..18a3139d3
--- /dev/null
+++ b/packages/website/src/config/tierList.ts
@@ -0,0 +1,41 @@
+import { createRef } from "react";
+import type { Color } from "../ui/color";
+
+// Rows a fresh tier list starts with: S, then A onward
+export const tierListDefaultRowCount = 5;
+
+// Colors for the rows in order, before falling back to cycling every color
+export const tierListRowColors: Color[] = [
+ "tomato",
+ "orange",
+ "amber",
+ "green",
+ "blue",
+];
+
+// Every color a row can take; all read well under white text
+export const tierListColors: Color[] = [
+ "tomato",
+ "crimson",
+ "pink",
+ "plum",
+ "purple",
+ "violet",
+ "indigo",
+ "blue",
+ "cyan",
+ "teal",
+ "jade",
+ "green",
+ "grass",
+ "amber",
+ "orange",
+ "brown",
+ "bronze",
+];
+
+// Dragging scrolls up to here before scrolling by the screen's edges
+export const tierListTable = createRef();
+
+// One shared bar showing where a dragged tank would land
+export const tierListInsertionMarker = createRef();
diff --git a/packages/website/src/constants/tools.ts b/packages/website/src/config/tools.ts
similarity index 95%
rename from packages/website/src/constants/tools.ts
rename to packages/website/src/config/tools.ts
index 0dccb8695..11455c335 100644
--- a/packages/website/src/constants/tools.ts
+++ b/packages/website/src/config/tools.ts
@@ -1,4 +1,4 @@
-import { discordLink } from "../config/socials";
+import { discordLink } from "./socials";
export interface Tool {
id: string;
@@ -66,10 +66,9 @@ export const tools: Record = {
banner_background_position: "bottom",
},
tier_list: {
- disabled: true,
id: "tier_list",
slug: "tier-list",
- banner_background_position: "bottom",
+ banner_background_position: "top",
},
embed: {
id: "embed",
diff --git a/packages/website/src/core/blitzkit/generateTierListParams.ts b/packages/website/src/core/blitzkit/generateTierListParams.ts
deleted file mode 100644
index 7a870e4bc..000000000
--- a/packages/website/src/core/blitzkit/generateTierListParams.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type { TierList } from '../../stores/tierList';
-
-export function generateTierListParams(rows: TierList['rows']) {
- const params = new URLSearchParams();
-
- rows.forEach((row, index) => {
- params.set(`row-${index}`, row.tanks.join(','));
- });
-
- return params;
-}
diff --git a/packages/website/src/core/blitzkit/showInsertionMarker.ts b/packages/website/src/core/blitzkit/showInsertionMarker.ts
new file mode 100644
index 000000000..7ee313374
--- /dev/null
+++ b/packages/website/src/core/blitzkit/showInsertionMarker.ts
@@ -0,0 +1,24 @@
+import type { Vector2Tuple } from "three";
+
+// The full span of the slot; the marker pads itself inwards
+export interface InsertionMarkerPlacement {
+ position: Vector2Tuple;
+ height: number;
+}
+
+// Undefined hides the marker
+// TODO: go through core/ and dissolve every file
+export function showInsertionMarker(
+ marker: HTMLDivElement,
+ placement: InsertionMarkerPlacement | undefined,
+) {
+ if (placement === undefined) {
+ delete marker.dataset.visible;
+ return;
+ }
+
+ marker.dataset.visible = "true";
+ marker.style.left = `${placement.position[0]}px`;
+ marker.style.top = `${placement.position[1]}px`;
+ marker.style.height = `${placement.height}px`;
+}
diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro
index b9e5b9e06..0625440c5 100644
--- a/packages/website/src/layouts/BaseLayout.astro
+++ b/packages/website/src/layouts/BaseLayout.astro
@@ -7,7 +7,7 @@ import ColorScale from "../components/ColorScale.astro";
import NavbarCourse from "../components/NavbarCourse.astro";
import NavbarFine from "../components/NavbarFine.astro";
import SystemTheme from "../components/SystemTheme.astro";
-import type { Tool } from "../constants/tools";
+import type { Tool } from "../config/tools";
import type { LocaleAcceptorProps } from "../hooks/useLocale";
import type { Color } from "../ui/color";
diff --git a/packages/website/src/pages/404.astro b/packages/website/src/pages/404.astro
index db43151a6..6d039af28 100644
--- a/packages/website/src/pages/404.astro
+++ b/packages/website/src/pages/404.astro
@@ -8,7 +8,7 @@ import { Link } from "../components/Link";
import { LinkI18n } from "../components/LinkI18n";
import { Text } from "../components/Text";
import { discordLink } from "../config/socials";
-import { tools } from "../constants/tools";
+import { tools } from "../config/tools";
import BaseLayout from "../layouts/BaseLayout.astro";
// the 404 page is not locale-scoped, so it always renders in the default locale
diff --git a/packages/website/src/pages/[...chunk_api]/tools/[tool]/banners/[size].webp.ts b/packages/website/src/pages/[...chunk_api]/tools/[tool]/banners/[size].webp.ts
index 2594c4f5d..9beafc3c8 100644
--- a/packages/website/src/pages/[...chunk_api]/tools/[tool]/banners/[size].webp.ts
+++ b/packages/website/src/pages/[...chunk_api]/tools/[tool]/banners/[size].webp.ts
@@ -6,7 +6,7 @@ import {
TOOL_BANNER_HEIGHTS,
ToolBannerSize,
tools,
-} from "../../../../../constants/tools";
+} from "../../../../../config/tools";
import { getStaticPaths as _getStaticPaths } from "../../../_index";
interface ToolBannerProps {
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/auth/[provider]/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/auth/[provider]/_index.astro
index b2bfe8178..9e401097f 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/auth/[provider]/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/auth/[provider]/_index.astro
@@ -2,7 +2,7 @@
import { Flex, Heading, Text } from "@radix-ui/themes";
import { PageWrapper } from "../../../../../components/PageWrapper";
import { mixStaticPaths } from "../../../../../core/blitzkit/mixStaticPaths";
-import { tools } from "../../../../../constants/tools";
+import { tools } from "../../../../../config/tools";
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../../index.astro";
import { AUTH_PROVIDER_NAMES, AUTH_PROVIDERS, Authorize } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/avatars/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/avatars/_index.astro
index 61f735e56..61efb474c 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/avatars/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/avatars/_index.astro
@@ -1,7 +1,7 @@
---
import { Section } from "../../../../components/Section";
import ToolBanner from "../../../../components/ToolBanner.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.tsx
deleted file mode 100644
index 2e45b47d2..000000000
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import { createDefaultEnvironment } from "@blitzkit/core";
-import { useEffect } from "react";
-import { api } from "../../../../api/dynamic";
-import { CompareControls } from "../../../../components/CompareControls";
-import { CompareTable } from "../../../../components/CompareTable";
-import { EmptyState } from "../../../../components/EmptyState";
-import { Section } from "../../../../components/Section";
-import { tankToCompareMember } from "../../../../core/blitzkit/tankToCompareMember";
-import { withErrorWrapper } from "../../../../hocs/withErrorWrapper";
-import { withLocale } from "../../../../hocs/withLocale";
-import { useStrings } from "../../../../hooks/useStrings";
-import { CompareEphemeral } from "../../../../stores/compareEphemeral";
-import styles from "./_index.module.css";
-
-const [skillDefinitions, tankDefinitions] = await Promise.all([
- api.skills(),
- api.tanks(),
-]);
-
-export const Page = withLocale(
- withErrorWrapper(() => {
- CompareEphemeral.useInitialization(() =>
- createDefaultEnvironment(skillDefinitions),
- );
-
- return ;
- }),
-);
-
-function Content() {
- const strings = useStrings();
- const members = CompareEphemeral.use((state) => state.members);
-
- // Tanks come from the url on load
- useEffect(() => {
- const tanks = new URLSearchParams(window.location.search).get("tanks");
-
- if (tanks === null) return;
-
- CompareEphemeral.mutate((draft) => {
- draft.members = tanks
- .split(",")
- .map((id) => tankDefinitions.tanks[Number(id)])
- .filter((tank) => tank !== undefined)
- .map(tankToCompareMember);
- });
- }, []);
-
- // ...and are written back whenever they change
- useEffect(() => {
- const search = new URLSearchParams(window.location.search);
-
- search.set("tanks", members.map(({ state }) => state.tank).join(","));
-
- window.history.replaceState(
- {},
- "",
- `${window.location.pathname}?${search.toString()}`,
- );
- }, [members]);
-
- return (
- <>
-
-
- {members.length > 0 && (
-
- )}
-
- {members.length === 0 && (
-
- )}
- >
- );
-}
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/compare/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/compare/index.astro
index e14704b09..57c4b620c 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/compare/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/compare/index.astro
@@ -1,9 +1,12 @@
---
import ColorScale from "../../../../components/ColorScale.astro";
+import { CompareControls } from "../../../../components/CompareControls";
+import { CompareTable } from "../../../../components/CompareTable";
+import CompareURLManager from "../../../../components/CompareURLManager.astro";
+import { Section } from "../../../../components/Section";
import ToolBanner from "../../../../components/ToolBanner.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
-import { Page } from "./_index";
export { getStaticPaths } from "../index.astro";
@@ -15,8 +18,25 @@ const { locale } = Astro.props;
+
+
-
+
+
+
+
+
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/components.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/components.astro
index 6c9ca42fd..245f58bfc 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/components.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/components.astro
@@ -2,7 +2,7 @@
import { CheckIcon, StarFilledIcon } from "@radix-ui/react-icons";
import { Badge } from "../../../components/Badge";
import ColorScale from "../../../components/ColorScale.astro";
-import { tools } from "../../../constants/tools";
+import { tools } from "../../../config/tools";
import BaseLayout from "../../../layouts/BaseLayout.astro";
import type { Color } from "../../../ui/color";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/credits/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/credits/_index.astro
index 0193b018b..f62ecdd62 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/credits/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/credits/_index.astro
@@ -1,6 +1,6 @@
---
import CreditsPromo from "../../../../components/CreditsPromo.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import ToolLayout from "../../../../layouts/ToolLayout.astro";
export { getStaticPaths } from "../index.astro";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/docs/[directory]/[document]/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/docs/[directory]/[document]/_index.astro
index a617c1834..43f38aaf3 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/docs/[directory]/[document]/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/docs/[directory]/[document]/_index.astro
@@ -1,7 +1,7 @@
---
import { readFile } from "fs/promises";
import { mixStaticPaths } from "../../../../../../core/blitzkit/mixStaticPaths";
-import { tools } from "../../../../../../constants/tools";
+import { tools } from "../../../../../../config/tools";
import BaseLayout from "../../../../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../../../index.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/docs/patches/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/docs/patches/_index.astro
index 4de1b5f63..ebaeea47b 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/docs/patches/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/docs/patches/_index.astro
@@ -3,7 +3,7 @@ import { MagicWandIcon, StarFilledIcon } from "@radix-ui/react-icons";
import { Flex, Heading, Link } from "@radix-ui/themes";
import { compareVersions } from "compare-versions";
import { PageWrapper } from "../../../../../components/PageWrapper";
-import { tools } from "../../../../../constants/tools";
+import { tools } from "../../../../../config/tools";
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
export { getStaticPaths } from "../../index.astro";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/_index.tsx
index 5e33dc63a..413bef65c 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/_index.tsx
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/_index.tsx
@@ -31,7 +31,7 @@ import { Text } from "../../../../../components/Text";
import {
embedConfigurations,
extractEmbedConfigDefaults,
-} from "../../../../../constants/embeds";
+} from "../../../../../config/embeds";
import {
LocaleProvider,
type LocaleAcceptorProps,
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/host/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/host/_index.tsx
index 888fbf2c4..7e88e23e8 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/host/_index.tsx
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/host/_index.tsx
@@ -4,7 +4,7 @@ import {
embedConfigurations,
embedRenderers,
extractEmbedConfigDefaults,
-} from "../../../../../../constants/embeds";
+} from "../../../../../../config/embeds";
import {
LocaleProvider,
type LocaleAcceptorProps,
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/index.astro
index 413bc08cc..edb36716c 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/[embed]/index.astro
@@ -1,7 +1,7 @@
---
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
-import { embedConfigurations } from "../../../../../constants/embeds";
-import { tools } from "../../../../../constants/tools";
+import { embedConfigurations } from "../../../../../config/embeds";
+import { tools } from "../../../../../config/tools";
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../index.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/_index.tsx
index 72fd656f1..701339e3a 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/_index.tsx
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/_index.tsx
@@ -3,7 +3,7 @@ import { Link } from "../../../../components/Link";
import { LinkI18n } from "../../../../components/LinkI18n";
import { Text } from "../../../../components/Text";
import { discordLink } from "../../../../config/socials";
-import { embedConfigurations } from "../../../../constants/embeds";
+import { embedConfigurations } from "../../../../config/embeds";
import {
type LocaleAcceptorProps,
LocaleProvider,
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/index.astro
index 5e148a6c4..2cb288998 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/embed/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/embed/index.astro
@@ -1,6 +1,6 @@
---
import ToolBanner from "../../../../components/ToolBanner.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/guesser/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/guesser/index.astro
index 50b145c09..f818a16f4 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/guesser/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/guesser/index.astro
@@ -1,6 +1,6 @@
---
import ColorScale from "../../../../components/ColorScale.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro
index 020adc94c..e867923ce 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro
@@ -9,7 +9,7 @@ import HomeGames from "../../../components/HomeGames.astro";
import HomePlayers from "../../../components/HomePlayers.astro";
import HomeTanks from "../../../components/HomeTanks.astro";
import HomeTechnical from "../../../components/HomeTechnical.astro";
-import { tools, type Tool } from "../../../constants/tools";
+import { tools, type Tool } from "../../../config/tools";
import BaseLayout from "../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/mixer/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/mixer/index.astro
index b3dd72791..3a019c126 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/mixer/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/mixer/index.astro
@@ -1,6 +1,6 @@
---
import ToolOpenGraph from "../../../../components/ToolOpenGraph.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/performance/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/performance/index.astro
index b03d06c01..3912ee3f4 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/performance/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/performance/index.astro
@@ -1,7 +1,7 @@
---
import ColorScale from "../../../../components/ColorScale.astro";
import ToolBanner from "../../../../components/ToolBanner.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.astro
index b86aebfe2..81eb2f656 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.astro
@@ -1,6 +1,6 @@
---
import ToolOpenGraph from "../../../../components/ToolOpenGraph.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { Page } from "./_index.tsx";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.astro
index 3c20b8923..dc51cbe8b 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.astro
@@ -1,5 +1,5 @@
---
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import ToolLayout from "../../../../layouts/ToolLayout.astro";
import type { getStaticPaths } from "../index.astro";
import { Page } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/[slug]/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/[slug]/index.astro
index 29dbcd5db..8f0caa582 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/[slug]/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/[slug]/index.astro
@@ -3,7 +3,7 @@ import { api } from "../../../../../api/dynamic";
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
import ColorRanks from "../../../../../components/ColorRanks.astro";
import ColorScale from "../../../../../components/ColorScale.astro";
-import { tools } from "../../../../../constants/tools";
+import { tools } from "../../../../../config/tools";
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../index.astro";
import { Loadout, Sandbox } from "./_index";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/index.astro
index 8b1e8d196..5fe3a7b17 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/tanks/index.astro
@@ -7,7 +7,7 @@ import { TankSearchBar } from "../../../../components/TankSearchBar";
import { TankSearchFilters } from "../../../../components/TankSearchFilters";
import { TankSearchResults } from "../../../../components/TankSearchResults";
import ToolBanner from "../../../../components/ToolBanner.astro";
-import { tools } from "../../../../constants/tools";
+import { tools } from "../../../../config/tools";
import BaseLayout from "../../../../layouts/BaseLayout.astro";
export { getStaticPaths } from "../index.astro";
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/_index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/_index.astro
deleted file mode 100644
index cd30d4053..000000000
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/_index.astro
+++ /dev/null
@@ -1,13 +0,0 @@
----
-import { tools } from "../../../../constants/tools";
-import ToolLayout from "../../../../layouts/ToolLayout.astro";
-import { Page } from "./_index";
-
-export { getStaticPaths } from "../index.astro";
-
-const { locale } = Astro.props;
----
-
-
-
-
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/_index.tsx
deleted file mode 100644
index b74cd222d..000000000
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/_index.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { PageWrapper } from "../../../../components/PageWrapper";
-import { TankSearchFilters } from "../../../../components/TankSearchFilters";
-import { TierListControls } from "../../../../components/TierList/Controls";
-import { TierListTable } from "../../../../components/TierList/Table";
-import { TierListTiles } from "../../../../components/TierList/Tiles";
-import { URLManager } from "../../../../components/TierList/URLManager";
-import {
- LocaleProvider,
- type LocaleAcceptorProps,
-} from "../../../../hooks/useLocale";
-
-export function Page({ locale }: LocaleAcceptorProps) {
- return (
-
-
-
- );
-}
-
-function Content() {
- return (
-
-
-
-
-
-
-
- );
-}
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/index.astro
new file mode 100644
index 000000000..37e68168c
--- /dev/null
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/tier-list/index.astro
@@ -0,0 +1,45 @@
+---
+import ColorScale from "../../../../components/ColorScale.astro";
+import { ScrollerCurtains } from "../../../../components/ScrollerCurtains";
+import { Section } from "../../../../components/Section";
+import { TankSearchFilters } from "../../../../components/TankSearchFilters";
+import { TierListControls } from "../../../../components/TierListControls";
+import { TierListTable } from "../../../../components/TierListTable";
+import { TierListTiles } from "../../../../components/TierListTiles";
+import TierListURLManager from "../../../../components/TierListURLManager.astro";
+import ToolBanner from "../../../../components/ToolBanner.astro";
+import { tierListColors } from "../../../../config/tierList";
+import { tools } from "../../../../config/tools";
+import BaseLayout from "../../../../layouts/BaseLayout.astro";
+
+export { getStaticPaths } from "../index.astro";
+
+const { locale } = Astro.props;
+---
+
+{tierListColors.map((color) => (
+
+))}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/tools/embed/[embed]/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/tools/embed/[embed]/index.astro
index e1b726dda..8fdc0ec5d 100644
--- a/packages/website/src/pages/[...chunk_default]/[...locale]/tools/embed/[embed]/index.astro
+++ b/packages/website/src/pages/[...chunk_default]/[...locale]/tools/embed/[embed]/index.astro
@@ -1,6 +1,6 @@
---
import { mixStaticPaths } from "../../../../../../astro/mixStaticPaths";
-import { embedConfigurations } from "../../../../../../constants/embeds";
+import { embedConfigurations } from "../../../../../../config/embeds";
import LegacyRedirect from "../../../../../../layouts/LegacyRedirect.astro";
import { getStaticPaths as _getStaticPaths } from "../index.astro";
diff --git a/packages/website/src/pages/[...chunk_models_legendary]/[id]/skins/[skin].glb.ts b/packages/website/src/pages/[...chunk_models_legendary]/[id]/skins/[skin].glb.ts
index e82374fbd..df306de3a 100644
--- a/packages/website/src/pages/[...chunk_models_legendary]/[id]/skins/[skin].glb.ts
+++ b/packages/website/src/pages/[...chunk_models_legendary]/[id]/skins/[skin].glb.ts
@@ -19,7 +19,7 @@ import type { APIContext } from "astro";
import type { Vector3Tuple, Vector4Tuple } from "three";
import { api } from "../../../../api/dynamic";
import { mixStaticPaths } from "../../../../astro/mixStaticPaths";
-import { SKIN_NUMBER } from "../../../../constants/skinNumber";
+import { SKIN_NUMBER } from "../../../../config/skinNumber";
import { switcherStates } from "../../../../core/blitzkit/switcherStates";
import { vfs } from "../../../../core/blitzkit/vfs";
import {
diff --git a/packages/website/src/stores/compareEphemeral.ts b/packages/website/src/stores/compareEphemeral.ts
index d06a0e5a4..fdab2df19 100644
--- a/packages/website/src/stores/compareEphemeral.ts
+++ b/packages/website/src/stores/compareEphemeral.ts
@@ -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({
+ 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) {
diff --git a/packages/website/src/stores/embedState/utilities.ts b/packages/website/src/stores/embedState/utilities.ts
index eed332bde..55cb553c0 100644
--- a/packages/website/src/stores/embedState/utilities.ts
+++ b/packages/website/src/stores/embedState/utilities.ts
@@ -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";
diff --git a/packages/website/src/stores/tierList.ts b/packages/website/src/stores/tierList.ts
index 8c323b5b8..c85246438 100644
--- a/packages/website/src/stores/tierList.ts
+++ b/packages/website/src/stores/tierList.ts
@@ -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;
+ 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({
- dragging: false,
- rows: tierListRows.map((row) => ({ name: row.name, tanks: [] })),
- placedTanks: new Set(),
+ rows: Array.from({ length: tierListDefaultRowCount }, (_, index) =>
+ createTierListRow(index),
+ ),
});
-
-enableMapSet();