mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-14 13:16:11 +01:00
fix: update all
This commit is contained in:
1 parent
bdea9fdab3
commit
e2f50871ec
86 files changed
+1939
-1537
No files matched your search
@@ -53,11 +53,11 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
||||
case "fire.reload":
|
||||
return resolveReload(gun).toFixed(2);
|
||||
case "fire.standardPenetration":
|
||||
return shell0?.penetration.near.toFixed(0);
|
||||
return shell0?.penetration!.near.toFixed(0);
|
||||
case "fire.premiumPenetration":
|
||||
return shell1 ? shell1?.penetration.near.toFixed(0) : "--";
|
||||
return shell1 ? shell1?.penetration!.near.toFixed(0) : "--";
|
||||
case "fire.tertiaryPenetration":
|
||||
return shell1 ? shell2?.penetration.near.toFixed(0) : "--";
|
||||
return shell1 ? shell2?.penetration!.near.toFixed(0) : "--";
|
||||
case "fire.shellVelocity":
|
||||
return shell0.velocity.toFixed(0);
|
||||
case "fire.shellCapacity":
|
||||
@@ -66,12 +66,12 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
||||
return shell0.range.toFixed(0);
|
||||
case "fire.gunDepression":
|
||||
return (
|
||||
gunModelDefinition.pitch.max +
|
||||
gunModelDefinition.pitch!.max +
|
||||
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
||||
).toFixed(1);
|
||||
case "fire.gunElevation":
|
||||
return (
|
||||
-gunModelDefinition.pitch.min -
|
||||
-gunModelDefinition.pitch!.min -
|
||||
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
||||
).toFixed(1);
|
||||
case "maneuverability.forwardsSpeed":
|
||||
@@ -113,8 +113,8 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
||||
case "survivability.volume": {
|
||||
const dimensions = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
tankModelDefinition.bounding_box,
|
||||
turretModelDefinition.bounding_box,
|
||||
tankModelDefinition.bounding_box!,
|
||||
turretModelDefinition.bounding_box!,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -124,8 +124,8 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
||||
case "survivability.length": {
|
||||
const bounds = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
tankModelDefinition.bounding_box,
|
||||
turretModelDefinition.bounding_box,
|
||||
tankModelDefinition.bounding_box!,
|
||||
turretModelDefinition.bounding_box!,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@ for (const gameModeIdString in gameModeRoleSets) {
|
||||
|
||||
outerLoop: for (const id of role.consumables) {
|
||||
const name =
|
||||
consumableDefinitions.consumables[id].name.locales[locales.default];
|
||||
consumableDefinitions.consumables[id].name!.locales[locales.default];
|
||||
|
||||
for (const otherConsumable of consumables.values()) {
|
||||
const otherName =
|
||||
consumableDefinitions.consumables[otherConsumable].name.locales[
|
||||
consumableDefinitions.consumables[otherConsumable].name!.locales[
|
||||
locales.default
|
||||
];
|
||||
|
||||
@@ -102,11 +102,11 @@ for (const gameModeIdString in gameModeRoleSets) {
|
||||
|
||||
outerLoop: for (const id of role.provisions) {
|
||||
const name =
|
||||
provisionDefinitions.provisions[id].name.locales[locales.default];
|
||||
provisionDefinitions.provisions[id].name!.locales[locales.default];
|
||||
|
||||
for (const otherProvision of provisions.values()) {
|
||||
const otherName =
|
||||
provisionDefinitions.provisions[otherProvision].name.locales[
|
||||
provisionDefinitions.provisions[otherProvision].name!.locales[
|
||||
locales.default
|
||||
];
|
||||
|
||||
@@ -129,7 +129,7 @@ const consumablesArray = Object.values(consumableDefinitions.consumables)
|
||||
.filter(
|
||||
(consumable) =>
|
||||
!consumable.game_mode_exclusive &&
|
||||
consumable.name.locales[locales.default],
|
||||
consumable.name!.locales[locales.default],
|
||||
)
|
||||
.map((consumable) => consumable.id);
|
||||
const provisionsArray = Array.from(
|
||||
@@ -137,11 +137,11 @@ const provisionsArray = Array.from(
|
||||
.filter(
|
||||
(provision) =>
|
||||
!provision.game_mode_exclusive &&
|
||||
provision.name.locales[locales.default],
|
||||
provision.name!.locales[locales.default],
|
||||
)
|
||||
.reduce((uniqueMap, consumable) => {
|
||||
if (!uniqueMap.has(consumable.name.locales[locales.default])) {
|
||||
uniqueMap.set(consumable.name.locales[locales.default], consumable.id);
|
||||
if (!uniqueMap.has(consumable.name!.locales[locales.default])) {
|
||||
uniqueMap.set(consumable.name!.locales[locales.default], consumable.id);
|
||||
}
|
||||
|
||||
return uniqueMap;
|
||||
@@ -149,10 +149,10 @@ const provisionsArray = Array.from(
|
||||
.values(),
|
||||
);
|
||||
const shellTypeIcons: Record<ShellType, string> = {
|
||||
[ShellType.AP]: "ap",
|
||||
[ShellType.APCR]: "ap_cr",
|
||||
[ShellType.HE]: "he",
|
||||
[ShellType.HEAT]: "hc",
|
||||
[ShellType.SHELL_TYPE_AP]: "ap",
|
||||
[ShellType.SHELL_TYPE_APCR]: "ap_cr",
|
||||
[ShellType.SHELL_TYPE_HE]: "he",
|
||||
[ShellType.SHELL_TYPE_HEAT]: "hc",
|
||||
};
|
||||
|
||||
const GUN_TYPE_ICONS: Record<
|
||||
@@ -165,9 +165,9 @@ const GUN_TYPE_ICONS: Record<
|
||||
};
|
||||
|
||||
const TANK_TYPE_COLORS: Record<TankType, string> = {
|
||||
[TankType.RESEARCHABLE]: "gray",
|
||||
[TankType.PREMIUM]: "amber",
|
||||
[TankType.COLLECTOR]: "blue",
|
||||
[TankType.TANK_TYPE_RESEARCHABLE]: "gray",
|
||||
[TankType.TANK_TYPE_PREMIUM]: "amber",
|
||||
[TankType.TANK_TYPE_COLLECTOR]: "blue",
|
||||
};
|
||||
|
||||
const GUN_TYPES = Object.keys(
|
||||
@@ -566,12 +566,12 @@ function TypeFilter() {
|
||||
<DropdownMenu.Trigger>
|
||||
<Button color="gray" variant="surface">
|
||||
<Flex gap="1">
|
||||
{types.map((tankType, index) => {
|
||||
{types.map((tankType) => {
|
||||
return (
|
||||
<ResearchedIcon
|
||||
style={{
|
||||
color: `var(--${TANK_TYPE_COLORS[tankType]}-${
|
||||
tankType === TankType.RESEARCHABLE ? "12" : "11"
|
||||
tankType === TankType.TANK_TYPE_RESEARCHABLE ? "12" : "11"
|
||||
})`,
|
||||
filter: "drop-shadow(0 0 var(--space-1) var(--black-a11))",
|
||||
opacity: 1,
|
||||
@@ -609,7 +609,7 @@ function TypeFilter() {
|
||||
<ResearchedIcon
|
||||
style={{
|
||||
color: `var(--${TANK_TYPE_COLORS[tankType]}-${
|
||||
tankType === TankType.RESEARCHABLE ? "12" : "11"
|
||||
tankType === TankType.TANK_TYPE_RESEARCHABLE ? "12" : "11"
|
||||
})`,
|
||||
opacity: 1,
|
||||
width: "1.25em",
|
||||
@@ -941,7 +941,7 @@ function ConsumablesFilter() {
|
||||
src={asset(`icons/consumables/${consumable}.webp`)}
|
||||
/>
|
||||
|
||||
{unwrap(consumableDefinition.name)}
|
||||
{unwrap(consumableDefinition.name!)}
|
||||
</DropdownMenu.CheckboxItem>
|
||||
);
|
||||
})}
|
||||
@@ -1035,7 +1035,7 @@ function ProvisionsFilter() {
|
||||
src={asset(`icons/provisions/${provision}.webp`)}
|
||||
/>
|
||||
|
||||
{unwrap(provisionDefinition.name)}
|
||||
{unwrap(provisionDefinition.name!)}
|
||||
</DropdownMenu.CheckboxItem>
|
||||
);
|
||||
})}
|
||||
@@ -1125,9 +1125,9 @@ function GameModeAbilitiesFilter() {
|
||||
<DropdownMenu.Label>
|
||||
{hasBoth
|
||||
? literals(strings.website.common.tank_search.active, {
|
||||
name: unwrap(gameMode.name),
|
||||
name: unwrap(gameMode.name!),
|
||||
})
|
||||
: unwrap(gameMode.name)}
|
||||
: unwrap(gameMode.name!)}
|
||||
</DropdownMenu.Label>
|
||||
)}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ function GameModeAbilitiesFilter() {
|
||||
src={asset(`icons/consumables/${consumable}.webp`)}
|
||||
/>
|
||||
|
||||
{unwrap(abilityDefinition.name)}
|
||||
{unwrap(abilityDefinition.name!)}
|
||||
</DropdownMenu.CheckboxItem>
|
||||
);
|
||||
}
|
||||
@@ -1174,9 +1174,9 @@ function GameModeAbilitiesFilter() {
|
||||
<DropdownMenu.Label>
|
||||
{hasBoth
|
||||
? literals(strings.website.common.tank_search.passive, {
|
||||
name: unwrap(gameMode.name),
|
||||
name: unwrap(gameMode.name!),
|
||||
})
|
||||
: unwrap(gameMode.name)}
|
||||
: unwrap(gameMode.name!)}
|
||||
</DropdownMenu.Label>
|
||||
)}
|
||||
|
||||
@@ -1213,7 +1213,7 @@ function GameModeAbilitiesFilter() {
|
||||
src={asset(`icons/provisions/${provision}.webp`)}
|
||||
/>
|
||||
|
||||
{unwrap(powerDefinition.name)}
|
||||
{unwrap(powerDefinition.name!)}
|
||||
</DropdownMenu.CheckboxItem>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function QuickLink({ topResult }: QuickLinkProps) {
|
||||
<TextField.Slot>
|
||||
<LinkI18n locale={locale} href={`/tanks/${topResult.slug}`}>
|
||||
<Button variant="ghost">
|
||||
{unwrap(topResult.name)} <CaretRightIcon />
|
||||
{unwrap(topResult.name!)} <CaretRightIcon />
|
||||
</Button>
|
||||
</LinkI18n>
|
||||
</TextField.Slot>
|
||||
|
||||
@@ -67,7 +67,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
return filterTanks(
|
||||
tankFilters,
|
||||
awaitedTanksDefinitionsArray,
|
||||
wargaming?.id
|
||||
wargaming?.id,
|
||||
);
|
||||
} else {
|
||||
return Promise.resolve(
|
||||
@@ -75,12 +75,12 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
.go(tankFilters.search, tankNames, {
|
||||
keys: SEARCH_KEYS,
|
||||
})
|
||||
.map((result) => tankDefinitions.tanks[result.obj.id])
|
||||
.map((result) => tankDefinitions.tanks[result.obj.id]),
|
||||
);
|
||||
}
|
||||
},
|
||||
// react-promise-suspense has awful type annotations
|
||||
[tankFilters] as any
|
||||
[tankFilters] as any,
|
||||
);
|
||||
const sorted = useMemo(() => {
|
||||
if (tankFilters.search === null) {
|
||||
@@ -104,19 +104,19 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case "survivability.viewRange":
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.view_range - b.turrets.at(-1)!.view_range
|
||||
a.turrets.at(-1)!.view_range - b.turrets.at(-1)!.view_range,
|
||||
);
|
||||
break;
|
||||
|
||||
case "survivability.camouflageStill":
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.camouflage_still - b.camouflage_still
|
||||
(a, b) => a.camouflage_still - b.camouflage_still,
|
||||
);
|
||||
break;
|
||||
|
||||
case "survivability.camouflageMoving":
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.camouflage_moving - b.camouflage_moving
|
||||
(a, b) => a.camouflage_moving - b.camouflage_moving,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -126,7 +126,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
a.camouflage_still *
|
||||
a.turrets.at(-1)!.guns.at(-1)!.camouflage_loss -
|
||||
b.camouflage_still *
|
||||
b.turrets.at(-1)!.guns.at(-1)!.camouflage_loss
|
||||
b.turrets.at(-1)!.guns.at(-1)!.camouflage_loss,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -140,15 +140,15 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
bTankModelDefinition.turrets[b.turrets.at(-1)!.id];
|
||||
const aSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
aTankModelDefinition.bounding_box,
|
||||
aTurretModelDefinition.bounding_box
|
||||
)
|
||||
aTankModelDefinition.bounding_box!,
|
||||
aTurretModelDefinition.bounding_box!,
|
||||
),
|
||||
);
|
||||
const bSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
bTankModelDefinition.bounding_box,
|
||||
bTurretModelDefinition.bounding_box
|
||||
)
|
||||
bTankModelDefinition.bounding_box!,
|
||||
bTurretModelDefinition.bounding_box!,
|
||||
),
|
||||
);
|
||||
const aVolume = aSize.x * aSize.y * aSize.z;
|
||||
const bVolume = bSize.x * bSize.y * bSize.z;
|
||||
@@ -167,15 +167,15 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
bTankModelDefinition.turrets[b.turrets.at(-1)!.id];
|
||||
const aSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
aTankModelDefinition.bounding_box,
|
||||
aTurretModelDefinition.bounding_box
|
||||
)
|
||||
aTankModelDefinition.bounding_box!,
|
||||
aTurretModelDefinition.bounding_box!,
|
||||
),
|
||||
);
|
||||
const bSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
bTankModelDefinition.bounding_box,
|
||||
bTurretModelDefinition.bounding_box
|
||||
)
|
||||
bTankModelDefinition.bounding_box!,
|
||||
bTurretModelDefinition.bounding_box!,
|
||||
),
|
||||
);
|
||||
const aLength = Math.max(aSize.x, aSize.y, aSize.z);
|
||||
const bLength = Math.max(bSize.x, bSize.y, bSize.z);
|
||||
@@ -189,12 +189,12 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
(a, b) =>
|
||||
resolveDpm(
|
||||
a.turrets.at(-1)!.guns.at(-1)!,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0]
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||
) -
|
||||
resolveDpm(
|
||||
b.turrets.at(-1)!.guns.at(-1)!,
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0]
|
||||
)
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -204,15 +204,15 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||
? resolveDpm(
|
||||
a.turrets.at(-1)!.guns.at(-1)!,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[1],
|
||||
)
|
||||
: 0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||
? resolveDpm(
|
||||
b.turrets.at(-1)!.guns.at(-1)!,
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[1],
|
||||
)
|
||||
: 0)
|
||||
: 0),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -220,7 +220,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
resolveReload(a.turrets.at(-1)!.guns.at(-1)!) -
|
||||
resolveReload(b.turrets.at(-1)!.guns.at(-1)!)
|
||||
resolveReload(b.turrets.at(-1)!.guns.at(-1)!),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -228,35 +228,35 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber,
|
||||
);
|
||||
break;
|
||||
|
||||
case "fire.standardPenetration":
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration.near -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration.near
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration!.near -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration!.near,
|
||||
);
|
||||
break;
|
||||
|
||||
case "fire.premiumPenetration":
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration.near ??
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration!.near ??
|
||||
0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration.near ??
|
||||
0)
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration!.near ??
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
case "fire.tertiaryPenetration":
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.shells[2]?.penetration.near ??
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.shells[2]?.penetration!.near ??
|
||||
0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.shells[2]?.penetration.near ??
|
||||
0)
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.shells[2]?.penetration!.near ??
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -264,7 +264,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].armor_damage -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].armor_damage
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].armor_damage,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -272,7 +272,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].module_damage -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].module_damage
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].module_damage,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -280,7 +280,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].velocity -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].velocity
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].velocity,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -288,7 +288,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].range -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].range
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].range,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -296,7 +296,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shell_capacity -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shell_capacity
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shell_capacity,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -304,7 +304,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.aim_time -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.aim_time
|
||||
b.turrets.at(-1)!.guns.at(-1)!.aim_time,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -312,7 +312,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.dispersion_base -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.dispersion_base
|
||||
b.turrets.at(-1)!.guns.at(-1)!.dispersion_base,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -320,7 +320,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.tracks.at(-1)!.dispersion_move -
|
||||
b.tracks.at(-1)!.dispersion_move
|
||||
b.tracks.at(-1)!.dispersion_move,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -328,13 +328,13 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.id].pitch.max +
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.id].pitch!.max +
|
||||
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
||||
0) -
|
||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.id].pitch.max -
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.id].pitch!.max -
|
||||
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
||||
0)
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -342,31 +342,31 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.id].pitch.min +
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.id].pitch!.min +
|
||||
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
||||
0) -
|
||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.id].pitch.min -
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.id].pitch!.min -
|
||||
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
||||
0)
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
case "maneuverability.forwardsSpeed":
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.speed_forwards - b.speed_forwards
|
||||
(a, b) => a.speed_forwards - b.speed_forwards,
|
||||
);
|
||||
break;
|
||||
|
||||
case "maneuverability.backwardsSpeed":
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.speed_backwards - b.speed_backwards
|
||||
(a, b) => a.speed_backwards - b.speed_backwards,
|
||||
);
|
||||
break;
|
||||
|
||||
case "maneuverability.power":
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.engines.at(-1)!.power - b.engines.at(-1)!.power
|
||||
(a, b) => a.engines.at(-1)!.power - b.engines.at(-1)!.power,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -384,7 +384,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
b.engines.at(-1)!.weight +
|
||||
b.tracks.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.guns.at(-1)!.weight)
|
||||
b.turrets.at(-1)!.guns.at(-1)!.weight),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -400,7 +400,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
b.engines.at(-1)!.weight +
|
||||
b.tracks.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.guns.at(-1)!.weight)
|
||||
b.turrets.at(-1)!.guns.at(-1)!.weight),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -408,7 +408,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.tracks.at(-1)!.traverse_speed -
|
||||
b.tracks.at(-1)!.traverse_speed
|
||||
b.tracks.at(-1)!.traverse_speed,
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -520,12 +520,12 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
key={index}
|
||||
onIntersection={() => {
|
||||
setLoadedCards((state) =>
|
||||
Math.min(state + 2, sorted.length)
|
||||
Math.min(state + 2, sorted.length),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
},
|
||||
)}
|
||||
</TankCardWrapper>
|
||||
)}
|
||||
@@ -538,15 +538,15 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
<TankCardWrapper>
|
||||
{times(
|
||||
Math.round(
|
||||
skeleton ? DEFAULT_LOADED_CARDS : 10 + 10 * Math.random()
|
||||
skeleton ? DEFAULT_LOADED_CARDS : 10 + 10 * Math.random(),
|
||||
),
|
||||
(index) => (
|
||||
<SkeletonTankCard key={index} />
|
||||
)
|
||||
),
|
||||
)}
|
||||
</TankCardWrapper>
|
||||
)}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user