From f697f94bd53c5286afad235fc87bb80f8e6b8d37 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Sun, 17 May 2026 13:29:03 -0500 Subject: [PATCH] equipment selection --- .../TankopediaLoadout/index.module.css | 4 + .../components/TankopediaLoadout/index.tsx | 111 ++++++++++++++---- 2 files changed, 89 insertions(+), 26 deletions(-) diff --git a/packages/website-ue/src/components/TankopediaLoadout/index.module.css b/packages/website-ue/src/components/TankopediaLoadout/index.module.css index 1cd75f97c..dedf03720 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.module.css +++ b/packages/website-ue/src/components/TankopediaLoadout/index.module.css @@ -36,6 +36,10 @@ border-top-left-radius: 0; border-bottom-left-radius: 0; } + + &[data-selected="true"] { + z-index: 1; + } } } } diff --git a/packages/website-ue/src/components/TankopediaLoadout/index.tsx b/packages/website-ue/src/components/TankopediaLoadout/index.tsx index 18cbb1847..6f80e4ffc 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.tsx +++ b/packages/website-ue/src/components/TankopediaLoadout/index.tsx @@ -1,4 +1,5 @@ import { romanize } from "@blitzkit/core"; +import type { BlitzStaticEquipmentPresetComponent_EquipmentSlot } from "@protos/blitz_static_equipment_preset_component"; import { Grade } from "@protos/blitz_static_standard_grades_enum"; import type { StandardPrice } from "@protos/blitz_static_standard_price"; import type { UpgradeLine } from "@protos/blitz_static_tank_upgrade_line"; @@ -42,7 +43,6 @@ function Equipment() { tank.tank!.equipment_preset_catalog_id, tank.tank!.equipment_price_preset_catalog_id, ); - const equipmentState = Tankopedia.use((state) => state.protagonist.equipment); return (
@@ -51,36 +51,95 @@ function Equipment() {
- {chunk(equipment.preset.slots, equipmentColumns).map((chunk, index) => { - return ( -
- {chunk.map((slot, index) => { - return ( -
- {slot.options_catalog_i_ds.map((id) => { - return ( - - ); - })} -
- ); - })} -
- ); - })} + {chunk(equipment.preset.slots, equipmentColumns).map((chunk, index) => ( + + ))}
); } +interface EquipmentRowProps { + chunk: BlitzStaticEquipmentPresetComponent_EquipmentSlot[]; + rowIndex: number; +} + +function EquipmentRow({ chunk, rowIndex }: EquipmentRowProps) { + return ( +
+ {chunk.map((slot, index) => ( + + ))} +
+ ); +} + +interface EquipmentSlotProps { + slot: BlitzStaticEquipmentPresetComponent_EquipmentSlot; + rowIndex: number; + columnIndex: number; +} + +function EquipmentSlot({ slot, rowIndex, columnIndex }: EquipmentSlotProps) { + return ( +
+ {slot.options_catalog_i_ds.map((id, index) => ( + + ))} +
+ ); +} + +interface EquipmentOptionProps { + optionIndex: number; + rowIndex: number; + columnIndex: number; +} + +function EquipmentOption({ + optionIndex, + rowIndex, + columnIndex, +}: EquipmentOptionProps) { + const equipmentIndex = rowIndex * equipmentColumns + columnIndex; + const isSelected = Tankopedia.use( + (state) => + equipmentIndex in state.protagonist.equipment && + state.protagonist.equipment[equipmentIndex] === optionIndex, + ); + + return ( + + ); +} + function Modules() { const strings = useStrings(); const tank = useProtagonist();