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
+26 -19
+26 -19
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,23 +84,29 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
}} }}
> >
<Flex align="center" gap="1"> <Flex align="center" gap="1">
{useEmbedState('cardTitleClassIcon') && tank !== null && ( {useEmbedState('cardTitleClassIcon') &&
<> tank !== null &&
{tank.class === TankClass.LIGHT && ( tank !== undefined && (
<ClassLight width="1em" height="1em" /> <>
)} {tank.class === TankClass.LIGHT && (
{tank.class === TankClass.MEDIUM && ( <ClassLight width="1em" height="1em" />
<ClassMedium width="1em" height="1em" /> )}
)} {tank.class === TankClass.MEDIUM && (
{tank.class === TankClass.HEAVY && ( <ClassMedium width="1em" height="1em" />
<ClassHeavy width="1em" height="1em" /> )}
)} {tank.class === TankClass.HEAVY && (
{tank.class === TankClass.TANK_DESTROYER && ( <ClassHeavy width="1em" height="1em" />
<ClassTankDestroyer width="1em" height="1em" /> )}
)} {tank.class === TankClass.TANK_DESTROYER && (
</> <ClassTankDestroyer width="1em" height="1em" />
)}{' '} )}
{tank === null ? 'Total' : tank.name} </>
)}{' '}
{tank === null
? 'Total'
: tank === undefined
? `Unknown tank`
: tank.name}
</Flex> </Flex>
</Text> </Text>
</Flex> </Flex>