fix: all commands now work with a lack of tankopedia entries

This commit is contained in:
TresAbhi committed 2023-07-07 01:08:00 +00:00
1 parent f907c79d68
commit ca208e44a1
12 files changed
+59 -26

No files matched your search

+3 -1
View File
@@ -69,7 +69,9 @@ export default function AllStatsOverview({
>
<WN8SurroundingStat
label="Tier"
value={supplementaryStats.tier.toFixed(2)}
value={
supplementaryStats.tier ? supplementaryStats.tier.toFixed(2) : '--'
}
/>
<WN8SurroundingStat
label="Survival"
+4 -1
View File
@@ -40,7 +40,10 @@ export default function GenericAllStats({
['Wins', stats.wins],
['Losses', stats.losses],
['Average damage', (stats.damage_dealt / stats.battles).toFixed(0)],
['Average tier', supplementaryStats?.tier.toFixed(2)],
[
'Average tier',
supplementaryStats?.tier ? supplementaryStats?.tier.toFixed(2) : '--',
],
['Average XP', (stats.xp / stats.battles).toFixed(0)],
['Average shots', (stats.shots / stats.battles).toFixed(2)],
['Average hits', (stats.hits / stats.battles).toFixed(2)],
+5 -2
View File
@@ -2,7 +2,7 @@ import { TANK_ICONS, TankType } from '../../../core/blitz/tankopedia.js';
export interface ItemProps {
icon?: string;
type: TankType;
type?: TankType;
name: string;
}
@@ -23,7 +23,10 @@ export function Item({ icon, type, name }: ItemProps) {
{icon && <img src={icon} style={{ flex: 1, objectFit: 'contain' }} />}
<div style={{ display: 'flex', margin: 'auto', gap: 4 }}>
<img src={TANK_ICONS[type]} style={{ width: 14, height: 14 }} />
{type && (
<img src={TANK_ICONS[type]} style={{ width: 14, height: 14 }} />
)}
<span
style={{ fontSize: 16, textAlign: 'center', whiteSpace: 'nowrap' }}
>