mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-20 04:14:12 +01:00
feat: renaming
This commit is contained in:
1 parent
8b527f2333
commit
96482d4268
38 files changed
+931
-943
No files matched your search
+12
-14
@@ -1,17 +1,15 @@
|
||||
import { TIER_ROMAN_NUMERALS } from '@blitzkit/core';
|
||||
import { literals } from '@blitzkit/i18n/src/literals';
|
||||
import { Flex, SegmentedControl, Text, type FlexProps } from '@radix-ui/themes';
|
||||
import { useLocale } from '../../../../../../hooks/useLocale';
|
||||
import { Duel } from '../../../../../../stores/duel';
|
||||
import { TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
||||
import { literals } from "@blitzkit/i18n/src/literals";
|
||||
import { Flex, SegmentedControl, Text, type FlexProps } from "@radix-ui/themes";
|
||||
import { useLocale } from "../../../../../../hooks/useLocale";
|
||||
import { Duel } from "../../../../../../stores/duel";
|
||||
import {
|
||||
TankopediaEphemeral,
|
||||
Tankopedia,
|
||||
TankopediaRelativeAgainst,
|
||||
} from '../../../../../../stores/tankopediaEphemeral';
|
||||
} from "../../../../../../stores/tankopedia";
|
||||
|
||||
export function CompareOptions(props: FlexProps) {
|
||||
const relativeAgainst = TankopediaEphemeral.use(
|
||||
(state) => state.relativeAgainst,
|
||||
);
|
||||
const relativeAgainst = Tankopedia.use((state) => state.relativeAgainst);
|
||||
const tank = Duel.use((state) => state.protagonist.tank);
|
||||
const { strings } = useLocale();
|
||||
|
||||
@@ -20,7 +18,7 @@ export function CompareOptions(props: FlexProps) {
|
||||
align="center"
|
||||
gap="2"
|
||||
justify="center"
|
||||
direction={{ initial: 'column', sm: 'row' }}
|
||||
direction={{ initial: "column", sm: "row" }}
|
||||
{...props}
|
||||
>
|
||||
<Text color="gray">
|
||||
@@ -32,7 +30,7 @@ export function CompareOptions(props: FlexProps) {
|
||||
size="1"
|
||||
value={`${relativeAgainst}`}
|
||||
onValueChange={(value) => {
|
||||
TankopediaEphemeral.mutate((draft) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.relativeAgainst = Number(value) as TankopediaRelativeAgainst;
|
||||
});
|
||||
}}
|
||||
@@ -43,13 +41,13 @@ export function CompareOptions(props: FlexProps) {
|
||||
[
|
||||
TIER_ROMAN_NUMERALS[tank.tier],
|
||||
strings.common.tank_class_short_plural_lowercase[tank.class],
|
||||
],
|
||||
]
|
||||
)}
|
||||
</SegmentedControl.Item>
|
||||
<SegmentedControl.Item value={`${TankopediaRelativeAgainst.Tier}`}>
|
||||
{literals(
|
||||
strings.website.tools.tankopedia.characteristics.compare.tier,
|
||||
[TIER_ROMAN_NUMERALS[tank.tier]],
|
||||
[TIER_ROMAN_NUMERALS[tank.tier]]
|
||||
)}
|
||||
</SegmentedControl.Item>
|
||||
<SegmentedControl.Item value={`${TankopediaRelativeAgainst.All}`}>
|
||||
|
||||
+19
-19
@@ -1,10 +1,10 @@
|
||||
import { CaretDownIcon, CaretUpIcon } from '@radix-ui/react-icons';
|
||||
import { Box, Flex, Text } from '@radix-ui/themes';
|
||||
import fuzzysort from 'fuzzysort';
|
||||
import { Quicklime } from 'quicklime';
|
||||
import { useEffect, useRef, type ReactNode } from 'react';
|
||||
import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral';
|
||||
import { Mark } from '../../../../../Mark';
|
||||
import { CaretDownIcon, CaretUpIcon } from "@radix-ui/react-icons";
|
||||
import { Box, Flex, Text } from "@radix-ui/themes";
|
||||
import fuzzysort from "fuzzysort";
|
||||
import { Quicklime } from "quicklime";
|
||||
import { useEffect, useRef, type ReactNode } from "react";
|
||||
import { Tankopedia } from "../../../../../../stores/tankopedia";
|
||||
import { Mark } from "../../../../../Mark";
|
||||
|
||||
export const highlightedRows = new Set<HTMLDivElement>();
|
||||
export const highlightedRowsUpdate = new Quicklime();
|
||||
@@ -16,7 +16,7 @@ export interface InfoProps {
|
||||
delta?: number;
|
||||
decimals?: number;
|
||||
prefix?: string;
|
||||
deltaType?: 'higherIsBetter' | 'lowerIsBetter';
|
||||
deltaType?: "higherIsBetter" | "lowerIsBetter";
|
||||
}
|
||||
|
||||
export function Info({
|
||||
@@ -26,15 +26,15 @@ export function Info({
|
||||
delta,
|
||||
decimals,
|
||||
prefix,
|
||||
deltaType = 'higherIsBetter',
|
||||
deltaType = "higherIsBetter",
|
||||
}: InfoProps) {
|
||||
const statSearch = TankopediaEphemeral.use((state) => state.statSearch);
|
||||
const statSearch = Tankopedia.use((state) => state.statSearch);
|
||||
const container = useRef<HTMLDivElement>(null);
|
||||
|
||||
let label = name;
|
||||
let highlighted = false;
|
||||
|
||||
if (statSearch !== undefined && typeof name === 'string') {
|
||||
if (statSearch !== undefined && typeof name === "string") {
|
||||
const result = fuzzysort.single(statSearch, name);
|
||||
|
||||
if (result) {
|
||||
@@ -62,7 +62,7 @@ export function Info({
|
||||
return (
|
||||
<Flex
|
||||
align="center"
|
||||
pl={indent ? '2' : '0'}
|
||||
pl={indent ? "2" : "0"}
|
||||
width="100%"
|
||||
gap="4"
|
||||
ref={container}
|
||||
@@ -77,9 +77,9 @@ export function Info({
|
||||
<>
|
||||
<Text
|
||||
color={
|
||||
delta * (deltaType === 'lowerIsBetter' ? -1 : 1) > 0
|
||||
? 'green'
|
||||
: 'tomato'
|
||||
delta * (deltaType === "lowerIsBetter" ? -1 : 1) > 0
|
||||
? "green"
|
||||
: "tomato"
|
||||
}
|
||||
>
|
||||
{decimals !== undefined
|
||||
@@ -88,9 +88,9 @@ export function Info({
|
||||
</Text>
|
||||
<Text
|
||||
color={
|
||||
delta * (deltaType === 'lowerIsBetter' ? -1 : 1) > 0
|
||||
? 'green'
|
||||
: 'tomato'
|
||||
delta * (deltaType === "lowerIsBetter" ? -1 : 1) > 0
|
||||
? "green"
|
||||
: "tomato"
|
||||
}
|
||||
>
|
||||
{delta > 0 ? <CaretUpIcon /> : <CaretDownIcon />}
|
||||
@@ -105,7 +105,7 @@ export function Info({
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{decimals !== undefined && typeof children === 'number'
|
||||
{decimals !== undefined && typeof children === "number"
|
||||
? children.toFixed(decimals)
|
||||
: children}
|
||||
</Text>
|
||||
|
||||
+38
-40
@@ -1,27 +1,27 @@
|
||||
import { createDefaultSkills } from '@blitzkit/core';
|
||||
import { Flex, Progress, Text } from '@radix-ui/themes';
|
||||
import { clamp } from 'lodash-es';
|
||||
import { memo, useMemo, type ComponentProps, type ReactNode } 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 { createDefaultSkills } from "@blitzkit/core";
|
||||
import { Flex, Progress, Text } from "@radix-ui/themes";
|
||||
import { clamp } from "lodash-es";
|
||||
import { memo, useMemo, type ComponentProps, type ReactNode } 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 {
|
||||
tankCharacteristics,
|
||||
type TankCharacteristics,
|
||||
} from '../../../../../../core/blitzkit/tankCharacteristics';
|
||||
import { tankToDuelMember } from '../../../../../../core/blitzkit/tankToDuelMember';
|
||||
import { useDelta } from '../../../../../../hooks/useDelta';
|
||||
import { useLocale } from '../../../../../../hooks/useLocale';
|
||||
import { Duel } from '../../../../../../stores/duel';
|
||||
} from "../../../../../../core/blitzkit/tankCharacteristics";
|
||||
import { tankToDuelMember } from "../../../../../../core/blitzkit/tankToDuelMember";
|
||||
import { useDelta } from "../../../../../../hooks/useDelta";
|
||||
import { useLocale } from "../../../../../../hooks/useLocale";
|
||||
import { Duel } from "../../../../../../stores/duel";
|
||||
import {
|
||||
TankopediaEphemeral,
|
||||
Tankopedia,
|
||||
TankopediaRelativeAgainst,
|
||||
} from '../../../../../../stores/tankopediaEphemeral';
|
||||
import { Info, type InfoProps } from './Info';
|
||||
} from "../../../../../../stores/tankopedia";
|
||||
import { Info, type InfoProps } from "./Info";
|
||||
|
||||
type InfoWithDeltaProps = Omit<InfoProps, 'name'> & {
|
||||
type InfoWithDeltaProps = Omit<InfoProps, "name"> & {
|
||||
stats: TankCharacteristics;
|
||||
noRanking?: boolean;
|
||||
} & (
|
||||
@@ -51,20 +51,18 @@ const [
|
||||
export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
({ stats, indent, noRanking, deltaType, ...props }) => {
|
||||
const { strings } = useLocale();
|
||||
const relativeAgainst = TankopediaEphemeral.use(
|
||||
(state) => state.relativeAgainst,
|
||||
);
|
||||
const relativeAgainst = Tankopedia.use((state) => state.relativeAgainst);
|
||||
const uhWhatDoICallThisVariable =
|
||||
typeof props.value === 'function'
|
||||
typeof props.value === "function"
|
||||
? props.value(stats)!
|
||||
: (stats[props.value] as number);
|
||||
const delta = useDelta(uhWhatDoICallThisVariable);
|
||||
const protagonistTank = Duel.use((state) => state.protagonist.tank);
|
||||
const shellIndex = Duel.use((state) =>
|
||||
state.protagonist.gun.shells.indexOf(state.protagonist.shell),
|
||||
state.protagonist.gun.shells.indexOf(state.protagonist.shell)
|
||||
);
|
||||
const equipmentMatrix = Duel.use(
|
||||
(state) => state.protagonist.equipmentMatrix,
|
||||
(state) => state.protagonist.equipmentMatrix
|
||||
);
|
||||
const others = useMemo(() => {
|
||||
const defaultSkills = createDefaultSkills(skillDefinitions);
|
||||
@@ -77,7 +75,7 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
tank.class === protagonistTank.class) ||
|
||||
(relativeAgainst === TankopediaRelativeAgainst.Tier &&
|
||||
tank.tier === protagonistTank.tier) ||
|
||||
relativeAgainst === TankopediaRelativeAgainst.All,
|
||||
relativeAgainst === TankopediaRelativeAgainst.All
|
||||
)
|
||||
.map((tank) => {
|
||||
const member = tankToDuelMember(tank, provisionDefinitions);
|
||||
@@ -112,14 +110,14 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
equipmentDefinitions,
|
||||
provisionDefinitions,
|
||||
tankModelDefinition: modelDefinitions.models[tank.id],
|
||||
},
|
||||
}
|
||||
);
|
||||
})
|
||||
.filter((tank) => {
|
||||
if (tank === undefined) return false;
|
||||
|
||||
const othersValue =
|
||||
typeof props.value === 'function'
|
||||
typeof props.value === "function"
|
||||
? props.value(tank)!
|
||||
: (tank[props.value] as number);
|
||||
|
||||
@@ -128,22 +126,22 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
}, [relativeAgainst, shellIndex, equipmentMatrix]);
|
||||
const betterTanks = others.filter((tank) => {
|
||||
const othersValue =
|
||||
typeof props.value === 'function'
|
||||
typeof props.value === "function"
|
||||
? props.value(tank)!
|
||||
: (tank[props.value] as number);
|
||||
|
||||
if (othersValue === undefined) return false;
|
||||
return deltaType === 'lowerIsBetter'
|
||||
return deltaType === "lowerIsBetter"
|
||||
? othersValue < uhWhatDoICallThisVariable
|
||||
: othersValue > uhWhatDoICallThisVariable;
|
||||
});
|
||||
const goodness = (others.length - betterTanks.length) / others.length;
|
||||
let color: ComponentProps<typeof Progress>['color'];
|
||||
let color: ComponentProps<typeof Progress>["color"];
|
||||
|
||||
if (goodness <= 0.25) color = 'red';
|
||||
else if (goodness <= 0.5) color = 'orange';
|
||||
else if (goodness <= 0.75) color = 'yellow';
|
||||
else color = 'green';
|
||||
if (goodness <= 0.25) color = "red";
|
||||
else if (goodness <= 0.5) color = "orange";
|
||||
else if (goodness <= 0.75) color = "yellow";
|
||||
else color = "green";
|
||||
|
||||
return (
|
||||
<Flex direction="column">
|
||||
@@ -151,7 +149,7 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
deltaType={deltaType}
|
||||
indent={indent}
|
||||
name={
|
||||
'name' in props
|
||||
"name" in props
|
||||
? props.name
|
||||
: strings.website.tools.tankopedia.characteristics.values[
|
||||
props.value
|
||||
@@ -164,17 +162,17 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
</Info>
|
||||
|
||||
{!noRanking && (
|
||||
<Flex pl={indent ? '2' : '0'} align="center" gap="2">
|
||||
<Flex pl={indent ? "2" : "0"} align="center" gap="2">
|
||||
<Progress
|
||||
variant="soft"
|
||||
size="1"
|
||||
value={goodness * 100}
|
||||
color={color}
|
||||
style={{ height: '0.125rem', opacity: 0.5 }}
|
||||
style={{ height: "0.125rem", opacity: 0.5 }}
|
||||
/>
|
||||
|
||||
<Text color="gray" size="1">
|
||||
{clamp(betterTanks.length + 1, 1, others.length)} /{' '}
|
||||
{clamp(betterTanks.length + 1, 1, others.length)} /{" "}
|
||||
{others.length}
|
||||
</Text>
|
||||
</Flex>
|
||||
@@ -184,6 +182,6 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||
},
|
||||
|
||||
(a, b) =>
|
||||
(typeof a.value === 'function' ? a.value(a.stats) : a.stats[a.value]) ===
|
||||
(typeof b.value === 'function' ? b.value(b.stats) : b.stats[b.value]),
|
||||
(typeof a.value === "function" ? a.value(a.stats) : a.stats[a.value]) ===
|
||||
(typeof b.value === "function" ? b.value(b.stats) : b.stats[b.value])
|
||||
);
|
||||
+19
-19
@@ -1,10 +1,10 @@
|
||||
import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
|
||||
import { Flex, Spinner, TextField, type FlexProps } from '@radix-ui/themes';
|
||||
import { debounce } from 'lodash-es';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useLocale } from '../../../../../../hooks/useLocale';
|
||||
import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral';
|
||||
import { highlightedRows, highlightedRowsUpdate } from './Info';
|
||||
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
|
||||
import { Flex, Spinner, TextField, type FlexProps } from "@radix-ui/themes";
|
||||
import { debounce } from "lodash-es";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useLocale } from "../../../../../../hooks/useLocale";
|
||||
import { Tankopedia } from "../../../../../../stores/tankopedia";
|
||||
import { highlightedRows, highlightedRowsUpdate } from "./Info";
|
||||
|
||||
export function StatSearch(props: FlexProps) {
|
||||
const { strings } = useLocale();
|
||||
@@ -19,7 +19,7 @@ export function StatSearch(props: FlexProps) {
|
||||
setSearching(true);
|
||||
} else {
|
||||
setSearching(false);
|
||||
count.current.textContent = '';
|
||||
count.current.textContent = "";
|
||||
}
|
||||
|
||||
requestUpdate();
|
||||
@@ -30,21 +30,21 @@ export function StatSearch(props: FlexProps) {
|
||||
if (!input.current || !count.current) return;
|
||||
|
||||
if (input.current.value.length === 0) {
|
||||
count.current.textContent = '';
|
||||
count.current.textContent = "";
|
||||
|
||||
setSearching(false);
|
||||
TankopediaEphemeral.mutate((draft) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.statSearch = undefined;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setSearching(false);
|
||||
TankopediaEphemeral.mutate((draft) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.statSearch = input.current!.value;
|
||||
});
|
||||
}, 500),
|
||||
[],
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -52,7 +52,7 @@ export function StatSearch(props: FlexProps) {
|
||||
if (!count.current || !input.current) return;
|
||||
|
||||
count.current.textContent =
|
||||
input.current.value.length === 0 ? '' : `0 / ${highlightedRows.size}`;
|
||||
input.current.value.length === 0 ? "" : `0 / ${highlightedRows.size}`;
|
||||
};
|
||||
|
||||
highlightedRowsUpdate.on(handleHighlightedRowsUpdate);
|
||||
@@ -68,23 +68,23 @@ export function StatSearch(props: FlexProps) {
|
||||
ref={input}
|
||||
placeholder={strings.website.tools.tankopedia.search}
|
||||
variant="classic"
|
||||
style={{ width: '100%' }}
|
||||
style={{ width: "100%" }}
|
||||
onChange={search}
|
||||
onKeyDown={(event) => {
|
||||
if (!count.current) return;
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
if (event.key === "Enter") {
|
||||
const newIndex = (index + 1) % highlightedRows.size;
|
||||
count.current.textContent = `${newIndex + 1} / ${highlightedRows.size}`;
|
||||
const array = [...highlightedRows];
|
||||
|
||||
array.forEach((element) => element.classList.remove('focused'));
|
||||
array.forEach((element) => element.classList.remove("focused"));
|
||||
|
||||
if (array[newIndex]) {
|
||||
array[newIndex].classList.add('focused');
|
||||
array[newIndex].classList.add("focused");
|
||||
array[newIndex].scrollIntoView({
|
||||
block: 'center',
|
||||
inline: 'center',
|
||||
block: "center",
|
||||
inline: "center",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+30
-30
@@ -1,19 +1,19 @@
|
||||
import { Flex } from '@radix-ui/themes';
|
||||
import { useEffect } from 'react';
|
||||
import { awaitableEquipmentDefinitions } from '../../../../../core/awaitables/equipmentDefinitions';
|
||||
import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions';
|
||||
import { applyPitchYawLimits } from '../../../../../core/blitz/applyPitchYawLimits';
|
||||
import { modelTransformEvent } from '../../../../../core/blitzkit/modelTransform';
|
||||
import { tankCharacteristics } from '../../../../../core/blitzkit/tankCharacteristics';
|
||||
import { useEquipment } from '../../../../../hooks/useEquipment';
|
||||
import { useTankModelDefinition } from '../../../../../hooks/useTankModelDefinition';
|
||||
import { Duel } from '../../../../../stores/duel';
|
||||
import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral';
|
||||
import type { MaybeSkeletonComponentProps } from '../../../../../types/maybeSkeletonComponentProps';
|
||||
import { Crew } from './components/Crew';
|
||||
import { Firepower } from './components/Firepower';
|
||||
import { Maneuverability } from './components/Maneuverability';
|
||||
import { Survivability } from './components/Survivability';
|
||||
import { Flex } from "@radix-ui/themes";
|
||||
import { useEffect } from "react";
|
||||
import { awaitableEquipmentDefinitions } from "../../../../../core/awaitables/equipmentDefinitions";
|
||||
import { awaitableProvisionDefinitions } from "../../../../../core/awaitables/provisionDefinitions";
|
||||
import { applyPitchYawLimits } from "../../../../../core/blitz/applyPitchYawLimits";
|
||||
import { modelTransformEvent } from "../../../../../core/blitzkit/modelTransform";
|
||||
import { tankCharacteristics } from "../../../../../core/blitzkit/tankCharacteristics";
|
||||
import { useEquipment } from "../../../../../hooks/useEquipment";
|
||||
import { useTankModelDefinition } from "../../../../../hooks/useTankModelDefinition";
|
||||
import { Duel } from "../../../../../stores/duel";
|
||||
import { Tankopedia } from "../../../../../stores/tankopedia";
|
||||
import type { MaybeSkeletonComponentProps } from "../../../../../types/maybeSkeletonComponentProps";
|
||||
import { Crew } from "./components/Crew";
|
||||
import { Firepower } from "./components/Firepower";
|
||||
import { Maneuverability } from "./components/Maneuverability";
|
||||
import { Survivability } from "./components/Survivability";
|
||||
|
||||
const [equipmentDefinitions, provisionDefinitions] = await Promise.all([
|
||||
awaitableEquipmentDefinitions,
|
||||
@@ -21,18 +21,18 @@ const [equipmentDefinitions, provisionDefinitions] = await Promise.all([
|
||||
]);
|
||||
|
||||
export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
||||
const crewSkills = TankopediaEphemeral.use((state) => state.skills);
|
||||
const crewSkills = Tankopedia.use((state) => state.skills);
|
||||
const provisions = Duel.use((state) => state.protagonist.provisions);
|
||||
const consumables = Duel.use((state) => state.protagonist.consumables);
|
||||
const camouflage = Duel.use((state) => state.protagonist.camouflage);
|
||||
const assaultDistance = Duel.use(
|
||||
(state) => state.protagonist.assaultDistance,
|
||||
(state) => state.protagonist.assaultDistance
|
||||
);
|
||||
const equipmentMatrix = Duel.use(
|
||||
(state) => state.protagonist.equipmentMatrix,
|
||||
(state) => state.protagonist.equipmentMatrix
|
||||
);
|
||||
const { tank, turret, gun, engine, track, shell } = Duel.use(
|
||||
(state) => state.protagonist,
|
||||
(state) => state.protagonist
|
||||
);
|
||||
const stockEngine = tank.engines[0];
|
||||
const stockTrack = tank.tracks[0];
|
||||
@@ -67,7 +67,7 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
||||
tankModelDefinition,
|
||||
equipmentDefinitions: equipmentDefinitions,
|
||||
provisionDefinitions: provisionDefinitions,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const hasImprovedVerticalStabilizer = useEquipment(122);
|
||||
@@ -80,7 +80,7 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
||||
gunModelDefinition.pitch,
|
||||
turretModelDefinition.yaw,
|
||||
hasImprovedVerticalStabilizer,
|
||||
hasDownImprovedVerticalStabilizer,
|
||||
hasDownImprovedVerticalStabilizer
|
||||
);
|
||||
|
||||
modelTransformEvent.dispatch({ pitch, yaw });
|
||||
@@ -89,25 +89,25 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
||||
return (
|
||||
<Flex
|
||||
gap="8"
|
||||
direction={{ initial: 'column', md: 'row' }}
|
||||
align={{ initial: 'center', sm: 'start' }}
|
||||
width={{ initial: '100%', sm: 'auto' }}
|
||||
direction={{ initial: "column", md: "row" }}
|
||||
align={{ initial: "center", sm: "start" }}
|
||||
width={{ initial: "100%", sm: "auto" }}
|
||||
>
|
||||
<Firepower skeleton={skeleton} stats={stats} />
|
||||
|
||||
<Flex
|
||||
gap="8"
|
||||
direction={{ initial: 'column', lg: 'row' }}
|
||||
align={{ initial: 'center', sm: 'start' }}
|
||||
width={{ initial: '100%', sm: 'auto' }}
|
||||
direction={{ initial: "column", lg: "row" }}
|
||||
align={{ initial: "center", sm: "start" }}
|
||||
width={{ initial: "100%", sm: "auto" }}
|
||||
>
|
||||
<Maneuverability stats={stats} />
|
||||
|
||||
<Flex
|
||||
gap="8"
|
||||
direction="column"
|
||||
align={{ initial: 'center', sm: 'start' }}
|
||||
width={{ initial: '100%', sm: 'auto' }}
|
||||
align={{ initial: "center", sm: "start" }}
|
||||
width={{ initial: "100%", sm: "auto" }}
|
||||
>
|
||||
<Survivability stats={stats} />
|
||||
<Crew stats={stats} />
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
||||
import { InfoCircledIcon } from "@radix-ui/react-icons";
|
||||
import {
|
||||
Button,
|
||||
Flex,
|
||||
@@ -6,14 +6,14 @@ import {
|
||||
IconButton,
|
||||
Popover,
|
||||
Text,
|
||||
} from '@radix-ui/themes';
|
||||
import { useLocale } from '../../../../hooks/useLocale';
|
||||
import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
|
||||
import { CrewSkillManager } from '../../../CrewSkillManager';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
} from "@radix-ui/themes";
|
||||
import { useLocale } from "../../../../hooks/useLocale";
|
||||
import { Tankopedia } from "../../../../stores/tankopedia";
|
||||
import { CrewSkillManager } from "../../../CrewSkillManager";
|
||||
import { ConfigurationChildWrapper } from "./ConfigurationChildWrapper";
|
||||
|
||||
export function Skills() {
|
||||
const skillLevels = TankopediaEphemeral.use((state) => state.skills);
|
||||
const skillLevels = Tankopedia.use((state) => state.skills);
|
||||
const { strings } = useLocale();
|
||||
|
||||
return (
|
||||
@@ -45,7 +45,7 @@ export function Skills() {
|
||||
variant="ghost"
|
||||
color="red"
|
||||
onClick={() => {
|
||||
TankopediaEphemeral.mutate((draft) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
Object.keys(draft.skills).forEach((skill) => {
|
||||
draft.skills[skill] = 0;
|
||||
});
|
||||
@@ -57,7 +57,7 @@ export function Skills() {
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
TankopediaEphemeral.mutate((draft) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
Object.keys(draft.skills).forEach((skill) => {
|
||||
draft.skills[skill] = 7;
|
||||
});
|
||||
@@ -71,7 +71,7 @@ export function Skills() {
|
||||
<CrewSkillManager
|
||||
skillLevels={skillLevels}
|
||||
onChange={(skills) => {
|
||||
TankopediaEphemeral.mutate((draft) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.skills = skills;
|
||||
});
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user