Show fully charger shots for chargers in PerInkTankGrid Closes #1545

This commit is contained in:
Kalle
2024-04-07 14:07:20 +03:00
parent b58fbbec62
commit ef14e69f18

View File

@@ -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<typeof fullInkTankOptions>) {
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)[][]) {