Fix Hero Shot link 404 Closes #1477

This commit is contained in:
Kalle 2023-09-16 11:33:22 +03:00
parent b804d98a50
commit 9de50b525e
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,7 @@ import { Popover } from "./Popover";
import { InfoIcon } from "./icons/Info";
import { LockIcon } from "./icons/Lock";
import type { BuildWeaponWithTop500Info } from "~/features/builds";
import { altWeaponIdToId } from "~/modules/in-game-lists/weapon-ids";
interface BuildProps {
build: Pick<
@ -231,9 +232,12 @@ export function BuildCard({ build, owner, canEdit = false }: BuildProps) {
function RoundWeaponImage({ weapon }: { weapon: BuildWeaponWithTop500Info }) {
const { weaponSplId, maxPower, minRank } = weapon;
const normalizedWeaponSplId = altWeaponIdToId.get(weaponSplId) ?? weaponSplId;
const { t } = useTranslation(["weapons"]);
const slug = mySlugify(t(`weapons:MAIN_${weaponSplId}`, { lng: "en" }));
const slug = mySlugify(
t(`weapons:MAIN_${normalizedWeaponSplId}`, { lng: "en" }),
);
const isTop500 = typeof maxPower === "number" && typeof minRank === "number";

View File

@ -58,6 +58,7 @@ export const mainWeaponIds = weaponCategories
.sort((a, b) => a - b);
export const weaponIdToAltId = new Map<MainWeaponId, MainWeaponId>([[40, 45]]);
export const altWeaponIdToId = new Map<MainWeaponId, MainWeaponId>([[45, 40]]);
const altWeaponIds = new Set(weaponIdToAltId.values());
export const weaponIdIsNotAlt = (weaponId: MainWeaponId) =>