From ef14e69f18ee70291b9915e1e159a93cf1bc6480 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 7 Apr 2024 14:07:20 +0300 Subject: [PATCH] Show fully charger shots for chargers in PerInkTankGrid Closes #1545 --- .../build-analyzer/components/PerInkTankGrid.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/features/build-analyzer/components/PerInkTankGrid.tsx b/app/features/build-analyzer/components/PerInkTankGrid.tsx index 4fc8609f5..8e909291d 100644 --- a/app/features/build-analyzer/components/PerInkTankGrid.tsx +++ b/app/features/build-analyzer/components/PerInkTankGrid.tsx @@ -7,6 +7,7 @@ import * as React from "react"; import { useTranslation } from "react-i18next"; import { weaponParams } from "../core/utils"; import clsx from "clsx"; +import type { FullInkTankOption } from "../analyzer-types"; interface PerInkTankGridProps { weaponSplId: MainWeaponId; @@ -253,7 +254,16 @@ function inkTankOptionsWhenNSubsUsed({ subWeaponParams, }); - return options.find((o) => o.subsUsed === subsUsed); + return optionsToPreferred(options).find((o) => o.subsUsed === subsUsed); +} + +const PREFERRED_KEYS: FullInkTankOption["type"][] = ["FULL_CHARGE"]; +function optionsToPreferred(options: ReturnType) { + if (!options.some((option) => PREFERRED_KEYS.includes(option.type))) { + return options; + } + + return options.filter((option) => PREFERRED_KEYS.includes(option.type)); } function addGridColors(grid: ("N/A" | ShotCellData)[][]) {