diff --git a/packages/website/src/components/TankopediaLoadout/index.tsx b/packages/website/src/components/TankopediaLoadout/index.tsx index 80746c99f..c31f29da8 100644 --- a/packages/website/src/components/TankopediaLoadout/index.tsx +++ b/packages/website/src/components/TankopediaLoadout/index.tsx @@ -1,4 +1,5 @@ import { useProtagonist } from "../../hooks/useProtagonist"; +import { hasUpgrades } from "../../tankopedia/hasUpgrades"; import type { ComputedCharacteristics } from "../../types/characteristics"; interface TankopediaLoadoutProps { @@ -7,10 +8,7 @@ interface TankopediaLoadoutProps { export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) { const tank = useProtagonist(); - - const showModules = tank.tank!.upgrade_lines.some( - (line) => line.stages.length > 1 || isAlternativeLine(line.name), - ); + const showModules = hasUpgrades(tank); return ( <> diff --git a/packages/website/src/tankopedia/hasUpgrades.ts b/packages/website/src/tankopedia/hasUpgrades.ts new file mode 100644 index 000000000..267bf2630 --- /dev/null +++ b/packages/website/src/tankopedia/hasUpgrades.ts @@ -0,0 +1,10 @@ +import type { TankDefinition } from "@blitzkit/core"; + +export function hasUpgrades(tank: TankDefinition) { + return ( + tank.tracks.length > 1 || + tank.engines.length > 1 || + tank.turrets.length > 1 || + tank.turrets.some((turret) => turret.guns.length > 1) + ); +}