fix: edge case for unplayed tanks

This commit is contained in:
TresAbhi committed 2023-05-30 17:31:12 +00:00
1 parent 831300cf69
commit 65b2eb8beb
3 files changed
+19 -6

No files matched your search

+6 -4
View File
@@ -18,7 +18,9 @@ import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
import resolveTankId from '../core/blitz/resolveTankId.js';
import getPeriodNow from '../core/blitzstars/getPeriodNow.js';
import getPeriodicStart from '../core/blitzstars/getPeriodStart.js';
import getTankStatsOverTime from '../core/blitzstars/getTankStatsOverTime.js';
import getTankStatsOverTime, {
emptyAllStats,
} from '../core/blitzstars/getTankStatsOverTime.js';
import { tankopedia } from '../core/blitzstars/tankopedia.js';
import cmdName from '../core/interaction/cmdName.js';
import addStatPeriodChoices, {
@@ -64,9 +66,9 @@ export default {
let stats: AllStats;
if (period === 'career') {
stats = tankStats[id].find(
(stats) => stats.tank_id === Number(tank),
)!.all;
stats =
tankStats[id].find((stats) => stats.tank_id === Number(tank))?.all ??
emptyAllStats;
} else {
stats = (
await getTankStatsOverTime(
@@ -42,7 +42,13 @@ export function RowStat({ name, value, career, delta }: RowStatProps) {
/>
)}
<span style={{ color: theme.colors.textHighContrast, fontSize: 16, fontWeight: 'bold' }}>
<span
style={{
color: theme.colors.textHighContrast,
fontSize: 16,
fontWeight: 'bold',
}}
>
{value}
</span>
</div>
+6 -1
View File
@@ -1,3 +1,4 @@
import isDev from '../core/process/isDev.js';
import { theme } from '../stitches.config.js';
export interface TitleBarProps {
@@ -75,7 +76,11 @@ export default function TitleBar({
<img
style={{ width: 64, height: 64 }}
src="https://i.imgur.com/35phKIu.png"
src={
isDev()
? 'https://i.imgur.com/j6TItdy.png'
: 'https://i.imgur.com/pP6RN0x.png'
}
/>
</div>
);