mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: optimize awaitables
This commit is contained in:
1 parent
80fca2e53a
commit
74e85f82f1
54 files changed
+259
-190
No files matched your search
@@ -1,8 +1,8 @@
|
|||||||
import { RatingStats } from '../blitz/getAccountInfo';
|
import { RatingStats } from '../blitz/getAccountInfo';
|
||||||
import { BkrlSuperset1Entry } from '../streams/bkrl';
|
import { RatingLeaderboardEntryV2 } from '../protos';
|
||||||
|
|
||||||
export function deltaBkrlBlitzStats(
|
export function deltaBkrlBlitzStats(
|
||||||
a: BkrlSuperset1Entry,
|
a: RatingLeaderboardEntryV2,
|
||||||
b1: RatingStats,
|
b1: RatingStats,
|
||||||
b2: RatingPlayer,
|
b2: RatingPlayer,
|
||||||
) {
|
) {
|
||||||
@@ -13,7 +13,7 @@ export function deltaBkrlBlitzStats(
|
|||||||
survived: b1.survived_battles - a.survived,
|
survived: b1.survived_battles - a.survived,
|
||||||
wins: b1.wins - a.wins,
|
wins: b1.wins - a.wins,
|
||||||
score: b2.score - a.score,
|
score: b2.score - a.score,
|
||||||
} satisfies Omit<BkrlSuperset1Entry, 'id'>;
|
} satisfies Omit<RatingLeaderboardEntryV2, 'id'>;
|
||||||
}
|
}
|
||||||
export interface RatingPlayer {
|
export interface RatingPlayer {
|
||||||
spa_id: number;
|
spa_id: number;
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
import {
|
import { asset, availableProvisions, permanentSkills } from '@blitzkit/core';
|
||||||
asset,
|
|
||||||
availableProvisions,
|
|
||||||
fetchConsumableDefinitions,
|
|
||||||
fetchEquipmentDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
fetchSkillDefinitions,
|
|
||||||
permanentSkills,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { checkConsumableProvisionInclusivity } from '@blitzkit/core/src/blitzkit/checkConsumableProvisionInclusivity';
|
import { checkConsumableProvisionInclusivity } from '@blitzkit/core/src/blitzkit/checkConsumableProvisionInclusivity';
|
||||||
import { ComponentPlaceholderIcon } from '@radix-ui/react-icons';
|
import { ComponentPlaceholderIcon } from '@radix-ui/react-icons';
|
||||||
import { Button, Flex, IconButton, Popover, Table } from '@radix-ui/themes';
|
import { Button, Flex, IconButton, Popover, Table } from '@radix-ui/themes';
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
|
import { awaitableConsumableDefinitions } from '../../core/awaitables/consumableDefinitions';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../../core/awaitables/equipmentDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../core/awaitables/provisionDefinitions';
|
||||||
|
import { awaitableSkillDefinitions } from '../../core/awaitables/skillDefinitions';
|
||||||
import type { TankCharacteristics } from '../../core/blitzkit/tankCharacteristics';
|
import type { TankCharacteristics } from '../../core/blitzkit/tankCharacteristics';
|
||||||
import { Var } from '../../core/radix/var';
|
import { Var } from '../../core/radix/var';
|
||||||
import { CompareEphemeral } from '../../stores/compareEphemeral';
|
import { CompareEphemeral } from '../../stores/compareEphemeral';
|
||||||
@@ -31,10 +27,17 @@ interface CompareTableProps {
|
|||||||
stats: TankCharacteristics[];
|
stats: TankCharacteristics[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const skillDefinitions = await fetchSkillDefinitions();
|
const [
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
skillDefinitions,
|
||||||
const consumableDefinitions = await fetchConsumableDefinitions();
|
equipmentDefinitions,
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
consumableDefinitions,
|
||||||
|
provisionDefinitions,
|
||||||
|
] = await Promise.all([
|
||||||
|
awaitableSkillDefinitions,
|
||||||
|
awaitableEquipmentDefinitions,
|
||||||
|
awaitableConsumableDefinitions,
|
||||||
|
awaitableProvisionDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function CompareTable({ stats }: CompareTableProps) {
|
export function CompareTable({ stats }: CompareTableProps) {
|
||||||
const crewSkills = CompareEphemeral.use((state) => state.crewSkills);
|
const crewSkills = CompareEphemeral.use((state) => state.crewSkills);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fetchProvisionDefinitions } from '@blitzkit/core';
|
|
||||||
import { PlusIcon, TrashIcon } from '@radix-ui/react-icons';
|
import { PlusIcon, TrashIcon } from '@radix-ui/react-icons';
|
||||||
import { Button, Dialog, Flex, SegmentedControl } from '@radix-ui/themes';
|
import { Button, Dialog, Flex, SegmentedControl } from '@radix-ui/themes';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../core/awaitables/provisionDefinitions';
|
||||||
import { tankToCompareMember } from '../../core/blitzkit/tankToCompareMember';
|
import { tankToCompareMember } from '../../core/blitzkit/tankToCompareMember';
|
||||||
import { CompareEphemeral } from '../../stores/compareEphemeral';
|
import { CompareEphemeral } from '../../stores/compareEphemeral';
|
||||||
import {
|
import {
|
||||||
@@ -14,7 +14,7 @@ interface ControlsProps {
|
|||||||
onAddTankDialogOpenChange: (open: boolean) => void;
|
onAddTankDialogOpenChange: (open: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
const provisionDefinitions = await awaitableProvisionDefinitions;
|
||||||
|
|
||||||
export function Controls({
|
export function Controls({
|
||||||
addTankDialogOpen,
|
addTankDialogOpen,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { fetchProvisionDefinitions } from '@blitzkit/core';
|
|
||||||
import { ExternalLinkIcon, LoopIcon, TrashIcon } from '@radix-ui/react-icons';
|
import { ExternalLinkIcon, LoopIcon, TrashIcon } from '@radix-ui/react-icons';
|
||||||
import { Dialog, Flex, IconButton, Link } from '@radix-ui/themes';
|
import { Dialog, Flex, IconButton, Link } from '@radix-ui/themes';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../core/awaitables/provisionDefinitions';
|
||||||
import { tankToCompareMember } from '../../core/blitzkit/tankToCompareMember';
|
import { tankToCompareMember } from '../../core/blitzkit/tankToCompareMember';
|
||||||
import { CompareEphemeral } from '../../stores/compareEphemeral';
|
import { CompareEphemeral } from '../../stores/compareEphemeral';
|
||||||
import { TankSearch } from '../TankSearch';
|
import { TankSearch } from '../TankSearch';
|
||||||
@@ -11,7 +11,7 @@ interface TankControlProps {
|
|||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
const provisionDefinitions = await awaitableProvisionDefinitions;
|
||||||
|
|
||||||
export function TankControl({ index, id }: TankControlProps) {
|
export function TankControl({ index, id }: TankControlProps) {
|
||||||
const [switchTankDialogOpen, setSwitchTankDialogOpen] = useState(false);
|
const [switchTankDialogOpen, setSwitchTankDialogOpen] = useState(false);
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import {
|
import { asset, permanentSkills, romanize } from '@blitzkit/core';
|
||||||
asset,
|
|
||||||
fetchSkillDefinitions,
|
|
||||||
permanentSkills,
|
|
||||||
romanize,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { Flex } from '@radix-ui/themes';
|
import { Flex } from '@radix-ui/themes';
|
||||||
|
import { awaitableSkillDefinitions } from '../core/awaitables/skillDefinitions';
|
||||||
import { GenericTankComponentButton } from './ModuleButtons/GenericTankComponentButton';
|
import { GenericTankComponentButton } from './ModuleButtons/GenericTankComponentButton';
|
||||||
|
|
||||||
interface CrewSkillManagerProps {
|
interface CrewSkillManagerProps {
|
||||||
@@ -12,7 +8,7 @@ interface CrewSkillManagerProps {
|
|||||||
onChange?: (skillLevels: Record<string, number>) => void;
|
onChange?: (skillLevels: Record<string, number>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const skillDefinitions = await fetchSkillDefinitions();
|
const skillDefinitions = await awaitableSkillDefinitions;
|
||||||
|
|
||||||
export function CrewSkillManager({
|
export function CrewSkillManager({
|
||||||
skillLevels,
|
skillLevels,
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import {
|
|||||||
compositeStats,
|
compositeStats,
|
||||||
compositeStatsKeys,
|
compositeStatsKeys,
|
||||||
deltaTankStats,
|
deltaTankStats,
|
||||||
fetchAverageDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
getTankStats,
|
getTankStats,
|
||||||
idToRegion,
|
idToRegion,
|
||||||
sumCompositeStats,
|
sumCompositeStats,
|
||||||
@@ -15,6 +13,8 @@ import { ReloadIcon } from '@radix-ui/react-icons';
|
|||||||
import { ContextMenu } from '@radix-ui/themes';
|
import { ContextMenu } from '@radix-ui/themes';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { breakdownConfig } from '../../constants/embeds';
|
import { breakdownConfig } from '../../constants/embeds';
|
||||||
|
import { awaitableAverageDefinitions } from '../../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../core/awaitables/tankDefinitions';
|
||||||
import { EmbedBreakdownPersistent } from '../../stores/embedBreakdownPersistent';
|
import { EmbedBreakdownPersistent } from '../../stores/embedBreakdownPersistent';
|
||||||
import { useEmbedStateCurry } from '../../stores/embedState/utilities';
|
import { useEmbedStateCurry } from '../../stores/embedState/utilities';
|
||||||
import { BreakdownEmbedCard, BreakdownEmbedWrapper } from '../TanksEmbed';
|
import { BreakdownEmbedCard, BreakdownEmbedWrapper } from '../TanksEmbed';
|
||||||
@@ -24,8 +24,10 @@ export const compositeStatsKeysOptions = compositeStatsKeys.map((value) => ({
|
|||||||
value,
|
value,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export const fakeCompositeStats = compositeStats(
|
export const fakeCompositeStats = compositeStats(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import { fetchAverageDefinitions, fetchTankDefinitions } from '@blitzkit/core';
|
|
||||||
import { Box, Flex, Heading } from '@radix-ui/themes';
|
import { Box, Flex, Heading } from '@radix-ui/themes';
|
||||||
|
import { awaitableAverageDefinitions } from '../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../core/awaitables/tankDefinitions';
|
||||||
import { TankopediaPersistent } from '../stores/tankopediaPersistent';
|
import { TankopediaPersistent } from '../stores/tankopediaPersistent';
|
||||||
import { TankCard } from './TankCard';
|
import { TankCard } from './TankCard';
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
const tanks = Object.values(tankDefinitions.tanks);
|
const tanks = Object.values(tankDefinitions.tanks);
|
||||||
const tankAverages = Object.entries(averageDefinitions.averages).map(
|
const tankAverages = Object.entries(averageDefinitions.averages).map(
|
||||||
([id, average]) => ({
|
([id, average]) => ({
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { asset, fetchConsumableDefinitions } from '@blitzkit/core';
|
import { asset } from '@blitzkit/core';
|
||||||
import { ClockIcon, ReloadIcon } from '@radix-ui/react-icons';
|
import { ClockIcon, ReloadIcon } from '@radix-ui/react-icons';
|
||||||
import { Flex, Text } from '@radix-ui/themes';
|
import { Flex, Text } from '@radix-ui/themes';
|
||||||
|
import { awaitableConsumableDefinitions } from '../../core/awaitables/consumableDefinitions';
|
||||||
import { useDelta } from '../../hooks/useDelta';
|
import { useDelta } from '../../hooks/useDelta';
|
||||||
import { GenericTankComponentButton } from './GenericTankComponentButton';
|
import { GenericTankComponentButton } from './GenericTankComponentButton';
|
||||||
import type { TankComponentButtonProps } from './TankComponentButton';
|
import type { TankComponentButtonProps } from './TankComponentButton';
|
||||||
@@ -11,7 +12,7 @@ interface ConsumableButtonProps extends TankComponentButtonProps {
|
|||||||
cooldown?: number;
|
cooldown?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const consumableDefinitions = await fetchConsumableDefinitions();
|
const consumableDefinitions = await awaitableConsumableDefinitions;
|
||||||
|
|
||||||
export function ConsumableButton({
|
export function ConsumableButton({
|
||||||
consumable,
|
consumable,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { asset, fetchEquipmentDefinitions } from '@blitzkit/core';
|
import { asset } from '@blitzkit/core';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../../core/awaitables/equipmentDefinitions';
|
||||||
import { GenericTankComponentButton } from './GenericTankComponentButton';
|
import { GenericTankComponentButton } from './GenericTankComponentButton';
|
||||||
import type { TankComponentButtonProps } from './TankComponentButton';
|
import type { TankComponentButtonProps } from './TankComponentButton';
|
||||||
|
|
||||||
@@ -6,7 +7,7 @@ interface EquipmentButtonProps extends TankComponentButtonProps {
|
|||||||
equipment: number;
|
equipment: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
const equipmentDefinitions = await awaitableEquipmentDefinitions;
|
||||||
|
|
||||||
export function EquipmentButton({ equipment, ...props }: EquipmentButtonProps) {
|
export function EquipmentButton({ equipment, ...props }: EquipmentButtonProps) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { asset, fetchProvisionDefinitions } from '@blitzkit/core';
|
import { asset } from '@blitzkit/core';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../core/awaitables/provisionDefinitions';
|
||||||
import { GenericTankComponentButton } from './GenericTankComponentButton';
|
import { GenericTankComponentButton } from './GenericTankComponentButton';
|
||||||
import type { TankComponentButtonProps } from './TankComponentButton';
|
import type { TankComponentButtonProps } from './TankComponentButton';
|
||||||
|
|
||||||
@@ -6,7 +7,7 @@ interface ProvisionButtonProps extends TankComponentButtonProps {
|
|||||||
provision: number;
|
provision: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
const provisionDefinitions = await awaitableProvisionDefinitions;
|
||||||
|
|
||||||
export function ProvisionButton({ provision, ...props }: ProvisionButtonProps) {
|
export function ProvisionButton({ provision, ...props }: ProvisionButtonProps) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
+7
-4
@@ -1,6 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
fetchAverageDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
formatCompact,
|
formatCompact,
|
||||||
TANK_CLASSES,
|
TANK_CLASSES,
|
||||||
TankClass,
|
TankClass,
|
||||||
@@ -10,14 +8,19 @@ import {
|
|||||||
import strings from '@blitzkit/core/lang/en-US.json';
|
import strings from '@blitzkit/core/lang/en-US.json';
|
||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { Box, Flex, Heading } from '@radix-ui/themes';
|
import { Box, Flex, Heading } from '@radix-ui/themes';
|
||||||
|
import { awaitableAverageDefinitions } from '../../../../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../../../core/awaitables/tankDefinitions';
|
||||||
import { filterTank } from '../../../../core/blitzkit/filterTank';
|
import { filterTank } from '../../../../core/blitzkit/filterTank';
|
||||||
import { useAveragesExclusionRatio } from '../../../../hooks/useAveragesExclusionRatio';
|
import { useAveragesExclusionRatio } from '../../../../hooks/useAveragesExclusionRatio';
|
||||||
import { $tankFilters } from '../../../../stores/tankFilters';
|
import { $tankFilters } from '../../../../stores/tankFilters';
|
||||||
import { TankPerformanceEphemeral } from '../../../../stores/tankPerformanceEphemeral';
|
import { TankPerformanceEphemeral } from '../../../../stores/tankPerformanceEphemeral';
|
||||||
import { ThemedBar } from '../../../Nivo/ThemedBar';
|
import { ThemedBar } from '../../../Nivo/ThemedBar';
|
||||||
|
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
const [tankDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
const averageDefinitionsArray = Object.entries(averageDefinitions.averages);
|
const averageDefinitionsArray = Object.entries(averageDefinitions.averages);
|
||||||
|
|
||||||
export function PlayersByTierAndClass() {
|
export function PlayersByTierAndClass() {
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import {
|
import { formatCompact } from '@blitzkit/core';
|
||||||
fetchAverageDefinitions,
|
|
||||||
fetchDiscoveredIdsDefinitions,
|
|
||||||
formatCompact,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
||||||
import { Callout, Flex } from '@radix-ui/themes';
|
import { Callout, Flex } from '@radix-ui/themes';
|
||||||
|
import { awaitableAverageDefinitions } from '../../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableDiscoveredIdsDefinitions } from '../../core/awaitables/discoveredIdsDefinitions';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
||||||
import { InlineSkeleton } from '../InlineSkeleton';
|
import { InlineSkeleton } from '../InlineSkeleton';
|
||||||
|
|
||||||
const discoveredIdsDefinitions = await fetchDiscoveredIdsDefinitions();
|
const [discoveredIdsDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
awaitableDiscoveredIdsDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function PerformanceInfo({ skeleton }: MaybeSkeletonComponentProps) {
|
export function PerformanceInfo({ skeleton }: MaybeSkeletonComponentProps) {
|
||||||
const samples = formatCompact(Math.round(discoveredIdsDefinitions.count));
|
const samples = formatCompact(Math.round(discoveredIdsDefinitions.count));
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import {
|
import { TankDefinition, formatCompact } from '@blitzkit/core';
|
||||||
TankDefinition,
|
|
||||||
fetchAverageDefinitions,
|
|
||||||
formatCompact,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { Table } from '@radix-ui/themes';
|
import { Table } from '@radix-ui/themes';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
import { awaitableAverageDefinitions } from '../../core/awaitables/averageDefinitions';
|
||||||
import { useAveragesExclusionRatio } from '../../hooks/useAveragesExclusionRatio';
|
import { useAveragesExclusionRatio } from '../../hooks/useAveragesExclusionRatio';
|
||||||
import { TankPerformanceEphemeral } from '../../stores/tankPerformanceEphemeral';
|
import { TankPerformanceEphemeral } from '../../stores/tankPerformanceEphemeral';
|
||||||
import { TankRowHeaderCell } from '../TankRowHeaderCell';
|
import { TankRowHeaderCell } from '../TankRowHeaderCell';
|
||||||
@@ -13,7 +10,7 @@ interface TankRowProps {
|
|||||||
tank: TankDefinition;
|
tank: TankDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
const averageDefinitions = await awaitableAverageDefinitions;
|
||||||
|
|
||||||
export const TankRow = memo<TankRowProps>(
|
export const TankRow = memo<TankRowProps>(
|
||||||
({ tank }) => {
|
({ tank }) => {
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { fetchAverageDefinitions, fetchTankDefinitions } from '@blitzkit/core';
|
|
||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { Table } from '@radix-ui/themes';
|
import { Table } from '@radix-ui/themes';
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
import { Fragment, Suspense, useEffect, useMemo, useState } from 'react';
|
import { Fragment, Suspense, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { awaitableAverageDefinitions } from '../../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../core/awaitables/tankDefinitions';
|
||||||
import { filterTank } from '../../core/blitzkit/filterTank';
|
import { filterTank } from '../../core/blitzkit/filterTank';
|
||||||
import { $tankFilters } from '../../stores/tankFilters';
|
import { $tankFilters } from '../../stores/tankFilters';
|
||||||
import { TankPerformanceEphemeral } from '../../stores/tankPerformanceEphemeral';
|
import { TankPerformanceEphemeral } from '../../stores/tankPerformanceEphemeral';
|
||||||
@@ -15,13 +16,16 @@ import { Total } from './Total';
|
|||||||
const PREVIEW_COUNT = 10;
|
const PREVIEW_COUNT = 10;
|
||||||
const DEFAULT_LOADED_ROWS = 25;
|
const DEFAULT_LOADED_ROWS = 25;
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const averageDefinitionsArray = await fetchAverageDefinitions().then(
|
awaitableTankDefinitions,
|
||||||
({ averages }) =>
|
awaitableAverageDefinitions,
|
||||||
Object.entries(averages).map(([id, average]) => ({
|
]);
|
||||||
id: Number(id),
|
|
||||||
...average,
|
const averageDefinitionsArray = Object.entries(averageDefinitions.averages).map(
|
||||||
})),
|
([id, average]) => ({
|
||||||
|
id: Number(id),
|
||||||
|
...average,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export function Tanks({ skeleton }: MaybeSkeletonComponentProps) {
|
export function Tanks({ skeleton }: MaybeSkeletonComponentProps) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
AverageDefinitionsEntry,
|
AverageDefinitionsEntry,
|
||||||
fetchAverageDefinitions,
|
|
||||||
formatCompact,
|
formatCompact,
|
||||||
type BlitzkitStats,
|
type BlitzkitStats,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { Table } from '@radix-ui/themes';
|
import { Table } from '@radix-ui/themes';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
|
import { awaitableAverageDefinitions } from '../../core/awaitables/averageDefinitions';
|
||||||
import { useAveragesExclusionRatio } from '../../hooks/useAveragesExclusionRatio';
|
import { useAveragesExclusionRatio } from '../../hooks/useAveragesExclusionRatio';
|
||||||
import { TankPerformanceEphemeral } from '../../stores/tankPerformanceEphemeral';
|
import { TankPerformanceEphemeral } from '../../stores/tankPerformanceEphemeral';
|
||||||
import { StickyRowHeaderCell } from '../StickyRowHeaderCell';
|
import { StickyRowHeaderCell } from '../StickyRowHeaderCell';
|
||||||
@@ -18,7 +18,7 @@ interface TotalProps {
|
|||||||
tanks: AverageDefinitionsEntryWithId[];
|
tanks: AverageDefinitionsEntryWithId[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
const averageDefinitions = await awaitableAverageDefinitions;
|
||||||
|
|
||||||
export const Total = memo<TotalProps>(
|
export const Total = memo<TotalProps>(
|
||||||
({ tanks }) => {
|
({ tanks }) => {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
fetchModelDefinitions,
|
|
||||||
normalizeBoundingBox,
|
normalizeBoundingBox,
|
||||||
resolveDpm,
|
resolveDpm,
|
||||||
unionBoundingBox,
|
unionBoundingBox,
|
||||||
@@ -7,6 +6,7 @@ import {
|
|||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
import { awaitableModelDefinitions } from '../../../core/awaitables/modelDefinitions';
|
||||||
import { resolveReload } from '../../../core/blitzkit/resolveReload';
|
import { resolveReload } from '../../../core/blitzkit/resolveReload';
|
||||||
import { $tankopediaSort } from '../../../stores/tankopediaSort';
|
import { $tankopediaSort } from '../../../stores/tankopediaSort';
|
||||||
import { TankCard } from '../../TankCard';
|
import { TankCard } from '../../TankCard';
|
||||||
@@ -16,7 +16,7 @@ interface TankSearchCardProps {
|
|||||||
onSelect?: (tank: TankDefinition) => void;
|
onSelect?: (tank: TankDefinition) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modelDefinitions = await fetchModelDefinitions();
|
const modelDefinitions = await awaitableModelDefinitions;
|
||||||
|
|
||||||
export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
||||||
const tankopediaSort = useStore($tankopediaSort);
|
const tankopediaSort = useStore($tankopediaSort);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
asset,
|
asset,
|
||||||
fetchGameDefinitions,
|
|
||||||
TANK_CLASSES,
|
TANK_CLASSES,
|
||||||
TankType,
|
TankType,
|
||||||
TIER_ROMAN_NUMERALS,
|
TIER_ROMAN_NUMERALS,
|
||||||
@@ -9,6 +8,7 @@ import { useStore } from '@nanostores/react';
|
|||||||
import { ReloadIcon } from '@radix-ui/react-icons';
|
import { ReloadIcon } from '@radix-ui/react-icons';
|
||||||
import { Box, Flex, IconButton, Text } from '@radix-ui/themes';
|
import { Box, Flex, IconButton, Text } from '@radix-ui/themes';
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
|
import { awaitableGameDefinitions } from '../../../core/awaitables/gameDefinitions';
|
||||||
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
||||||
import {
|
import {
|
||||||
$tankopediaSort,
|
$tankopediaSort,
|
||||||
@@ -27,7 +27,7 @@ interface FilterControlProps {
|
|||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const gameDefinitions = await fetchGameDefinitions();
|
const gameDefinitions = await awaitableGameDefinitions;
|
||||||
|
|
||||||
export function FilterControl({ compact }: FilterControlProps) {
|
export function FilterControl({ compact }: FilterControlProps) {
|
||||||
const tankFilters = useStore($tankFilters);
|
const tankFilters = useStore($tankFilters);
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { fetchTankDefinitions } from '@blitzkit/core';
|
|
||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { Flex, Separator, Text } from '@radix-ui/themes';
|
import { Flex, Separator, Text } from '@radix-ui/themes';
|
||||||
import { isEqual } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||||
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
||||||
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||||
import { $tankopediaSort } from '../../../stores/tankopediaSort';
|
import { $tankopediaSort } from '../../../stores/tankopediaSort';
|
||||||
import { TankCard } from '../../TankCard';
|
import { TankCard } from '../../TankCard';
|
||||||
import { TankCardWrapper } from './TankCardWrapper';
|
import { TankCardWrapper } from './TankCardWrapper';
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export function RecentlyViewed() {
|
export function RecentlyViewed() {
|
||||||
const tankopediaPersistentStore = TankopediaPersistent.useStore();
|
const tankopediaPersistentStore = TankopediaPersistent.useStore();
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
fetchGameDefinitions,
|
|
||||||
fetchModelDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
fetchTankNames,
|
|
||||||
metaSortTank,
|
metaSortTank,
|
||||||
normalizeBoundingBox,
|
normalizeBoundingBox,
|
||||||
resolveDpm,
|
resolveDpm,
|
||||||
@@ -14,6 +10,10 @@ import { Callout, Flex, Link, Text, type FlexProps } from '@radix-ui/themes';
|
|||||||
import fuzzysort from 'fuzzysort';
|
import fuzzysort from 'fuzzysort';
|
||||||
import { times, uniq } from 'lodash-es';
|
import { times, uniq } from 'lodash-es';
|
||||||
import { memo, useEffect, useMemo, useState } from 'react';
|
import { memo, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { awaitableGameDefinitions } from '../../core/awaitables/gameDefinitions';
|
||||||
|
import { awaitableModelDefinitions } from '../../core/awaitables/modelDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../core/awaitables/tankDefinitions';
|
||||||
|
import { awaitableTankNames } from '../../core/awaitables/tankNames';
|
||||||
import { filterTank } from '../../core/blitzkit/filterTank';
|
import { filterTank } from '../../core/blitzkit/filterTank';
|
||||||
import { resolveReload } from '../../core/blitzkit/resolveReload';
|
import { resolveReload } from '../../core/blitzkit/resolveReload';
|
||||||
import { $tankFilters } from '../../stores/tankFilters';
|
import { $tankFilters } from '../../stores/tankFilters';
|
||||||
@@ -42,10 +42,13 @@ type TankSearchProps = Omit<FlexProps, 'onSelect'> & {
|
|||||||
const PREVIEW_COUNT = 25;
|
const PREVIEW_COUNT = 25;
|
||||||
const DEFAULT_LOADED_CARDS = 75;
|
const DEFAULT_LOADED_CARDS = 75;
|
||||||
|
|
||||||
const gameDefinitions = await fetchGameDefinitions();
|
const [gameDefinitions, modelDefinitions, tankDefinitions, tankNames] =
|
||||||
const modelDefinitions = await fetchModelDefinitions();
|
await Promise.all([
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
awaitableGameDefinitions,
|
||||||
const tankNames = await fetchTankNames();
|
awaitableModelDefinitions,
|
||||||
|
awaitableTankDefinitions,
|
||||||
|
awaitableTankNames,
|
||||||
|
]);
|
||||||
|
|
||||||
export const TankSearch = memo<TankSearchProps>(
|
export const TankSearch = memo<TankSearchProps>(
|
||||||
({ compact, onSelect, onSelectAll, ...props }) => {
|
({ compact, onSelect, onSelectAll, ...props }) => {
|
||||||
|
|||||||
+20
-14
@@ -1,13 +1,11 @@
|
|||||||
import {
|
import { createDefaultSkills } from '@blitzkit/core';
|
||||||
createDefaultSkills,
|
|
||||||
fetchEquipmentDefinitions,
|
|
||||||
fetchModelDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
fetchSkillDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { Flex, Progress, Text } from '@radix-ui/themes';
|
import { Flex, Progress, Text } from '@radix-ui/themes';
|
||||||
import { useMemo, type ComponentProps } from 'react';
|
import { useMemo, type ComponentProps } from 'react';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions';
|
||||||
|
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../../../../../core/awaitables/provisionDefinitions';
|
||||||
|
import { awaitableSkillDefinitions } from '../../../../../../core/awaitables/skillDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../../../../../core/awaitables/tankDefinitions';
|
||||||
import {
|
import {
|
||||||
tankCharacteristics,
|
tankCharacteristics,
|
||||||
type TankCharacteristics,
|
type TankCharacteristics,
|
||||||
@@ -29,11 +27,19 @@ interface InfoWithDeltaProps extends InfoProps {
|
|||||||
noRanking?: boolean;
|
noRanking?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
tankDefinitions,
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
provisionDefinitions,
|
||||||
const tankModelDefinitions = await fetchModelDefinitions();
|
equipmentDefinitions,
|
||||||
const skillDefinitions = await fetchSkillDefinitions();
|
modelDefinitions,
|
||||||
|
skillDefinitions,
|
||||||
|
] = await Promise.all([
|
||||||
|
awaitableTankDefinitions,
|
||||||
|
awaitableProvisionDefinitions,
|
||||||
|
awaitableEquipmentDefinitions,
|
||||||
|
awaitableModelDefinitions,
|
||||||
|
awaitableSkillDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function InfoWithDelta({
|
export function InfoWithDelta({
|
||||||
value,
|
value,
|
||||||
@@ -90,7 +96,7 @@ export function InfoWithDelta({
|
|||||||
{
|
{
|
||||||
equipmentDefinitions,
|
equipmentDefinitions,
|
||||||
provisionDefinitions,
|
provisionDefinitions,
|
||||||
tankModelDefinition: tankModelDefinitions.models[tank.id],
|
tankModelDefinition: modelDefinitions.models[tank.id],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
+6
-4
@@ -3,8 +3,6 @@ import {
|
|||||||
coefficient,
|
coefficient,
|
||||||
CREW_MEMBER_NAMES,
|
CREW_MEMBER_NAMES,
|
||||||
CrewType,
|
CrewType,
|
||||||
fetchEquipmentDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
GUN_TYPE_NAMES,
|
GUN_TYPE_NAMES,
|
||||||
isExplosive,
|
isExplosive,
|
||||||
resolvePenetrationCoefficient,
|
resolvePenetrationCoefficient,
|
||||||
@@ -24,6 +22,8 @@ import { debounce } from 'lodash-es';
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Fragment } from 'react/jsx-runtime';
|
import { Fragment } from 'react/jsx-runtime';
|
||||||
import { lerp } from 'three/src/math/MathUtils.js';
|
import { lerp } from 'three/src/math/MathUtils.js';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../../../../../core/awaitables/equipmentDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions';
|
||||||
import { applyPitchYawLimits } from '../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../core/blitz/applyPitchYawLimits';
|
||||||
import { tankCharacteristics } from '../../../../../core/blitzkit/tankCharacteristics';
|
import { tankCharacteristics } from '../../../../../core/blitzkit/tankCharacteristics';
|
||||||
import { useEquipment } from '../../../../../hooks/useEquipment';
|
import { useEquipment } from '../../../../../hooks/useEquipment';
|
||||||
@@ -33,8 +33,10 @@ import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral';
|
|||||||
import { Info } from './components/Info';
|
import { Info } from './components/Info';
|
||||||
import { InfoWithDelta } from './components/InfoWithDelta';
|
import { InfoWithDelta } from './components/InfoWithDelta';
|
||||||
|
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
const [equipmentDefinitions, provisionDefinitions] = await Promise.all([
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
awaitableEquipmentDefinitions,
|
||||||
|
awaitableProvisionDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function Characteristics() {
|
export function Characteristics() {
|
||||||
const mutateDuel = Duel.useMutation();
|
const mutateDuel = Duel.useMutation();
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,3 @@
|
|||||||
import { fetchConsumableDefinitions } from '@blitzkit/core';
|
|
||||||
import { checkConsumableProvisionInclusivity } from '@blitzkit/core/src/blitzkit/checkConsumableProvisionInclusivity';
|
import { checkConsumableProvisionInclusivity } from '@blitzkit/core/src/blitzkit/checkConsumableProvisionInclusivity';
|
||||||
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
||||||
import {
|
import {
|
||||||
@@ -9,12 +8,13 @@ import {
|
|||||||
Popover,
|
Popover,
|
||||||
Text,
|
Text,
|
||||||
} from '@radix-ui/themes';
|
} from '@radix-ui/themes';
|
||||||
|
import { awaitableConsumableDefinitions } from '../../../../core/awaitables/consumableDefinitions';
|
||||||
import { useEquipment } from '../../../../hooks/useEquipment';
|
import { useEquipment } from '../../../../hooks/useEquipment';
|
||||||
import { Duel } from '../../../../stores/duel';
|
import { Duel } from '../../../../stores/duel';
|
||||||
import { ConsumablesManager } from '../../../ConsumablesManager';
|
import { ConsumablesManager } from '../../../ConsumablesManager';
|
||||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||||
|
|
||||||
const consumableDefinitions = await fetchConsumableDefinitions();
|
const consumableDefinitions = await awaitableConsumableDefinitions;
|
||||||
|
|
||||||
export function Consumables() {
|
export function Consumables() {
|
||||||
const mutateDuel = Duel.useMutation();
|
const mutateDuel = Duel.useMutation();
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
import { fetchEquipmentDefinitions } from '@blitzkit/core';
|
|
||||||
import { Button, Flex, Heading } from '@radix-ui/themes';
|
import { Button, Flex, Heading } from '@radix-ui/themes';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../../../../core/awaitables/equipmentDefinitions';
|
||||||
import { Duel } from '../../../../stores/duel';
|
import { Duel } from '../../../../stores/duel';
|
||||||
import { EquipmentManager } from '../../../EquipmentManager';
|
import { EquipmentManager } from '../../../EquipmentManager';
|
||||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||||
|
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
const equipmentDefinitions = await awaitableEquipmentDefinitions;
|
||||||
|
|
||||||
export function Equipment() {
|
export function Equipment() {
|
||||||
const mutateDuel = Duel.useMutation();
|
const mutateDuel = Duel.useMutation();
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
asset,
|
asset,
|
||||||
EngineDefinition,
|
EngineDefinition,
|
||||||
fetchTankDefinitions,
|
|
||||||
formatCompact,
|
formatCompact,
|
||||||
GunDefinition,
|
GunDefinition,
|
||||||
ModuleType,
|
ModuleType,
|
||||||
@@ -21,6 +20,7 @@ import {
|
|||||||
Link,
|
Link,
|
||||||
Text,
|
Text,
|
||||||
} from '@radix-ui/themes';
|
} from '@radix-ui/themes';
|
||||||
|
import { awaitableTankDefinitions } from '../../../../core/awaitables/tankDefinitions';
|
||||||
import { Duel } from '../../../../stores/duel';
|
import { Duel } from '../../../../stores/duel';
|
||||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ function ModuleButton({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export function Modules() {
|
export function Modules() {
|
||||||
const mutateDuel = Duel.useMutation();
|
const mutateDuel = Duel.useMutation();
|
||||||
|
|||||||
+3
-2
@@ -1,10 +1,11 @@
|
|||||||
import { availableProvisions, fetchProvisionDefinitions } from '@blitzkit/core';
|
import { availableProvisions } from '@blitzkit/core';
|
||||||
import { Button, Flex, Heading } from '@radix-ui/themes';
|
import { Button, Flex, Heading } from '@radix-ui/themes';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../../../core/awaitables/provisionDefinitions';
|
||||||
import { Duel } from '../../../../stores/duel';
|
import { Duel } from '../../../../stores/duel';
|
||||||
import { ProvisionsManager } from '../../../ProvisionsManager';
|
import { ProvisionsManager } from '../../../ProvisionsManager';
|
||||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||||
|
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
const provisionDefinitions = await awaitableProvisionDefinitions;
|
||||||
|
|
||||||
export function Provisions() {
|
export function Provisions() {
|
||||||
const mutateDuel = Duel.useMutation();
|
const mutateDuel = Duel.useMutation();
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import {
|
import { asset } from '@blitzkit/core';
|
||||||
asset,
|
|
||||||
fetchConsumableDefinitions,
|
|
||||||
fetchGameDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
|
import { awaitableConsumableDefinitions } from '../../core/awaitables/consumableDefinitions';
|
||||||
|
import { awaitableGameDefinitions } from '../../core/awaitables/gameDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../core/awaitables/provisionDefinitions';
|
||||||
import { Duel } from '../../stores/duel';
|
import { Duel } from '../../stores/duel';
|
||||||
|
|
||||||
const gameDefinitions = await fetchGameDefinitions();
|
const [gameDefinitions, consumableDefinitions, provisionDefinitions] =
|
||||||
const consumableDefinitions = await fetchConsumableDefinitions();
|
await Promise.all([
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
awaitableGameDefinitions,
|
||||||
|
awaitableConsumableDefinitions,
|
||||||
|
awaitableProvisionDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function GameModeSection() {
|
export function GameModeSection() {
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { fetchModelDefinitions } from '@blitzkit/core';
|
|
||||||
import { OrbitControls } from '@react-three/drei';
|
import { OrbitControls } from '@react-three/drei';
|
||||||
import { invalidate, useThree } from '@react-three/fiber';
|
import { invalidate, useThree } from '@react-three/fiber';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Vector3 } from 'three';
|
import { Vector3 } from 'three';
|
||||||
import { OrbitControls as OrbitControlsClass } from 'three-stdlib';
|
import { OrbitControls as OrbitControlsClass } from 'three-stdlib';
|
||||||
|
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
||||||
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
|
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
|
||||||
import { Pose, poseEvent } from '../../../../../../core/blitzkit/pose';
|
import { Pose, poseEvent } from '../../../../../../core/blitzkit/pose';
|
||||||
@@ -17,7 +17,7 @@ const poseDistances: Record<Pose, number> = {
|
|||||||
[Pose.Default]: -1,
|
[Pose.Default]: -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const modelDefinitions = await fetchModelDefinitions();
|
const modelDefinitions = await awaitableModelDefinitions;
|
||||||
|
|
||||||
export function Controls() {
|
export function Controls() {
|
||||||
const duelStore = Duel.useStore();
|
const duelStore = Duel.useStore();
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { fetchTankDefinitions, TankType } from '@blitzkit/core';
|
import { TankType } from '@blitzkit/core';
|
||||||
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
import { Suspense, useEffect, useMemo, useRef } from 'react';
|
import { Suspense, useEffect, useMemo, useRef } from 'react';
|
||||||
import { NAVBAR_HEIGHT } from '../../../constants/navbar';
|
import { NAVBAR_HEIGHT } from '../../../constants/navbar';
|
||||||
|
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||||
import { Var } from '../../../core/radix/var';
|
import { Var } from '../../../core/radix/var';
|
||||||
import { useFullScreen } from '../../../hooks/useFullScreen';
|
import { useFullScreen } from '../../../hooks/useFullScreen';
|
||||||
import { Duel } from '../../../stores/duel';
|
import { Duel } from '../../../stores/duel';
|
||||||
@@ -14,7 +15,7 @@ import { Options } from './components/Options';
|
|||||||
import { TankSandbox } from './components/TankSandbox';
|
import { TankSandbox } from './components/TankSandbox';
|
||||||
import { TankSandboxLoader } from './components/TankSandboxLoader';
|
import { TankSandboxLoader } from './components/TankSandboxLoader';
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) {
|
export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) {
|
||||||
const canvas = useRef<HTMLCanvasElement>(null);
|
const canvas = useRef<HTMLCanvasElement>(null);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
assertSecret,
|
assertSecret,
|
||||||
asset,
|
asset,
|
||||||
fetchModelDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
TankPriceType,
|
TankPriceType,
|
||||||
TankType,
|
TankType,
|
||||||
TIER_ROMAN_NUMERALS,
|
TIER_ROMAN_NUMERALS,
|
||||||
@@ -11,6 +9,8 @@ import strings from '@blitzkit/core/lang/en-US.json';
|
|||||||
import { ChevronLeftIcon, MixIcon, UpdateIcon } from '@radix-ui/react-icons';
|
import { ChevronLeftIcon, MixIcon, UpdateIcon } from '@radix-ui/react-icons';
|
||||||
import { Button, Code, Dialog, Flex, Link } from '@radix-ui/themes';
|
import { Button, Code, Dialog, Flex, Link } from '@radix-ui/themes';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { awaitableModelDefinitions } from '../../../core/awaitables/modelDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../../core/awaitables/provisionDefinitions';
|
||||||
import { tankToDuelMember } from '../../../core/blitzkit/tankToDuelMember';
|
import { tankToDuelMember } from '../../../core/blitzkit/tankToDuelMember';
|
||||||
import { App } from '../../../stores/app';
|
import { App } from '../../../stores/app';
|
||||||
import { Duel } from '../../../stores/duel';
|
import { Duel } from '../../../stores/duel';
|
||||||
@@ -20,8 +20,10 @@ import { ScienceIcon } from '../../ScienceIcon';
|
|||||||
import { TankSearch } from '../../TankSearch';
|
import { TankSearch } from '../../TankSearch';
|
||||||
import { Listing } from './components/Listing';
|
import { Listing } from './components/Listing';
|
||||||
|
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
const [provisionDefinitions, modelDefinitions] = await Promise.all([
|
||||||
const modelDefinitions = await fetchModelDefinitions();
|
awaitableProvisionDefinitions,
|
||||||
|
awaitableModelDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function MetaSection() {
|
export function MetaSection() {
|
||||||
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import {
|
import { asset, formatCompact, TIER_ROMAN_NUMERALS } from '@blitzkit/core';
|
||||||
asset,
|
|
||||||
fetchAverageDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
formatCompact,
|
|
||||||
TIER_ROMAN_NUMERALS,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { Box, Flex, Link, Skeleton, Text } from '@radix-ui/themes';
|
import { Box, Flex, Link, Skeleton, Text } from '@radix-ui/themes';
|
||||||
|
import { awaitableAverageDefinitions } from '../../../../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../../../core/awaitables/tankDefinitions';
|
||||||
import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
|
import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../../../types/maybeSkeletonComponentProps';
|
||||||
|
|
||||||
@@ -15,8 +11,10 @@ type NodeProps = MaybeSkeletonComponentProps & {
|
|||||||
highlight?: boolean;
|
highlight?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const averageDefinitions = await fetchAverageDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
||||||
const xpMultiplier = TankopediaEphemeral.use((state) => state.xpMultiplier);
|
const xpMultiplier = TankopediaEphemeral.use((state) => state.xpMultiplier);
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { asset, fetchTankDefinitions, imgur, TankType } from '@blitzkit/core';
|
import { asset, imgur, TankType } from '@blitzkit/core';
|
||||||
import { CaretLeftIcon, CaretRightIcon, PlusIcon } from '@radix-ui/react-icons';
|
import { CaretLeftIcon, CaretRightIcon, PlusIcon } from '@radix-ui/react-icons';
|
||||||
import { Flex, Heading, IconButton, ScrollArea, Text } from '@radix-ui/themes';
|
import { Flex, Heading, IconButton, ScrollArea, Text } from '@radix-ui/themes';
|
||||||
import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
|
import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||||
import { Duel } from '../../../stores/duel';
|
import { Duel } from '../../../stores/duel';
|
||||||
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
|
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../../types/maybeSkeletonComponentProps';
|
||||||
@@ -10,7 +11,7 @@ import { Node } from './components/Node';
|
|||||||
|
|
||||||
type Line = number[];
|
type Line = number[];
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export const XP_MULTIPLIERS = [1, 2, 3, 4, 5, 10];
|
export const XP_MULTIPLIERS = [1, 2, 3, 4, 5, 10];
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { fetchReviews, youtubers } from '@blitzkit/core';
|
import { youtubers } from '@blitzkit/core';
|
||||||
import { Box, Flex, Heading, Link, Skeleton, Text } from '@radix-ui/themes';
|
import { Box, Flex, Heading, Link, Skeleton, Text } from '@radix-ui/themes';
|
||||||
|
import { awaitableReviews } from '../../core/awaitables/reviews';
|
||||||
import { Var } from '../../core/radix/var';
|
import { Var } from '../../core/radix/var';
|
||||||
import { Duel } from '../../stores/duel';
|
import { Duel } from '../../stores/duel';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
||||||
import { PageWrapper } from '../PageWrapper';
|
import { PageWrapper } from '../PageWrapper';
|
||||||
import { VerifiedIcon } from '../VerifiedIcon';
|
import { VerifiedIcon } from '../VerifiedIcon';
|
||||||
|
|
||||||
const reviews = await fetchReviews();
|
const reviews = await awaitableReviews;
|
||||||
|
|
||||||
export function VideoSection({ skeleton }: MaybeSkeletonComponentProps) {
|
export function VideoSection({ skeleton }: MaybeSkeletonComponentProps) {
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fetchTankDefinitions } from '@blitzkit/core';
|
|
||||||
import { Flex, Table } from '@radix-ui/themes';
|
import { Flex, Table } from '@radix-ui/themes';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||||
import { TierList } from '../../../stores/tierList';
|
import { TierList } from '../../../stores/tierList';
|
||||||
import { tierListRowElements } from '../Table/constants';
|
import { tierListRowElements } from '../Table/constants';
|
||||||
import { TierListTile } from '../Tile';
|
import { TierListTile } from '../Tile';
|
||||||
@@ -10,7 +10,7 @@ interface TierListRowProps {
|
|||||||
index: number;
|
index: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export function TierListRow({ index }: TierListRowProps) {
|
export function TierListRow({ index }: TierListRowProps) {
|
||||||
const tanks = TierList.use((state) => state.rows[index].tanks);
|
const tanks = TierList.use((state) => state.rows[index].tanks);
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import {
|
import { metaSortTank } from '@blitzkit/core';
|
||||||
fetchGameDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
metaSortTank,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
|
import { awaitableGameDefinitions } from '../../core/awaitables/gameDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../core/awaitables/tankDefinitions';
|
||||||
import { filterTank } from '../../core/blitzkit/filterTank';
|
import { filterTank } from '../../core/blitzkit/filterTank';
|
||||||
import { $tankFilters } from '../../stores/tankFilters';
|
import { $tankFilters } from '../../stores/tankFilters';
|
||||||
import { TierList } from '../../stores/tierList';
|
import { TierList } from '../../stores/tierList';
|
||||||
@@ -13,8 +11,11 @@ import { SkeletonTankCard } from '../TankSearch/components/SkeletonTankCard';
|
|||||||
import { TankCardWrapper } from '../TankSearch/components/TankCardWrapper';
|
import { TankCardWrapper } from '../TankSearch/components/TankCardWrapper';
|
||||||
import { TierListTile } from './Tile';
|
import { TierListTile } from './Tile';
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, gameDefinitions] = await Promise.all([
|
||||||
const gameDefinitions = await fetchGameDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableGameDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
const tanks = Object.values(tankDefinitions.tanks);
|
const tanks = Object.values(tankDefinitions.tanks);
|
||||||
|
|
||||||
const PREVIEW_COUNT = 32;
|
const PREVIEW_COUNT = 32;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { fetchTankDefinitions } from '@blitzkit/core';
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import { awaitableTankDefinitions } from '../../core/awaitables/tankDefinitions';
|
||||||
import { generateTierListParams } from '../../core/blitzkit/generateTierListParams';
|
import { generateTierListParams } from '../../core/blitzkit/generateTierListParams';
|
||||||
import { TierList } from '../../stores/tierList';
|
import { TierList } from '../../stores/tierList';
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export function URLManager() {
|
export function URLManager() {
|
||||||
const rows = TierList.use((state) => state.rows);
|
const rows = TierList.use((state) => state.rows);
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchAverageDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableAverageDefinitions = fetchAverageDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchConsumableDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableConsumableDefinitions = fetchConsumableDefinitions();
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { fetchDiscoveredIdsDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableDiscoveredIdsDefinitions =
|
||||||
|
fetchDiscoveredIdsDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchEquipmentDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableEquipmentDefinitions = fetchEquipmentDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchGameDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableGameDefinitions = fetchGameDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchModelDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableModelDefinitions = fetchModelDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchProvisionDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableProvisionDefinitions = fetchProvisionDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchReviews } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableReviews = fetchReviews();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchSkillDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableSkillDefinitions = fetchSkillDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchTankDefinitions } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableTankDefinitions = fetchTankDefinitions();
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { fetchTankNames } from '@blitzkit/core';
|
||||||
|
|
||||||
|
export const awaitableTankNames = fetchTankNames();
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
import {
|
import { awaitableAverageDefinitions } from '../core/awaitables/averageDefinitions';
|
||||||
fetchAverageDefinitions,
|
import { awaitableDiscoveredIdsDefinitions } from '../core/awaitables/discoveredIdsDefinitions';
|
||||||
fetchDiscoveredIdsDefinitions,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
|
|
||||||
const awaitedDiscoveredIdsDefinitions = await fetchDiscoveredIdsDefinitions();
|
const [discoveredIdsDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const awaitedAverageDefinitions = await fetchAverageDefinitions();
|
awaitableDiscoveredIdsDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function useAveragesExclusionRatio() {
|
export function useAveragesExclusionRatio() {
|
||||||
return (
|
return discoveredIdsDefinitions.count / averageDefinitions.samples.total;
|
||||||
awaitedDiscoveredIdsDefinitions.count /
|
|
||||||
awaitedAverageDefinitions.samples.total
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { fetchTankDefinitions, TankDefinition } from '@blitzkit/core';
|
import { TankDefinition } from '@blitzkit/core';
|
||||||
import { sumBy } from 'lodash-es';
|
import { sumBy } from 'lodash-es';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
import { awaitableTankDefinitions } from '../core/awaitables/tankDefinitions';
|
||||||
import { Duel } from '../stores/duel';
|
import { Duel } from '../stores/duel';
|
||||||
|
|
||||||
export enum UseEccentricityMode {
|
export enum UseEccentricityMode {
|
||||||
@@ -8,7 +9,7 @@ export enum UseEccentricityMode {
|
|||||||
Class,
|
Class,
|
||||||
}
|
}
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const tankDefinitions = await awaitableTankDefinitions;
|
||||||
|
|
||||||
export function useEccentricity(mode: UseEccentricityMode) {
|
export function useEccentricity(mode: UseEccentricityMode) {
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { fetchEquipmentDefinitions } from '@blitzkit/core';
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../core/awaitables/equipmentDefinitions';
|
||||||
import { Duel } from '../stores/duel';
|
import { Duel } from '../stores/duel';
|
||||||
|
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
const equipmentDefinitions = await awaitableEquipmentDefinitions;
|
||||||
|
|
||||||
export function useEquipment(id: number, antagonist = false) {
|
export function useEquipment(id: number, antagonist = false) {
|
||||||
const member = Duel.use(
|
const member = Duel.use(
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
import {
|
import { createDefaultSkills } from '@blitzkit/core';
|
||||||
createDefaultSkills,
|
|
||||||
fetchEquipmentDefinitions,
|
|
||||||
fetchModelDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
fetchSkillDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { PlusIcon } from '@radix-ui/react-icons';
|
import { PlusIcon } from '@radix-ui/react-icons';
|
||||||
import { Flex, Heading, Text } from '@radix-ui/themes';
|
import { Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
@@ -13,6 +6,11 @@ import { CompareTable } from '../../../components/Compare/CompareTable';
|
|||||||
import { Controls } from '../../../components/Compare/Controls';
|
import { Controls } from '../../../components/Compare/Controls';
|
||||||
import { DamageWarning } from '../../../components/DamageWarning';
|
import { DamageWarning } from '../../../components/DamageWarning';
|
||||||
import { PageWrapper } from '../../../components/PageWrapper';
|
import { PageWrapper } from '../../../components/PageWrapper';
|
||||||
|
import { awaitableEquipmentDefinitions } from '../../../core/awaitables/equipmentDefinitions';
|
||||||
|
import { awaitableModelDefinitions } from '../../../core/awaitables/modelDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../../core/awaitables/provisionDefinitions';
|
||||||
|
import { awaitableSkillDefinitions } from '../../../core/awaitables/skillDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||||
import { tankCharacteristics } from '../../../core/blitzkit/tankCharacteristics';
|
import { tankCharacteristics } from '../../../core/blitzkit/tankCharacteristics';
|
||||||
import { tankToCompareMember } from '../../../core/blitzkit/tankToCompareMember';
|
import { tankToCompareMember } from '../../../core/blitzkit/tankToCompareMember';
|
||||||
import { App } from '../../../stores/app';
|
import { App } from '../../../stores/app';
|
||||||
@@ -20,11 +18,19 @@ import { CompareEphemeral } from '../../../stores/compareEphemeral';
|
|||||||
import { ComparePersistent } from '../../../stores/comparePersistent';
|
import { ComparePersistent } from '../../../stores/comparePersistent';
|
||||||
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||||
|
|
||||||
const modelDefinitions = await fetchModelDefinitions();
|
const [
|
||||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
modelDefinitions,
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
equipmentDefinitions,
|
||||||
const skillDefinitions = await fetchSkillDefinitions();
|
provisionDefinitions,
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
skillDefinitions,
|
||||||
|
tankDefinitions,
|
||||||
|
] = await Promise.all([
|
||||||
|
awaitableModelDefinitions,
|
||||||
|
awaitableEquipmentDefinitions,
|
||||||
|
awaitableProvisionDefinitions,
|
||||||
|
awaitableSkillDefinitions,
|
||||||
|
awaitableTankDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function Page() {
|
export function Page() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import {
|
|||||||
compositeStats,
|
compositeStats,
|
||||||
compositeStatsKeys,
|
compositeStatsKeys,
|
||||||
deltaTankStats,
|
deltaTankStats,
|
||||||
fetchAverageDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
formatCompositeStat,
|
formatCompositeStat,
|
||||||
getAccountInfo,
|
getAccountInfo,
|
||||||
getTankStats,
|
getTankStats,
|
||||||
@@ -39,10 +37,14 @@ import { PageWrapper } from '../../../components/PageWrapper';
|
|||||||
import { StickyRowHeaderCell } from '../../../components/StickyRowHeaderCell';
|
import { StickyRowHeaderCell } from '../../../components/StickyRowHeaderCell';
|
||||||
import { StickyTableRoot } from '../../../components/StickyTableRoot';
|
import { StickyTableRoot } from '../../../components/StickyTableRoot';
|
||||||
import { TankRowHeaderCell } from '../../../components/TankRowHeaderCell';
|
import { TankRowHeaderCell } from '../../../components/TankRowHeaderCell';
|
||||||
|
import { awaitableAverageDefinitions } from '../../../core/awaitables/averageDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||||
import { Session, type SessionTracking } from '../../../stores/session';
|
import { Session, type SessionTracking } from '../../../stores/session';
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, averageDefinitions] = await Promise.all([
|
||||||
const tankAverages = await fetchAverageDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableAverageDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function Page() {
|
export function Page() {
|
||||||
return (
|
return (
|
||||||
@@ -85,7 +87,7 @@ function Content() {
|
|||||||
.sort((a, b) => b.last_battle_time - a.last_battle_time)
|
.sort((a, b) => b.last_battle_time - a.last_battle_time)
|
||||||
.map((entry) => {
|
.map((entry) => {
|
||||||
const tank = tankDefinitions.tanks[entry.tank_id];
|
const tank = tankDefinitions.tanks[entry.tank_id];
|
||||||
const average = tankAverages.averages[tank.id];
|
const average = averageDefinitions.averages[tank.id];
|
||||||
const composite = compositeStats(
|
const composite = compositeStats(
|
||||||
{ ...entry.all, battle_life_time: entry.battle_life_time },
|
{ ...entry.all, battle_life_time: entry.battle_life_time },
|
||||||
average?.mu,
|
average?.mu,
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
import {
|
|
||||||
fetchModelDefinitions,
|
|
||||||
fetchProvisionDefinitions,
|
|
||||||
fetchTankDefinitions,
|
|
||||||
} from '@blitzkit/core';
|
|
||||||
import { PageWrapper } from '../../../../components/PageWrapper';
|
import { PageWrapper } from '../../../../components/PageWrapper';
|
||||||
import { CalloutsSection } from '../../../../components/Tankopedia/CalloutsSection';
|
import { CalloutsSection } from '../../../../components/Tankopedia/CalloutsSection';
|
||||||
import { CharacteristicsSection } from '../../../../components/Tankopedia/CharacteristicsSection';
|
import { CharacteristicsSection } from '../../../../components/Tankopedia/CharacteristicsSection';
|
||||||
@@ -12,6 +7,9 @@ import { HistorySection } from '../../../../components/Tankopedia/HistorySection
|
|||||||
import { MetaSection } from '../../../../components/Tankopedia/MetaSection';
|
import { MetaSection } from '../../../../components/Tankopedia/MetaSection';
|
||||||
import { TechTreeSection } from '../../../../components/Tankopedia/TechTreeSection';
|
import { TechTreeSection } from '../../../../components/Tankopedia/TechTreeSection';
|
||||||
import { VideoSection } from '../../../../components/Tankopedia/VideoSection';
|
import { VideoSection } from '../../../../components/Tankopedia/VideoSection';
|
||||||
|
import { awaitableModelDefinitions } from '../../../../core/awaitables/modelDefinitions';
|
||||||
|
import { awaitableProvisionDefinitions } from '../../../../core/awaitables/provisionDefinitions';
|
||||||
|
import { awaitableTankDefinitions } from '../../../../core/awaitables/tankDefinitions';
|
||||||
import { App } from '../../../../stores/app';
|
import { App } from '../../../../stores/app';
|
||||||
import { Duel } from '../../../../stores/duel';
|
import { Duel } from '../../../../stores/duel';
|
||||||
import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
|
import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
|
||||||
@@ -22,9 +20,12 @@ type PageProps = MaybeSkeletonComponentProps & {
|
|||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const tankDefinitions = await fetchTankDefinitions();
|
const [tankDefinitions, provisionDefinitions, modelDefinitions] =
|
||||||
const provisionDefinitions = await fetchProvisionDefinitions();
|
await Promise.all([
|
||||||
const modelDefinitions = await fetchModelDefinitions();
|
awaitableTankDefinitions,
|
||||||
|
awaitableProvisionDefinitions,
|
||||||
|
awaitableModelDefinitions,
|
||||||
|
]);
|
||||||
|
|
||||||
export function Page({ id, skeleton }: PageProps) {
|
export function Page({ id, skeleton }: PageProps) {
|
||||||
const tank = tankDefinitions.tanks[id];
|
const tank = tankDefinitions.tanks[id];
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
createDefaultSkills,
|
createDefaultSkills,
|
||||||
fetchSkillDefinitions,
|
|
||||||
ShellDefinition,
|
ShellDefinition,
|
||||||
type ModelDefinition,
|
type ModelDefinition,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
@@ -10,6 +9,7 @@ import { subscribeWithSelector } from 'zustand/middleware';
|
|||||||
import type { ArmorType } from '../components/Armor/components/SpacedArmorScene';
|
import type { ArmorType } from '../components/Armor/components/SpacedArmorScene';
|
||||||
import type { ExternalModuleVariant } from '../components/Armor/components/SpacedArmorSceneComponent';
|
import type { ExternalModuleVariant } from '../components/Armor/components/SpacedArmorSceneComponent';
|
||||||
import type { XP_MULTIPLIERS } from '../components/Tankopedia/TechTreeSection';
|
import type { XP_MULTIPLIERS } from '../components/Tankopedia/TechTreeSection';
|
||||||
|
import { awaitableSkillDefinitions } from '../core/awaitables/skillDefinitions';
|
||||||
import { createContextualStore } from '../core/zustand/createContextualStore';
|
import { createContextualStore } from '../core/zustand/createContextualStore';
|
||||||
|
|
||||||
export interface ShotLayerBase {
|
export interface ShotLayerBase {
|
||||||
@@ -102,7 +102,7 @@ interface TankopediaEphemeral {
|
|||||||
customShell?: ShellDefinition;
|
customShell?: ShellDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
const skillDefinitions = await fetchSkillDefinitions();
|
const skillDefinitions = await awaitableSkillDefinitions;
|
||||||
|
|
||||||
export const TankopediaEphemeral = createContextualStore(
|
export const TankopediaEphemeral = createContextualStore(
|
||||||
(model: ModelDefinition) => {
|
(model: ModelDefinition) => {
|
||||||
|
|||||||
Reference in new issue
Block a user