mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
update (3)
This commit is contained in:
1 parent
d41d45abae
commit
ed92440b94
14 files changed
+61
-94
No files matched your search
@@ -1,12 +1,8 @@
|
||||
import {
|
||||
asset,
|
||||
fetchTankDefinitions,
|
||||
TankType,
|
||||
type TankDefinition,
|
||||
} from "@blitzkit/core";
|
||||
import { asset, TankType, type TankDefinition } from "@blitzkit/core";
|
||||
import { Flex, Text, type TextProps } from "@radix-ui/themes";
|
||||
import { uniq } from "lodash-es";
|
||||
import { forwardRef, type ReactNode } from "react";
|
||||
import { api } from "../../core/blitzkit/api";
|
||||
import { useLocale } from "../../hooks/useLocale";
|
||||
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
||||
import { classIcons } from "../ClassIcon";
|
||||
@@ -21,7 +17,7 @@ type TankCardProps = TextProps & {
|
||||
noLink?: boolean;
|
||||
};
|
||||
|
||||
const tankDefinitions = await fetchTankDefinitions();
|
||||
const tankDefinitions = await api.tankDefinitions();
|
||||
|
||||
export const TankCard = forwardRef<HTMLSpanElement, TankCardProps>(
|
||||
(
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type TankDefinition,
|
||||
} from "@blitzkit/core";
|
||||
import { useMemo } from "react";
|
||||
import { awaitableModelDefinitions } from "../../../core/awaitables/modelDefinitions";
|
||||
import { api } from "../../../core/blitzkit/api";
|
||||
import { resolveReload } from "../../../core/blitzkit/resolveReload";
|
||||
import { TankSort } from "../../../stores/tankopediaSort";
|
||||
import { TankCard } from "../../TankCard";
|
||||
@@ -15,7 +15,7 @@ interface TankSearchCardProps {
|
||||
onSelect?: (tank: TankDefinition) => void;
|
||||
}
|
||||
|
||||
const modelDefinitions = await awaitableModelDefinitions;
|
||||
const modelDefinitions = await api.modelDefinitions();
|
||||
|
||||
export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
||||
const by = TankSort.use((state) => state.by);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
asset,
|
||||
GunDefinition,
|
||||
ShellType,
|
||||
TANK_CLASSES,
|
||||
@@ -27,10 +26,7 @@ import {
|
||||
} from "@radix-ui/themes";
|
||||
import { times } from "lodash-es";
|
||||
import { Fragment, type ComponentProps, type ReactNode } from "react";
|
||||
import { awaitableConsumableDefinitions } from "../../../core/awaitables/consumableDefinitions";
|
||||
import { awaitableGameDefinitions } from "../../../core/awaitables/gameDefinitions";
|
||||
import { awaitableProvisionDefinitions } from "../../../core/awaitables/provisionDefinitions";
|
||||
import { awaitableTankDefinitions } from "../../../core/awaitables/tankDefinitions";
|
||||
import { api } from "../../../core/blitzkit/api";
|
||||
import { useLocale } from "../../../hooks/useLocale";
|
||||
import { App } from "../../../stores/app";
|
||||
import { TankFilters, type CaseType } from "../../../stores/tankFilters";
|
||||
@@ -43,10 +39,10 @@ import { ResearchedIcon } from "../../ResearchedIcon";
|
||||
import { ScienceIcon } from "../../ScienceIcon";
|
||||
import { ScienceOffIcon } from "../../ScienceOffIcon";
|
||||
|
||||
const gameDefinitions = await awaitableGameDefinitions;
|
||||
const consumableDefinitions = await awaitableConsumableDefinitions;
|
||||
const provisionDefinitions = await awaitableProvisionDefinitions;
|
||||
const tankDefinitions = await awaitableTankDefinitions;
|
||||
const gameDefinitions = await api.gameDefinitions();
|
||||
const consumableDefinitions = await api.consumableDefinitions();
|
||||
const provisionDefinitions = await api.provisionDefinitions();
|
||||
const tankDefinitions = await api.tankDefinitions();
|
||||
|
||||
const gameModeRoleSets: Record<number, Set<number>> = {};
|
||||
|
||||
@@ -313,7 +309,7 @@ function NationsFilter() {
|
||||
width: "1.25em",
|
||||
height: "1.25em",
|
||||
}}
|
||||
src={asset(`flags/circle/${nation}.webp`)}
|
||||
src={`/api/flags/circle/${nation}.webp`}
|
||||
/>
|
||||
))}
|
||||
</Flex>
|
||||
@@ -350,9 +346,7 @@ function NationsFilter() {
|
||||
right="0"
|
||||
mr="-2"
|
||||
style={{
|
||||
backgroundImage: `url(${asset(
|
||||
`flags/scratched/${nation}.webp`,
|
||||
)})`,
|
||||
backgroundImage: `url(${`/api/flags/scratched/${nation}.webp`})`,
|
||||
backgroundSize: "100%",
|
||||
backgroundRepeat: "no-repeat",
|
||||
backgroundPosition: "5rem center",
|
||||
@@ -685,11 +679,9 @@ function IndividualShellFilter({
|
||||
{shells[index] !== null && (
|
||||
<img
|
||||
style={{ width: "1em", height: "1em" }}
|
||||
src={asset(
|
||||
`icons/shells/${shellTypeIcons[shells[index]]}${
|
||||
premium ? "_premium" : ""
|
||||
}.webp`,
|
||||
)}
|
||||
src={`/api/icons/shells/${shellTypeIcons[shells[index]]}${
|
||||
premium ? "_premium" : ""
|
||||
}.webp`}
|
||||
/>
|
||||
)}
|
||||
</IconButton>
|
||||
@@ -720,11 +712,9 @@ function IndividualShellFilter({
|
||||
color={selected ? undefined : "gray"}
|
||||
>
|
||||
<img
|
||||
src={asset(
|
||||
`icons/shells/${shellTypeIcons[shellType]}${
|
||||
premium ? "_premium" : ""
|
||||
}.webp`,
|
||||
)}
|
||||
src={`/api/icons/shells/${shellTypeIcons[shellType]}${
|
||||
premium ? "_premium" : ""
|
||||
}.webp`}
|
||||
style={{ width: "1.25em", height: "1.25em" }}
|
||||
/>
|
||||
|
||||
@@ -893,7 +883,7 @@ function ConsumablesFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(`icons/consumables/${consumable}.webp`)}
|
||||
src={`/api/icons/consumables/${consumable}.webp`}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -938,7 +928,7 @@ function ConsumablesFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(`icons/consumables/${consumable}.webp`)}
|
||||
src={`/api/icons/consumables/${consumable}.webp`}
|
||||
/>
|
||||
|
||||
{unwrap(consumableDefinition.name!)}
|
||||
@@ -987,7 +977,7 @@ function ProvisionsFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(`icons/provisions/${provision}.webp`)}
|
||||
src={`/api/icons/provisions/${provision}.webp`}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -1032,7 +1022,7 @@ function ProvisionsFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(`icons/provisions/${provision}.webp`)}
|
||||
src={`/api/icons/provisions/${provision}.webp`}
|
||||
/>
|
||||
|
||||
{unwrap(provisionDefinition.name!)}
|
||||
@@ -1075,8 +1065,8 @@ function GameModeAbilitiesFilter() {
|
||||
: rawPowers;
|
||||
|
||||
const icons = [
|
||||
...abilities.map((ability) => `icons/consumables/${ability}.webp`),
|
||||
...powers.map((power) => `icons/provisions/${power}.webp`),
|
||||
...abilities.map((ability) => `api/icons/consumables/${ability}.webp`),
|
||||
...powers.map((power) => `api/icons/provisions/${power}.webp`),
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -1094,7 +1084,7 @@ function GameModeAbilitiesFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(icon)}
|
||||
src={icon}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -1161,7 +1151,7 @@ function GameModeAbilitiesFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(`icons/consumables/${consumable}.webp`)}
|
||||
src={`/api/icons/consumables/${consumable}.webp`}
|
||||
/>
|
||||
|
||||
{unwrap(abilityDefinition.name!)}
|
||||
@@ -1210,7 +1200,7 @@ function GameModeAbilitiesFilter() {
|
||||
height: "1.25em",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
src={asset(`icons/provisions/${provision}.webp`)}
|
||||
src={`/api/icons/provisions/${provision}.webp`}
|
||||
/>
|
||||
|
||||
{unwrap(powerDefinition.name!)}
|
||||
|
||||
Reference in new issue
Block a user