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}