From f1767bf5d74a1674022a5a71cf2664e8096fafeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:38:48 -0600 Subject: [PATCH] fix: unknown tanks --- .../website/src/components/TanksEmbed.tsx | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/packages/website/src/components/TanksEmbed.tsx b/packages/website/src/components/TanksEmbed.tsx index 76e6bbafb..5c6103eaa 100644 --- a/packages/website/src/components/TanksEmbed.tsx +++ b/packages/website/src/components/TanksEmbed.tsx @@ -41,7 +41,7 @@ export function BreakdownEmbedWrapper({ } interface BreakdownEmbedCardProps { - tank: TankDefinition | null; + tank: TankDefinition | null | undefined; } export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) { @@ -71,7 +71,8 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) { style: tank === null ? undefined - : tank.type === TankType.RESEARCHABLE || + : tank === undefined || + tank.type === TankType.RESEARCHABLE || !useEmbedState('cardTitleTypeColor') ? undefined : { @@ -83,23 +84,29 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) { }} > - {useEmbedState('cardTitleClassIcon') && tank !== null && ( - <> - {tank.class === TankClass.LIGHT && ( - - )} - {tank.class === TankClass.MEDIUM && ( - - )} - {tank.class === TankClass.HEAVY && ( - - )} - {tank.class === TankClass.TANK_DESTROYER && ( - - )} - - )}{' '} - {tank === null ? 'Total' : tank.name} + {useEmbedState('cardTitleClassIcon') && + tank !== null && + tank !== undefined && ( + <> + {tank.class === TankClass.LIGHT && ( + + )} + {tank.class === TankClass.MEDIUM && ( + + )} + {tank.class === TankClass.HEAVY && ( + + )} + {tank.class === TankClass.TANK_DESTROYER && ( + + )} + + )}{' '} + {tank === null + ? 'Total' + : tank === undefined + ? `Unknown tank` + : tank.name}