From 71e40a0113e2b16df8b93dc64612c89e76646691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 30 Dec 2025 20:30:18 -0600 Subject: [PATCH] feat: tank types --- .../TankSearch/components/FilterControl.tsx | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/packages/website/src/components/TankSearch/components/FilterControl.tsx b/packages/website/src/components/TankSearch/components/FilterControl.tsx index 979cb2621..38d64521e 100644 --- a/packages/website/src/components/TankSearch/components/FilterControl.tsx +++ b/packages/website/src/components/TankSearch/components/FilterControl.tsx @@ -3,6 +3,8 @@ import { GunDefinition, ShellType, TANK_CLASSES, + TANK_TYPES, + TankType, TIER_ROMAN_NUMERALS, } from "@blitzkit/core"; import { TrashIcon } from "@radix-ui/react-icons"; @@ -16,6 +18,7 @@ import { classIcons } from "../../ClassIcon"; import { GunAutoloaderIcon } from "../../GunAutoloaderIcon"; import { GunAutoreloaderIcon } from "../../GunAutoreloaderIcon"; import { GunRegularIcon } from "../../GunRegularIcon"; +import { ResearchedIcon } from "../../ResearchedIcon"; const gameDefinitions = await awaitableGameDefinitions; @@ -35,6 +38,12 @@ const GUN_TYPE_ICONS: Record< auto_reloader: GunAutoreloaderIcon, }; +const TANK_TYPE_COLORS: Record = { + [TankType.RESEARCHABLE]: "gray", + [TankType.PREMIUM]: "amber", + [TankType.COLLECTOR]: "blue", +}; + const GUN_TYPES = Object.keys( GUN_TYPE_ICONS ) as (keyof typeof GUN_TYPE_ICONS)[]; @@ -49,6 +58,7 @@ export function FilterControl() { + @@ -392,3 +402,91 @@ function GunTypeFilter() { ); } + +function TypeFilter() { + const { strings } = useLocale(); + const rawTypes = TankFilters.use((state) => state.types); + const types = rawTypes.length === 0 ? TANK_TYPES : rawTypes; + + return ( + + + + + + + {TANK_TYPES.map((tankType) => { + const selected = rawTypes.includes(tankType); + + return ( + { + event.preventDefault(); + + TankFilters.mutate((draft) => { + if (selected) { + draft.types = draft.types.filter((c) => c !== tankType); + } else { + draft.types = [...draft.types, tankType]; + } + }); + }} + checked={selected} + key={tankType} + > + + + {strings.common.tree_type[tankType]} + + ); + })} + + + + { + event.preventDefault(); + + TankFilters.mutate((draft) => { + draft.types = []; + }); + }} + > + + Clear + + + + ); +}