mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
fix: types
This commit is contained in:
1 parent
8a2dc24f7e
commit
f8f88ff8f2
6 files changed
+13
-21
No files matched your search
@@ -231,7 +231,7 @@ if (allTargets || targets?.includes('definitions')) {
|
|||||||
.split(' ')
|
.split(' ')
|
||||||
.map(Number) as [number, number],
|
.map(Number) as [number, number],
|
||||||
name: strings[gun.userString] ?? gunKey.replaceAll('_', ' '),
|
name: strings[gun.userString] ?? gunKey.replaceAll('_', ' '),
|
||||||
tier: gun.level,
|
tier: gun.level as Tier,
|
||||||
shells: gunShells,
|
shells: gunShells,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ if (allTargets || targets?.includes('definitions')) {
|
|||||||
turretKey
|
turretKey
|
||||||
.replaceAll('_', ' ')
|
.replaceAll('_', ' ')
|
||||||
.replace(/^(Turret ([0-9] )?)+/, ''),
|
.replace(/^(Turret ([0-9] )?)+/, ''),
|
||||||
tier: turret.level,
|
tier: turret.level as Tier,
|
||||||
yaw: (typeof turret.yawLimits === 'string'
|
yaw: (typeof turret.yawLimits === 'string'
|
||||||
? turret.yawLimits
|
? turret.yawLimits
|
||||||
: turret.yawLimits.at(-1)!
|
: turret.yawLimits.at(-1)!
|
||||||
|
|||||||
@@ -299,9 +299,7 @@ export default function SessionPage() {
|
|||||||
key={stats.tank_id}
|
key={stats.tank_id}
|
||||||
minimized={!session.showCareer}
|
minimized={!session.showCareer}
|
||||||
title={
|
title={
|
||||||
tankDefinitions?.name_short ??
|
tankDefinitions?.name ?? `Unknown tank ${stats.tank_id}`
|
||||||
tankDefinitions?.name ??
|
|
||||||
`Unknown tank ${stats.tank_id}`
|
|
||||||
}
|
}
|
||||||
type="tank"
|
type="tank"
|
||||||
tankType={tankDefinitions?.type}
|
tankType={tankDefinitions?.type}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { AllStats, getAccountInfo } from '../core/blitz/getAccountInfo';
|
|||||||
import { getClanAccountInfo } from '../core/blitz/getClanAccountInfo';
|
import { getClanAccountInfo } from '../core/blitz/getClanAccountInfo';
|
||||||
import getTankStats from '../core/blitz/getTankStats';
|
import getTankStats from '../core/blitz/getTankStats';
|
||||||
import getTreeType from '../core/blitz/getTreeType';
|
import getTreeType from '../core/blitz/getTreeType';
|
||||||
import resolveTankName from '../core/blitz/resolveTankName';
|
|
||||||
import { tankDefinitions } from '../core/blitzkrieg/definitions/tanks';
|
import { tankDefinitions } from '../core/blitzkrieg/definitions/tanks';
|
||||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||||
@@ -195,7 +194,7 @@ async function render(
|
|||||||
type="tank"
|
type="tank"
|
||||||
tankType={tankDefinition?.type}
|
tankType={tankDefinition?.type}
|
||||||
treeType={tankDefinition ? await getTreeType(id) : undefined}
|
treeType={tankDefinition ? await getTreeType(id) : undefined}
|
||||||
title={await resolveTankName(id)}
|
title={awaitedTankDefinitions[id].name}
|
||||||
stats={[
|
stats={[
|
||||||
{
|
{
|
||||||
title: 'Battles',
|
title: 'Battles',
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { getAccountInfo } from '../core/blitz/getAccountInfo';
|
|||||||
import { getClanAccountInfo } from '../core/blitz/getClanAccountInfo';
|
import { getClanAccountInfo } from '../core/blitz/getClanAccountInfo';
|
||||||
import getTankStats from '../core/blitz/getTankStats';
|
import getTankStats from '../core/blitz/getTankStats';
|
||||||
import getTreeType from '../core/blitz/getTreeType';
|
import getTreeType from '../core/blitz/getTreeType';
|
||||||
import resolveTankName from '../core/blitz/resolveTankName';
|
|
||||||
import {
|
import {
|
||||||
BlitzkriegTankDefinition,
|
BlitzkriegTankDefinition,
|
||||||
TIER_ROMAN_NUMERALS,
|
TIER_ROMAN_NUMERALS,
|
||||||
@@ -96,7 +95,7 @@ export const ownedTanksCommand: CommandRegistry = {
|
|||||||
leftColumn.map(async (tank) => (
|
leftColumn.map(async (tank) => (
|
||||||
<Tanks.Item
|
<Tanks.Item
|
||||||
key={tank.id}
|
key={tank.id}
|
||||||
name={await resolveTankName(tank.id)}
|
name={tank.name}
|
||||||
tankType={tank.type}
|
tankType={tank.type}
|
||||||
image={tankIcon(tank.id)}
|
image={tankIcon(tank.id)}
|
||||||
treeType={await getTreeType(tank.id)}
|
treeType={await getTreeType(tank.id)}
|
||||||
@@ -109,7 +108,7 @@ export const ownedTanksCommand: CommandRegistry = {
|
|||||||
rightColumn.map(async (tank) => (
|
rightColumn.map(async (tank) => (
|
||||||
<Tanks.Item
|
<Tanks.Item
|
||||||
key={tank.id}
|
key={tank.id}
|
||||||
name={await resolveTankName(tank.id)}
|
name={tank.name}
|
||||||
tankType={tank.type}
|
tankType={tank.type}
|
||||||
image={tankIcon(tank.id)}
|
image={tankIcon(tank.id)}
|
||||||
treeType={await getTreeType(tank.id)}
|
treeType={await getTreeType(tank.id)}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import { tankDefinitions } from '../blitzkrieg/definitions/tanks';
|
|
||||||
|
|
||||||
export default async function resolveTankName(tankId: number) {
|
|
||||||
const awaitedTankDefinitions = await tankDefinitions;
|
|
||||||
const entry = awaitedTankDefinitions[tankId];
|
|
||||||
|
|
||||||
return entry?.name_short ?? entry?.name ?? `Unknown Tank ${tankId}`;
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
import { TREE_TYPE_NAMES } from '../../components/Tanks';
|
import { TREE_TYPE_NAMES } from '../../components/Tanks';
|
||||||
import { encyclopediaInfo } from '../blitz/encyclopediaInfo';
|
import { encyclopediaInfo } from '../blitz/encyclopediaInfo';
|
||||||
import resolveTankName from '../blitz/resolveTankName';
|
|
||||||
import { StatFilters } from '../statistics/filterStats';
|
import { StatFilters } from '../statistics/filterStats';
|
||||||
import { TIER_ROMAN_NUMERALS, Tier } from './definitions/tanks';
|
import {
|
||||||
|
TIER_ROMAN_NUMERALS,
|
||||||
|
Tier,
|
||||||
|
tankDefinitions,
|
||||||
|
} from './definitions/tanks';
|
||||||
|
|
||||||
export async function filtersToDescription({
|
export async function filtersToDescription({
|
||||||
nation,
|
nation,
|
||||||
@@ -12,9 +15,10 @@ export async function filtersToDescription({
|
|||||||
tank,
|
tank,
|
||||||
}: StatFilters) {
|
}: StatFilters) {
|
||||||
const awaitedEncyclopediaInfo = await encyclopediaInfo;
|
const awaitedEncyclopediaInfo = await encyclopediaInfo;
|
||||||
|
const awaitedTankDefinitions = await tankDefinitions;
|
||||||
const info: string[] = [];
|
const info: string[] = [];
|
||||||
|
|
||||||
if (tank) return await resolveTankName(tank);
|
if (tank) return awaitedTankDefinitions[tank].name;
|
||||||
if (nation) info.push(awaitedEncyclopediaInfo.vehicle_nations[nation]);
|
if (nation) info.push(awaitedEncyclopediaInfo.vehicle_nations[nation]);
|
||||||
if (tier) info.push(`Tier ${TIER_ROMAN_NUMERALS[tier as Tier]}`);
|
if (tier) info.push(`Tier ${TIER_ROMAN_NUMERALS[tier as Tier]}`);
|
||||||
if (tankType) info.push(awaitedEncyclopediaInfo.vehicle_types[tankType]);
|
if (tankType) info.push(awaitedEncyclopediaInfo.vehicle_types[tankType]);
|
||||||
|
|||||||
Reference in new issue
Block a user