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

+4
View File
@@ -0,0 +1,4 @@
import { createRef } from "react";
// One shared bar showing where a dragged tank would land
export const compareInsertionMarker = createRef<HTMLDivElement>();
+3
View File
@@ -0,0 +1,3 @@
import { NAVBAR_HEIGHT } from "./navbar";
export const DIALOG_MAX_HEIGHT = `calc(100svh - 2 * (${NAVBAR_HEIGHT}px + var(--space-4) + var(--space-2)))`;
+107
View File
@@ -0,0 +1,107 @@
import { type CompositeStatsKey } from "@blitzkit/core";
import { grayA, grayDark, grayDarkA } from "@radix-ui/colors";
import type { ReactNode } from "react";
import {
BreakdownPreview,
BreakdownRenderer,
compositeStatsKeysOptions,
} from "../components/Embeds/breakdown";
import type {
EmbedConfig,
ExtractEmbedConfigTypes,
} from "../stores/embedState";
import { EmbedItemType } from "../stores/embedState/constants";
export const breakdownConfig = {
width: { type: EmbedItemType.Slider, default: 320, min: 128, max: 640 },
height: { type: EmbedItemType.Slider, default: 492, min: 128, max: 1024 },
show_total: { type: EmbedItemType.Boolean, default: true, pad: true },
list_gap: { type: EmbedItemType.Size, default: "3" },
list_max_tanks: {
type: EmbedItemType.Slider,
default: 4,
min: 0,
max: 8,
pad: true,
},
card_radius: { type: EmbedItemType.Radius, default: "2" },
card_header_background_color: {
type: EmbedItemType.Color,
default: grayDarkA.grayA3,
},
card_header_padding: { type: EmbedItemType.Size, default: "2" },
card_title: {
type: EmbedItemType.RichText,
default: { color: grayDark.gray12, weight: "bold", size: "4" },
},
card_title_type_color: { type: EmbedItemType.Boolean, default: true },
card_title_class_icon: { type: EmbedItemType.Boolean, default: true },
card_body_background_color: {
type: EmbedItemType.Color,
default: grayA.grayA11,
},
card_body_padding: {
type: EmbedItemType.Size,
default: "3",
pad: true,
},
column_gap: { type: EmbedItemType.Size, default: "1" },
column_value: {
type: EmbedItemType.RichText,
default: { color: grayDark.gray12, size: "4", weight: "regular" },
},
column_label: {
type: EmbedItemType.RichText,
default: { color: grayDark.gray11, size: "4", weight: "regular" },
pad: true,
},
column_1: {
type: EmbedItemType.Enum,
default: "cumulative_battles" satisfies CompositeStatsKey,
options: compositeStatsKeysOptions,
},
column_2: {
type: EmbedItemType.Enum,
default: "normalized_wins" satisfies CompositeStatsKey,
options: compositeStatsKeysOptions,
},
column_3: {
type: EmbedItemType.Enum,
default: "cumulative_wn8" satisfies CompositeStatsKey,
options: compositeStatsKeysOptions,
},
column_4: {
type: EmbedItemType.Enum,
default: "normalized_damage_dealt" satisfies CompositeStatsKey,
options: compositeStatsKeysOptions,
},
column_1_custom_label: { type: EmbedItemType.String, default: "" },
column_2_custom_label: { type: EmbedItemType.String, default: "" },
column_3_custom_label: { type: EmbedItemType.String, default: "" },
column_4_custom_label: { type: EmbedItemType.String, default: "" },
} satisfies EmbedConfig;
export const embedConfigurations = {
breakdown: breakdownConfig,
} satisfies Record<string, EmbedConfig>;
export const embedPreviews = {
breakdown: BreakdownPreview,
} satisfies Record<string, () => ReactNode>;
export function extractEmbedConfigDefaults<Config extends EmbedConfig>(
config: Config
) {
return Object.fromEntries(
Object.entries(config).map(([key, value]) => [key, value.default])
) as ExtractEmbedConfigTypes<Config>;
}
export const embedRenderers = {
breakdown: BreakdownRenderer,
} satisfies Record<string, () => ReactNode>;
+1
View File
@@ -0,0 +1 @@
export const NAVBAR_HEIGHT = 48;
@@ -0,0 +1 @@
export const SKIN_NUMBER = "0417";
+41
View File
@@ -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<HTMLTableSectionElement>();
// One shared bar showing where a dragged tank would land
export const tierListInsertionMarker = createRef<HTMLDivElement>();
+110
View File
@@ -0,0 +1,110 @@
import { discordLink } from "./socials";
export interface Tool {
id: string;
slug?: string;
href?: string;
disabled?: boolean;
banner_background_position: "top" | "center" | "bottom";
hide_in_navbar?: boolean;
hide_in_navbar_desktop?: boolean;
}
export const tools: Record<string, Tool> = {
home: {
id: "home",
slug: "",
banner_background_position: "center",
hide_in_navbar_desktop: true,
},
tanks: {
id: "tanks",
banner_background_position: "top",
},
players: {
disabled: true,
id: "players",
banner_background_position: "top",
},
compare: {
id: "compare",
banner_background_position: "bottom",
},
performance: {
id: "performance",
banner_background_position: "bottom",
},
playlist: {
disabled: true,
id: "playlist",
banner_background_position: "bottom",
},
mixer: {
id: "mixer",
banner_background_position: "bottom",
},
guesser: {
id: "guesser",
banner_background_position: "bottom",
},
avatars: {
disabled: true,
id: "avatars",
banner_background_position: "bottom",
},
backgrounds: {
disabled: true,
id: "backgrounds",
banner_background_position: "bottom",
},
session: {
disabled: true,
id: "session",
banner_background_position: "bottom",
},
tier_list: {
id: "tier_list",
slug: "tier-list",
banner_background_position: "top",
},
embed: {
id: "embed",
banner_background_position: "top",
},
more: {
id: "more",
href: discordLink,
banner_background_position: "bottom",
},
api: {
disabled: true,
id: "api",
banner_background_position: "bottom",
},
changelogs: {
disabled: true,
id: "changelogs",
banner_background_position: "bottom",
},
credits: {
disabled: true,
id: "credits",
banner_background_position: "center",
hide_in_navbar: true,
},
};
export enum ToolBannerSize {
Thumbnail = "thumbnail",
Poster = "poster",
Full = "full",
}
export const TOOL_BANNER_HEIGHTS: Record<ToolBannerSize, number | null> = {
[ToolBannerSize.Thumbnail]: 128,
[ToolBannerSize.Poster]: 480 * 1.5,
[ToolBannerSize.Full]: null,
};