fix: unknown tanks

This commit is contained in:
TrèsAbhi committed 2024-11-04 10:38:48 -06:00
1 parent 86eecd202a
commit f1767bf5d7
1 file changed
+11 -4
+11 -4
View File
@@ -41,7 +41,7 @@ export function BreakdownEmbedWrapper({
} }
interface BreakdownEmbedCardProps { interface BreakdownEmbedCardProps {
tank: TankDefinition | null; tank: TankDefinition | null | undefined;
} }
export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) { export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
@@ -71,7 +71,8 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
style: style:
tank === null tank === null
? undefined ? undefined
: tank.type === TankType.RESEARCHABLE || : tank === undefined ||
tank.type === TankType.RESEARCHABLE ||
!useEmbedState('cardTitleTypeColor') !useEmbedState('cardTitleTypeColor')
? undefined ? undefined
: { : {
@@ -83,7 +84,9 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
}} }}
> >
<Flex align="center" gap="1"> <Flex align="center" gap="1">
{useEmbedState('cardTitleClassIcon') && tank !== null && ( {useEmbedState('cardTitleClassIcon') &&
tank !== null &&
tank !== undefined && (
<> <>
{tank.class === TankClass.LIGHT && ( {tank.class === TankClass.LIGHT && (
<ClassLight width="1em" height="1em" /> <ClassLight width="1em" height="1em" />
@@ -99,7 +102,11 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
)} )}
</> </>
)}{' '} )}{' '}
{tank === null ? 'Total' : tank.name} {tank === null
? 'Total'
: tank === undefined
? `Unknown tank`
: tank.name}
</Flex> </Flex>
</Text> </Text>
</Flex> </Flex>