mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ec7fcb90a | ||
|
|
830e1597e7 | ||
|
|
3131217600 | ||
|
|
0b740e3f60 | ||
|
|
1416d64e34 |
No files matched your search
@@ -1,12 +1,13 @@
|
|||||||
import { SkillDefinitions } from "..";
|
import { SkillDefinitions } from "@blitzkit/protos";
|
||||||
import { permanentSkills } from "../blitz/permanentSkills";
|
import { permanentSkills } from "../blitz/permanentSkills";
|
||||||
|
import { MAX_SKILL_LEVEL } from "../config/skills";
|
||||||
|
|
||||||
export function createDefaultSkills(skillDefinitions: SkillDefinitions) {
|
export function createDefaultSkills(skillDefinitions: SkillDefinitions) {
|
||||||
const skills: Record<string, number> = {};
|
const skills: Record<string, number> = {};
|
||||||
|
|
||||||
Object.values(skillDefinitions.classes).forEach((tankSkills) => {
|
Object.values(skillDefinitions.classes).forEach((tankSkills) => {
|
||||||
tankSkills.skills.forEach((skill) => {
|
tankSkills.skills.forEach((skill) => {
|
||||||
skills[skill] = permanentSkills.includes(skill) ? 7 : 0;
|
skills[skill] = permanentSkills.includes(skill) ? MAX_SKILL_LEVEL : 0;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -43,19 +43,6 @@ export const TANK_ICONS_COLLECTOR: Record<TankClass, string> = {
|
|||||||
[TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/8xRf3nc.png",
|
[TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/8xRf3nc.png",
|
||||||
};
|
};
|
||||||
export const TIERS = times(10, (index) => index + 1);
|
export const TIERS = times(10, (index) => index + 1);
|
||||||
export const TIER_ROMAN_NUMERALS: Record<number, string> = {
|
|
||||||
1: "I",
|
|
||||||
2: "II",
|
|
||||||
3: "III",
|
|
||||||
4: "IV",
|
|
||||||
5: "V",
|
|
||||||
6: "VI",
|
|
||||||
7: "VII",
|
|
||||||
8: "VIII",
|
|
||||||
9: "IX",
|
|
||||||
10: "X",
|
|
||||||
11: "XI",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const flags: Record<string, string> = {
|
export const flags: Record<string, string> = {
|
||||||
ussr: "<:ussr:1218421042033197197>",
|
ussr: "<:ussr:1218421042033197197>",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export * from "./gunTypeOrder";
|
export * from "./gunTypeOrder";
|
||||||
|
export * from "./skills";
|
||||||
export * from "./tankClassOrder";
|
export * from "./tankClassOrder";
|
||||||
export * from "./treeTypeOrder";
|
export * from "./treeTypeOrder";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export const MAX_SKILL_LEVEL = 7;
|
||||||
@@ -143,6 +143,9 @@
|
|||||||
"modules": "Modules",
|
"modules": "Modules",
|
||||||
"equipment": "Equipment",
|
"equipment": "Equipment",
|
||||||
"shells": "Shells",
|
"shells": "Shells",
|
||||||
|
"clear": "Clear",
|
||||||
|
"maximize": "Maximize",
|
||||||
|
"skills": "Crew skills",
|
||||||
"alternative": "Alt"
|
"alternative": "Alt"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { alias, availableProvisions, permanentSkills } from "@blitzkit/core";
|
import {
|
||||||
|
alias,
|
||||||
|
availableProvisions,
|
||||||
|
MAX_SKILL_LEVEL,
|
||||||
|
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 {
|
import {
|
||||||
@@ -153,7 +158,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
CompareEphemeral.mutate((draft) => {
|
CompareEphemeral.mutate((draft) => {
|
||||||
Object.keys(draft.crewSkills).forEach((skill) => {
|
Object.keys(draft.crewSkills).forEach((skill) => {
|
||||||
draft.crewSkills[skill] = 7;
|
draft.crewSkills[skill] = MAX_SKILL_LEVEL;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { alias, permanentSkills, romanize } from "@blitzkit/core";
|
import {
|
||||||
|
alias,
|
||||||
|
MAX_SKILL_LEVEL,
|
||||||
|
permanentSkills,
|
||||||
|
romanize,
|
||||||
|
} from "@blitzkit/core";
|
||||||
import { Flex } from "@radix-ui/themes";
|
import { Flex } from "@radix-ui/themes";
|
||||||
import { api } from "../api/dynamic";
|
import { api } from "../api/dynamic";
|
||||||
import { GenericTankComponentButton } from "./ModuleButtons/GenericTankComponentButton";
|
import { GenericTankComponentButton } from "./ModuleButtons/GenericTankComponentButton";
|
||||||
@@ -34,10 +39,10 @@ export function CrewSkillManager({
|
|||||||
const draft = { ...skillLevels };
|
const draft = { ...skillLevels };
|
||||||
|
|
||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
draft[skill] = draft[skill] === 0 ? 7 : 0;
|
draft[skill] = draft[skill] === 0 ? MAX_SKILL_LEVEL : 0;
|
||||||
} else {
|
} else {
|
||||||
draft[skill] = level - 1;
|
draft[skill] = level - 1;
|
||||||
if (draft[skill] < 0) draft[skill] = 7;
|
if (draft[skill] < 0) draft[skill] = MAX_SKILL_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(draft);
|
onChange(draft);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { alias, SEARCH_KEYS, TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
import { alias, romanize, SEARCH_KEYS } from "@blitzkit/core";
|
||||||
import { literals } from "@blitzkit/i18n";
|
import { literals } from "@blitzkit/i18n";
|
||||||
import { TankDefinition } from "@blitzkit/protos";
|
import { TankDefinition } from "@blitzkit/protos";
|
||||||
import {
|
import {
|
||||||
@@ -163,7 +163,7 @@ export function Guesser() {
|
|||||||
justify="center"
|
justify="center"
|
||||||
>
|
>
|
||||||
<Icon width="1em" height="1em" />
|
<Icon width="1em" height="1em" />
|
||||||
{TIER_ROMAN_NUMERALS[result.tier]}
|
{romanize(result.tier)}
|
||||||
</Flex>
|
</Flex>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -215,7 +215,7 @@ export function Guesser() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{literals(strings.website.tools.guess.tier, {
|
{literals(strings.website.tools.guess.tier, {
|
||||||
tier: TIER_ROMAN_NUMERALS[tier],
|
tier: romanize(tier),
|
||||||
})}
|
})}
|
||||||
</DropdownMenu.CheckboxItem>
|
</DropdownMenu.CheckboxItem>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
import { romanize } from "@blitzkit/core";
|
||||||
import type {
|
import type {
|
||||||
EngineDefinition,
|
EngineDefinition,
|
||||||
GunDefinition,
|
GunDefinition,
|
||||||
@@ -42,7 +42,7 @@ export function ModuleManager({
|
|||||||
<Flex gap="1" wrap="wrap">
|
<Flex gap="1" wrap="wrap">
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
module="turret"
|
module="turret"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[modules.turret.tier]}
|
discriminator={romanize(modules.turret.tier)}
|
||||||
onClick={() => setTurretMenuOpen(true)}
|
onClick={() => setTurretMenuOpen(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ export function ModuleManager({
|
|||||||
<ModuleButton
|
<ModuleButton
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
module="turret"
|
module="turret"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[turret.tier]}
|
discriminator={romanize(turret.tier)}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
{unwrap(turret.name!)}
|
{unwrap(turret.name!)}
|
||||||
</DropdownMenu.RadioItem>
|
</DropdownMenu.RadioItem>
|
||||||
@@ -83,7 +83,7 @@ export function ModuleManager({
|
|||||||
|
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
module="gun"
|
module="gun"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[modules.gun.tier]}
|
discriminator={romanize(modules.gun.tier)}
|
||||||
onClick={() => setGunMenuOpen(true)}
|
onClick={() => setGunMenuOpen(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ export function ModuleManager({
|
|||||||
<ModuleButton
|
<ModuleButton
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
module="gun"
|
module="gun"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[gun.tier]}
|
discriminator={romanize(gun.tier)}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
{unwrap(gun.name!)}
|
{unwrap(gun.name!)}
|
||||||
</DropdownMenu.RadioItem>
|
</DropdownMenu.RadioItem>
|
||||||
@@ -123,7 +123,7 @@ export function ModuleManager({
|
|||||||
|
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
module="engine"
|
module="engine"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[modules.engine.tier]}
|
discriminator={romanize(modules.engine.tier)}
|
||||||
onClick={() => setEngineMenuOpen(true)}
|
onClick={() => setEngineMenuOpen(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ export function ModuleManager({
|
|||||||
<ModuleButton
|
<ModuleButton
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
module="engine"
|
module="engine"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[engine.tier]}
|
discriminator={romanize(engine.tier)}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
{unwrap(engine.name!)}
|
{unwrap(engine.name!)}
|
||||||
</DropdownMenu.RadioItem>
|
</DropdownMenu.RadioItem>
|
||||||
@@ -162,7 +162,7 @@ export function ModuleManager({
|
|||||||
|
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
module="chassis"
|
module="chassis"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[modules.track.tier]}
|
discriminator={romanize(modules.track.tier)}
|
||||||
onClick={() => setTrackMenuOpen(true)}
|
onClick={() => setTrackMenuOpen(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ export function ModuleManager({
|
|||||||
<ModuleButton
|
<ModuleButton
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
module="chassis"
|
module="chassis"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[track.tier]}
|
discriminator={romanize(track.tier)}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
{unwrap(track.name!)}
|
{unwrap(track.name!)}
|
||||||
</DropdownMenu.RadioItem>
|
</DropdownMenu.RadioItem>
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
.scroller {
|
||||||
|
--scroller-curtain-color: var(--gray-1);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-3);
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.content {
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
padding-bottom: var(--space-4);
|
||||||
|
|
||||||
|
transition: scrollbar-color var(--duration-brief);
|
||||||
|
scrollbar-color: transparent transparent;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
scrollbar-color: var(--gray-7) var(--gray-3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-within {
|
||||||
|
.bar-wrapper {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-orientation="horizontal"] {
|
||||||
|
.curtain {
|
||||||
|
width: min(25%, var(--space-7));
|
||||||
|
height: calc(100% - var(--space-3) - 2 * var(--space-1));
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
|
||||||
|
&[data-side="start"] {
|
||||||
|
left: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
var(--scroller-curtain-color),
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-side="end"] {
|
||||||
|
right: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
transparent,
|
||||||
|
var(--scroller-curtain-color)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-orientation="vertical"] {
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
.content {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.curtain {
|
||||||
|
width: calc(100% - var(--space-3) - 2 * var(--space-1));
|
||||||
|
height: min(25%, var(--space-7));
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
&[data-side="start"] {
|
||||||
|
top: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
180deg,
|
||||||
|
var(--scroller-curtain-color),
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-side="end"] {
|
||||||
|
bottom: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
180deg,
|
||||||
|
transparent,
|
||||||
|
var(--scroller-curtain-color)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.curtain {
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import { useEffect, useRef, type ComponentProps } from "react";
|
||||||
|
import { clamp } from "three/src/math/MathUtils.js";
|
||||||
|
import { classNames } from "../../ui/classNames";
|
||||||
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
|
interface ScrollerProps extends ComponentProps<"div"> {
|
||||||
|
orientation?: "horizontal" | "vertical";
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Scroller({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
orientation = "horizontal",
|
||||||
|
...props
|
||||||
|
}: ScrollerProps) {
|
||||||
|
const content = useRef<HTMLDivElement>(null!);
|
||||||
|
const curtainStart = useRef<HTMLDivElement>(null!);
|
||||||
|
const curtainEnd = useRef<HTMLDivElement>(null!);
|
||||||
|
|
||||||
|
const isHorizontal = orientation === "horizontal";
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function syncCurtains() {
|
||||||
|
const maxScroll = isHorizontal
|
||||||
|
? content.current.scrollWidth - content.current.clientWidth
|
||||||
|
: content.current.scrollHeight - content.current.clientHeight;
|
||||||
|
const scrollPosition = isHorizontal
|
||||||
|
? content.current.scrollLeft
|
||||||
|
: content.current.scrollTop;
|
||||||
|
|
||||||
|
if (maxScroll <= 0) {
|
||||||
|
curtainStart.current.style.opacity = "0";
|
||||||
|
curtainEnd.current.style.opacity = "0";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dimension = isHorizontal
|
||||||
|
? content.current.clientWidth
|
||||||
|
: content.current.clientHeight;
|
||||||
|
const fadeDistance = Math.min(60, dimension * 0.15);
|
||||||
|
const startOpacity = clamp(scrollPosition / fadeDistance, 0, 1);
|
||||||
|
const endOpacity = clamp(
|
||||||
|
(maxScroll - scrollPosition) / fadeDistance,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
|
||||||
|
curtainStart.current.style.opacity = `${startOpacity}`;
|
||||||
|
curtainEnd.current.style.opacity = `${endOpacity}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
syncCurtains();
|
||||||
|
|
||||||
|
window.addEventListener("resize", syncCurtains);
|
||||||
|
content.current.addEventListener("scroll", syncCurtains);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", syncCurtains);
|
||||||
|
content.current.removeEventListener("scroll", syncCurtains);
|
||||||
|
};
|
||||||
|
}, [orientation]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(styles.scroller, className)}
|
||||||
|
{...props}
|
||||||
|
data-orientation={orientation}
|
||||||
|
>
|
||||||
|
<div className={styles.content} ref={content}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ref={curtainStart} data-side="start" className={styles.curtain} />
|
||||||
|
<div ref={curtainEnd} data-side="end" className={styles.curtain} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
.section {
|
.section {
|
||||||
|
padding: var(--space-5);
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
import { romanize } from "@blitzkit/core";
|
||||||
import { Flex, IconButton, Text } from "@radix-ui/themes";
|
import { Flex, IconButton, Text } from "@radix-ui/themes";
|
||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
import { awaitableTiers } from "../../../core/awaitables/tiers";
|
import { awaitableTiers } from "../../../core/awaitables/tiers";
|
||||||
@@ -41,7 +41,7 @@ export const TierFilter = memo(() => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text size="2">{TIER_ROMAN_NUMERALS[tier]}</Text>
|
<Text size="2">{romanize(tier)}</Text>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
metaSortTank,
|
metaSortTank,
|
||||||
normalizeBoundingBox,
|
normalizeBoundingBox,
|
||||||
resolveDpm,
|
|
||||||
SEARCH_KEYS,
|
SEARCH_KEYS,
|
||||||
unionBoundingBox,
|
unionBoundingBox,
|
||||||
} from "@blitzkit/core";
|
} from "@blitzkit/core";
|
||||||
@@ -44,6 +43,10 @@ export type TankSearchProps = MaybeSkeletonComponentProps & {
|
|||||||
onSelectAll?: (tanks: TankDefinition[]) => void;
|
onSelectAll?: (tanks: TankDefinition[]) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function resolveDpm(a: any, b: any) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const [gameDefinitions, modelDefinitions, tankDefinitions, tankNames] =
|
const [gameDefinitions, modelDefinitions, tankDefinitions, tankNames] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
api.game(),
|
api.game(),
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { alias, gunTypeOrder, romanize, treeTypeOrder } from "@blitzkit/core";
|
||||||
alias,
|
|
||||||
gunTypeOrder,
|
|
||||||
TIER_ROMAN_NUMERALS,
|
|
||||||
treeTypeOrder,
|
|
||||||
} from "@blitzkit/core";
|
|
||||||
import { tankClassOrder } from "@blitzkit/core/src/config/tankClassOrder";
|
import { tankClassOrder } from "@blitzkit/core/src/config/tankClassOrder";
|
||||||
import { literals } from "@blitzkit/i18n";
|
import { literals } from "@blitzkit/i18n";
|
||||||
import locales from "@blitzkit/i18n/locales.json";
|
import locales from "@blitzkit/i18n/locales.json";
|
||||||
@@ -203,7 +198,7 @@ function TiersFilter() {
|
|||||||
<Flex gap="1">
|
<Flex gap="1">
|
||||||
{tiers.slice(0, MAX_ICONS).map((tier) => (
|
{tiers.slice(0, MAX_ICONS).map((tier) => (
|
||||||
<Text size="minor" key={tier}>
|
<Text size="minor" key={tier}>
|
||||||
{TIER_ROMAN_NUMERALS[tier]}
|
{romanize(tier)}
|
||||||
</Text>
|
</Text>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
@@ -239,7 +234,7 @@ function TiersFilter() {
|
|||||||
key={tier}
|
key={tier}
|
||||||
>
|
>
|
||||||
{literals(strings.website.common.tank_search.tier, {
|
{literals(strings.website.common.tank_search.tier, {
|
||||||
tier: TIER_ROMAN_NUMERALS[tier],
|
tier: romanize(tier),
|
||||||
})}
|
})}
|
||||||
</DropdownMenu.CheckboxItem>
|
</DropdownMenu.CheckboxItem>
|
||||||
);
|
);
|
||||||
@@ -620,13 +615,7 @@ function IndividualShellFilter({
|
|||||||
return (
|
return (
|
||||||
<DropdownMenu.Root modal={false}>
|
<DropdownMenu.Root modal={false}>
|
||||||
<DropdownMenu.Trigger asChild>
|
<DropdownMenu.Trigger asChild>
|
||||||
<IconButton
|
<IconButton listChild size="minor" variant="surface" color="gray">
|
||||||
listChild
|
|
||||||
size="minor"
|
|
||||||
variant="surface"
|
|
||||||
color="gray"
|
|
||||||
highContrast
|
|
||||||
>
|
|
||||||
{shells[index] === null && (
|
{shells[index] === null && (
|
||||||
<Text lowContrast className={styles["shell-icon"]}>
|
<Text lowContrast className={styles["shell-icon"]}>
|
||||||
<MissingShellIcon width="1em" height="1em" />
|
<MissingShellIcon width="1em" height="1em" />
|
||||||
@@ -739,10 +728,10 @@ function OwnershipFilterInternal() {
|
|||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
borderBottomRightRadius: 0,
|
borderBottomRightRadius: 0,
|
||||||
}}
|
}}
|
||||||
|
listChild
|
||||||
disabled={!wargaming}
|
disabled={!wargaming}
|
||||||
variant={showOwned ? "solid" : "surface"}
|
variant={showOwned ? "solid" : "surface"}
|
||||||
color={showOwned ? undefined : "gray"}
|
color={showOwned ? undefined : "gray"}
|
||||||
highContrast
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showOwned = !draft.showOwned;
|
draft.showOwned = !draft.showOwned;
|
||||||
@@ -759,10 +748,10 @@ function OwnershipFilterInternal() {
|
|||||||
borderBottomLeftRadius: 0,
|
borderBottomLeftRadius: 0,
|
||||||
marginLeft: "-1px",
|
marginLeft: "-1px",
|
||||||
}}
|
}}
|
||||||
|
listChild
|
||||||
disabled={!wargaming}
|
disabled={!wargaming}
|
||||||
variant={showUnowned ? "solid" : "surface"}
|
variant={showUnowned ? "solid" : "surface"}
|
||||||
color={showUnowned ? undefined : "gray"}
|
color={showUnowned ? undefined : "gray"}
|
||||||
highContrast
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showUnowned = !draft.showUnowned;
|
draft.showUnowned = !draft.showUnowned;
|
||||||
@@ -789,7 +778,7 @@ function TestFilter() {
|
|||||||
}}
|
}}
|
||||||
variant={showNonTesting ? "solid" : "surface"}
|
variant={showNonTesting ? "solid" : "surface"}
|
||||||
color={showNonTesting ? undefined : "gray"}
|
color={showNonTesting ? undefined : "gray"}
|
||||||
highContrast
|
listChild
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showNonTesting = !draft.showNonTesting;
|
draft.showNonTesting = !draft.showNonTesting;
|
||||||
@@ -810,7 +799,7 @@ function TestFilter() {
|
|||||||
}}
|
}}
|
||||||
variant={showTesting ? "solid" : "surface"}
|
variant={showTesting ? "solid" : "surface"}
|
||||||
color={showTesting ? undefined : "gray"}
|
color={showTesting ? undefined : "gray"}
|
||||||
highContrast
|
listChild
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showTesting = !draft.showTesting;
|
draft.showTesting = !draft.showTesting;
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ import {
|
|||||||
alias,
|
alias,
|
||||||
formatCompact,
|
formatCompact,
|
||||||
tankIcon,
|
tankIcon,
|
||||||
TIER_ROMAN_NUMERALS,
|
romanize,
|
||||||
} from "@blitzkit/core";
|
} from "@blitzkit/core";
|
||||||
import {
|
import {
|
||||||
EngineDefinition,
|
EngineDefinition,
|
||||||
@@ -93,7 +93,7 @@ function ModuleButton({
|
|||||||
top: isTank ? 8 : 4,
|
top: isTank ? 8 : 4,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{TIER_ROMAN_NUMERALS[tier]}
|
{romanize(tier)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{unlock.cost!.value > 0 && (
|
{unlock.cost!.value > 0 && (
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import { MAX_SKILL_LEVEL } from "@blitzkit/core";
|
||||||
import { InfoCircledIcon } from "@radix-ui/react-icons";
|
import { InfoCircledIcon } from "@radix-ui/react-icons";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -59,7 +60,7 @@ export function Skills() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
Object.keys(draft.skills).forEach((skill) => {
|
Object.keys(draft.skills).forEach((skill) => {
|
||||||
draft.skills[skill] = 7;
|
draft.skills[skill] = MAX_SKILL_LEVEL;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
alias,
|
alias,
|
||||||
resolvePenetrationCoefficient,
|
resolvePenetrationCoefficient,
|
||||||
TIER_ROMAN_NUMERALS,
|
romanize,
|
||||||
uniqueGuns,
|
uniqueGuns,
|
||||||
} from "@blitzkit/core";
|
} from "@blitzkit/core";
|
||||||
import { literals } from "@blitzkit/i18n/src/literals";
|
import { literals } from "@blitzkit/i18n/src/literals";
|
||||||
@@ -137,7 +137,7 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
mr="2"
|
mr="2"
|
||||||
mb="1"
|
mb="1"
|
||||||
>
|
>
|
||||||
{TIER_ROMAN_NUMERALS[antagonistGun.tier]}
|
{romanize(antagonistGun.tier)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<img
|
<img
|
||||||
@@ -166,7 +166,7 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
selected={gun.id === antagonistGun.id}
|
selected={gun.id === antagonistGun.id}
|
||||||
discriminator={TIER_ROMAN_NUMERALS[gun.tier]}
|
discriminator={romanize(gun.tier)}
|
||||||
secondaryDiscriminator={
|
secondaryDiscriminator={
|
||||||
<Text style={{ fontSize: "0.75em" }}>
|
<Text style={{ fontSize: "0.75em" }}>
|
||||||
{literals(strings.common.units.mm, {
|
{literals(strings.common.units.mm, {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { alias, TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
import { alias, romanize } from "@blitzkit/core";
|
||||||
import { TankPriceType, TankType } from "@blitzkit/protos";
|
import { TankPriceType, TankType } from "@blitzkit/protos";
|
||||||
import { Box, Flex } from "@radix-ui/themes";
|
import { Box, Flex } from "@radix-ui/themes";
|
||||||
import { Var } from "../../../core/radix/var";
|
import { Var } from "../../../core/radix/var";
|
||||||
@@ -80,7 +80,7 @@ export function MetaSection() {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</Listing>
|
</Listing>
|
||||||
<Listing label={strings.website.tools.tankopedia.meta.tier}>
|
<Listing label={strings.website.tools.tankopedia.meta.tier}>
|
||||||
{TIER_ROMAN_NUMERALS[protagonist.tier]}
|
{romanize(protagonist.tier)}
|
||||||
</Listing>
|
</Listing>
|
||||||
<Listing
|
<Listing
|
||||||
label={strings.website.tools.tankopedia.meta.type}
|
label={strings.website.tools.tankopedia.meta.type}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { alias, formatCompact, TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
import { alias, formatCompact, romanize } from "@blitzkit/core";
|
||||||
import { literals } from "@blitzkit/i18n/src/literals";
|
import { literals } from "@blitzkit/i18n/src/literals";
|
||||||
import { Box, Flex, Skeleton, Text } from "@radix-ui/themes";
|
import { Box, Flex, Skeleton, Text } from "@radix-ui/themes";
|
||||||
import { api } from "../../../../api/dynamic";
|
import { api } from "../../../../api/dynamic";
|
||||||
@@ -90,7 +90,7 @@ export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
|||||||
<Flex direction="column" align="center">
|
<Flex direction="column" align="center">
|
||||||
<Flex gap="2" align="center">
|
<Flex gap="2" align="center">
|
||||||
<Text color="gray" size="1">
|
<Text color="gray" size="1">
|
||||||
{TIER_ROMAN_NUMERALS[tank.tier]}
|
{romanize(tank.tier)}
|
||||||
</Text>
|
</Text>
|
||||||
<Text wrap="nowrap">{unwrap(tank.name!)}</Text>
|
<Text wrap="nowrap">{unwrap(tank.name!)}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TIER_ROMAN_NUMERALS } from "@blitzkit/core";
|
import { romanize } from "@blitzkit/core";
|
||||||
import { literals } from "@blitzkit/i18n/src/literals";
|
import { literals } from "@blitzkit/i18n/src/literals";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { characteristicsGroups } from "../../config/characteristicsGroups";
|
import { characteristicsGroups } from "../../config/characteristicsGroups";
|
||||||
@@ -201,7 +201,7 @@ function CompareOptions() {
|
|||||||
value: `${TankopediaRelativeAgainst.ClassAndTier}`,
|
value: `${TankopediaRelativeAgainst.ClassAndTier}`,
|
||||||
relativeAgainst: TankopediaRelativeAgainst.ClassAndTier,
|
relativeAgainst: TankopediaRelativeAgainst.ClassAndTier,
|
||||||
label: literals(strings.tanks.characteristics.compare.class, {
|
label: literals(strings.tanks.characteristics.compare.class, {
|
||||||
tier: TIER_ROMAN_NUMERALS[tank.tier],
|
tier: romanize(tank.tier),
|
||||||
class: strings.common.tank_class_short_plural_lowercase[tank.class],
|
class: strings.common.tank_class_short_plural_lowercase[tank.class],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -209,7 +209,7 @@ function CompareOptions() {
|
|||||||
value: `${TankopediaRelativeAgainst.Tier}`,
|
value: `${TankopediaRelativeAgainst.Tier}`,
|
||||||
relativeAgainst: TankopediaRelativeAgainst.Tier,
|
relativeAgainst: TankopediaRelativeAgainst.Tier,
|
||||||
label: literals(strings.tanks.characteristics.compare.tier, {
|
label: literals(strings.tanks.characteristics.compare.tier, {
|
||||||
tier: TIER_ROMAN_NUMERALS[tank.tier],
|
tier: romanize(tank.tier),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
.section {
|
.section {
|
||||||
max-width: 21rem;
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@@ -13,6 +11,31 @@
|
|||||||
|
|
||||||
.upgrade-buttons {
|
.upgrade-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: var(--space-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.crew-skills {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-3);
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
gap: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skill {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.level {
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
right: var(--space-1);
|
||||||
|
bottom: var(--space-1);
|
||||||
|
|
||||||
|
font-size: var(--font-size-minor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,8 +78,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.consumables {
|
.consumables {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-wrap: wrap;
|
grid-template-columns: repeat(3, max-content);
|
||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
|
|
||||||
.consumable-wrapper {
|
.consumable-wrapper {
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
import { alias } from "@blitzkit/core";
|
import {
|
||||||
|
alias,
|
||||||
|
MAX_SKILL_LEVEL,
|
||||||
|
permanentSkills,
|
||||||
|
romanize,
|
||||||
|
} from "@blitzkit/core";
|
||||||
import type { Consumable, EquipmentSlot, Provision } from "@blitzkit/protos";
|
import type { Consumable, EquipmentSlot, Provision } from "@blitzkit/protos";
|
||||||
import { ClockIcon, ResetIcon, TrashIcon } from "@radix-ui/react-icons";
|
import {
|
||||||
|
ClockIcon,
|
||||||
|
DoubleArrowUpIcon,
|
||||||
|
ResetIcon,
|
||||||
|
TrashIcon,
|
||||||
|
} from "@radix-ui/react-icons";
|
||||||
import { chunk } from "lodash-es";
|
import { chunk } from "lodash-es";
|
||||||
import { api } from "../../api/dynamic";
|
import { api } from "../../api/dynamic";
|
||||||
import { equipmentColumns } from "../../config/equipment";
|
import { equipmentColumns } from "../../config/equipment";
|
||||||
@@ -23,13 +33,14 @@ import styles from "./index.module.css";
|
|||||||
const equipment = await api.equipment();
|
const equipment = await api.equipment();
|
||||||
const provisions = await api.provisions();
|
const provisions = await api.provisions();
|
||||||
const consumables = await api.consumables();
|
const consumables = await api.consumables();
|
||||||
|
const skills = await api.skills();
|
||||||
|
|
||||||
interface TankopediaLoadoutProps {
|
interface TankopediaLoadoutProps {
|
||||||
characteristics: ComputedCharacteristics;
|
characteristics: ComputedCharacteristics;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
||||||
const tank = useDuel("protagonist", DuelModule.Tank);
|
// const tank = useDuel("protagonist", DuelModule.Tank);
|
||||||
// const showModules = hasUpgrades(tank);
|
// const showModules = hasUpgrades(tank);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -39,12 +50,103 @@ export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
|||||||
<Equipment />
|
<Equipment />
|
||||||
<Provisions />
|
<Provisions />
|
||||||
<Consumables characteristics={characteristics} />
|
<Consumables characteristics={characteristics} />
|
||||||
|
<CrewSkills />
|
||||||
<State />
|
<State />
|
||||||
<Status />
|
<Status />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CrewSkills() {
|
||||||
|
const strings = useStrings();
|
||||||
|
const selectedSkills = Tankopedia.use((state) => state.environment.skills);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.section}>
|
||||||
|
<div className={styles.header}>
|
||||||
|
<Heading size="4">{strings.tanks.loadout.skills}</Heading>
|
||||||
|
|
||||||
|
<div className={styles["upgrade-buttons"]}>
|
||||||
|
<IconButton
|
||||||
|
color="red"
|
||||||
|
aria-label={`${strings.tanks.loadout.clear} ${strings.tanks.loadout.skills}`}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
Object.keys(draft.environment.skills).forEach((skill) => {
|
||||||
|
draft.environment.skills[skill] = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TrashIcon />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
color="gray"
|
||||||
|
highContrast
|
||||||
|
aria-label={`${strings.tanks.loadout.maximize} ${strings.tanks.loadout.skills}`}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
Object.keys(draft.environment.skills).forEach((skill) => {
|
||||||
|
draft.environment.skills[skill] = MAX_SKILL_LEVEL;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DoubleArrowUpIcon />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles["crew-skills"]}>
|
||||||
|
{Object.entries(skills.classes).map(([tankClass, group]) => (
|
||||||
|
<div key={tankClass} className={styles.row}>
|
||||||
|
{group.skills.map((skill) => (
|
||||||
|
<CrewSkillEntry
|
||||||
|
key={skill}
|
||||||
|
id={skill}
|
||||||
|
level={selectedSkills[skill]}
|
||||||
|
permanent={permanentSkills.includes(skill)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CrewSkillEntryProps {
|
||||||
|
id: string;
|
||||||
|
level: number;
|
||||||
|
permanent: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CrewSkillEntry({ id, level, permanent }: CrewSkillEntryProps) {
|
||||||
|
return (
|
||||||
|
<IconButton
|
||||||
|
size="major"
|
||||||
|
radius="1"
|
||||||
|
className={styles.skill}
|
||||||
|
color={level === 0 ? "gray" : permanent ? undefined : "amber"}
|
||||||
|
variant={level === 0 ? "soft" : "surface"}
|
||||||
|
onClick={(event) => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
if (event.shiftKey) {
|
||||||
|
draft.environment.skills[id] = level === 0 ? MAX_SKILL_LEVEL : 0;
|
||||||
|
} else {
|
||||||
|
draft.environment.skills[id] =
|
||||||
|
level === 0 ? MAX_SKILL_LEVEL : level - 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img src={alias("api", `/icons/skills/${id}.webp`)} />
|
||||||
|
{level > 0 && <span className={styles.level}>{romanize(level)}</span>}
|
||||||
|
</IconButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function State() {
|
function State() {
|
||||||
const strings = useStrings();
|
const strings = useStrings();
|
||||||
|
|
||||||
@@ -58,6 +160,7 @@ function State() {
|
|||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
color="red"
|
color="red"
|
||||||
|
aria-label={`${strings.tanks.loadout.clear} ${strings.tanks.loadout.consumables}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
draft.protagonist.consumables = [];
|
draft.protagonist.consumables = [];
|
||||||
@@ -87,6 +190,7 @@ function Status() {
|
|||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
color="red"
|
color="red"
|
||||||
|
aria-label={`${strings.tanks.loadout.clear} ${strings.tanks.loadout.status}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
draft.protagonist.consumables = [];
|
draft.protagonist.consumables = [];
|
||||||
@@ -103,6 +207,8 @@ function Status() {
|
|||||||
{group.map((key) => (
|
{group.map((key) => (
|
||||||
<IconButton
|
<IconButton
|
||||||
key={key}
|
key={key}
|
||||||
|
aria-label={key.replaceAll("_", " ")}
|
||||||
|
aria-pressed={status[key]}
|
||||||
radius="1"
|
radius="1"
|
||||||
className={styles.state}
|
className={styles.state}
|
||||||
color={status[key] ? "amber" : "gray"}
|
color={status[key] ? "amber" : "gray"}
|
||||||
@@ -183,6 +289,7 @@ function Provisions() {
|
|||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
color="red"
|
color="red"
|
||||||
|
aria-label={`${strings.tanks.loadout.clear} ${strings.tanks.loadout.provisions}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
draft.protagonist.provisions = [];
|
draft.protagonist.provisions = [];
|
||||||
@@ -230,6 +337,7 @@ function ProvisionEntry({ id, provision }: ProvisionEntryProps) {
|
|||||||
return (
|
return (
|
||||||
<Tooltip tooltip={unwrap(provision.name)}>
|
<Tooltip tooltip={unwrap(provision.name)}>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
aria-label={unwrap(provision.name)}
|
||||||
size="major"
|
size="major"
|
||||||
radius="1"
|
radius="1"
|
||||||
variant={isSelected ? "surface" : "soft"}
|
variant={isSelected ? "surface" : "soft"}
|
||||||
@@ -275,6 +383,7 @@ function Consumables({ characteristics }: ConsumablesProps) {
|
|||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
color="red"
|
color="red"
|
||||||
|
aria-label={`${strings.tanks.loadout.clear} ${strings.tanks.loadout.consumables}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
draft.protagonist.consumables = [];
|
draft.protagonist.consumables = [];
|
||||||
@@ -325,6 +434,7 @@ function ConsumableEntry({ id, consumable }: ConsumableProps) {
|
|||||||
<div className={styles["consumable-wrapper"]}>
|
<div className={styles["consumable-wrapper"]}>
|
||||||
<Tooltip tooltip={unwrap(consumable.name)}>
|
<Tooltip tooltip={unwrap(consumable.name)}>
|
||||||
<Button
|
<Button
|
||||||
|
aria-label={unwrap(consumable.name)}
|
||||||
radius="1"
|
radius="1"
|
||||||
variant={isSelected ? "surface" : "soft"}
|
variant={isSelected ? "surface" : "soft"}
|
||||||
color={isSelected ? undefined : "gray"}
|
color={isSelected ? undefined : "gray"}
|
||||||
@@ -384,6 +494,7 @@ function Equipment() {
|
|||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
color="red"
|
color="red"
|
||||||
|
aria-label={`${strings.tanks.loadout.clear} ${strings.tanks.loadout.equipment}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
for (const key in draft.protagonist.equipment) {
|
for (const key in draft.protagonist.equipment) {
|
||||||
@@ -489,6 +600,7 @@ function EquipmentOption({
|
|||||||
return (
|
return (
|
||||||
<Tooltip tooltip={unwrap(specificEquipment.name)}>
|
<Tooltip tooltip={unwrap(specificEquipment.name)}>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
aria-label={unwrap(specificEquipment.name)}
|
||||||
size="major"
|
size="major"
|
||||||
color={isSelected ? undefined : "gray"}
|
color={isSelected ? undefined : "gray"}
|
||||||
variant={isSelected ? "surface" : "soft"}
|
variant={isSelected ? "surface" : "soft"}
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
import {
|
import { Suspense, useEffect, useRef } from "react";
|
||||||
forwardRef,
|
|
||||||
Suspense,
|
|
||||||
useEffect,
|
|
||||||
useImperativeHandle,
|
|
||||||
useRef,
|
|
||||||
} from "react";
|
|
||||||
import { applyPitchYawLimits } from "../../core/blitz/applyPitchYawLimits";
|
import { applyPitchYawLimits } from "../../core/blitz/applyPitchYawLimits";
|
||||||
import { modelTransformEvent } from "../../core/blitzkit/modelTransform";
|
import { modelTransformEvent } from "../../core/blitzkit/modelTransform";
|
||||||
import { Pose, poseEvent } from "../../core/blitzkit/pose";
|
import { Pose, poseEvent } from "../../core/blitzkit/pose";
|
||||||
@@ -14,6 +8,7 @@ import { useModel } from "../../hooks/useModel";
|
|||||||
import { Tankopedia } from "../../stores/tankopedia";
|
import { Tankopedia } from "../../stores/tankopedia";
|
||||||
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
||||||
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
||||||
|
import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
|
||||||
import { ArmorPlateDisplay } from "../ArmorPlateDisplay";
|
import { ArmorPlateDisplay } from "../ArmorPlateDisplay";
|
||||||
import { CanvasAutoClear } from "../CanvasAutoClear";
|
import { CanvasAutoClear } from "../CanvasAutoClear";
|
||||||
import { CanvasControl } from "../CanvasControl";
|
import { CanvasControl } from "../CanvasControl";
|
||||||
@@ -27,19 +22,18 @@ import { StaticArmor, type ThicknessRange } from "../StaticArmor";
|
|||||||
import { TankModel } from "../TankModel";
|
import { TankModel } from "../TankModel";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
interface TankSandboxProps {
|
type TankSandboxProps = MaybeSkeletonComponentProps & {
|
||||||
thicknessRange: ThicknessRange;
|
thicknessRange: ThicknessRange;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const TankopediaSandbox = forwardRef<
|
export function TankopediaSandbox({
|
||||||
HTMLCanvasElement,
|
skeleton,
|
||||||
TankSandboxProps
|
thicknessRange,
|
||||||
>(({ thicknessRange }, ref) => {
|
}: TankSandboxProps) {
|
||||||
const canvas = useRef<HTMLCanvasElement>(null);
|
const canvas = useRef<HTMLCanvasElement>(null);
|
||||||
const hasImprovedVerticalStabilizer = useEquipment("protagonist", 122);
|
const hasImprovedVerticalStabilizer = useEquipment("protagonist", 122);
|
||||||
const hasDownImprovedVerticalStabilizer = useEquipment("protagonist", 124);
|
const hasDownImprovedVerticalStabilizer = useEquipment("protagonist", 124);
|
||||||
|
|
||||||
const tank = useDuel("protagonist", DuelModule.Tank);
|
|
||||||
const gun = useDuel("protagonist", DuelModule.Gun);
|
const gun = useDuel("protagonist", DuelModule.Gun);
|
||||||
const turret = useDuel("protagonist", DuelModule.Turret);
|
const turret = useDuel("protagonist", DuelModule.Turret);
|
||||||
|
|
||||||
@@ -47,13 +41,6 @@ export const TankopediaSandbox = forwardRef<
|
|||||||
const turretModelDefinition = model.turrets[turret.id];
|
const turretModelDefinition = model.turrets[turret.id];
|
||||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
const display = Tankopedia.use((state) => state.display);
|
const display = Tankopedia.use((state) => state.display);
|
||||||
const hideTankModelUnderArmor = TankopediaPersistent.use(
|
|
||||||
(state) => state.hideTankModelUnderArmor,
|
|
||||||
);
|
|
||||||
|
|
||||||
const { hasPbr } = useModel(tank.id);
|
|
||||||
|
|
||||||
useImperativeHandle(ref, () => canvas.current!, []);
|
|
||||||
|
|
||||||
function handlePointerDown() {
|
function handlePointerDown() {
|
||||||
window.addEventListener("pointermove", handlePointerMove);
|
window.addEventListener("pointermove", handlePointerMove);
|
||||||
@@ -169,29 +156,47 @@ export const TankopediaSandbox = forwardRef<
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Lighting hasPbr={hasPbr} />
|
{!skeleton && <Content thicknessRange={thicknessRange} />}
|
||||||
|
|
||||||
<SceneProps />
|
|
||||||
{(display === TankopediaDisplay.Model ||
|
|
||||||
(display === TankopediaDisplay.DynamicArmor &&
|
|
||||||
!hideTankModelUnderArmor)) && <TankModel />}
|
|
||||||
|
|
||||||
<ShotDisplay />
|
|
||||||
<ArmorPlateDisplay />
|
|
||||||
<CanvasAutoClear />
|
|
||||||
|
|
||||||
<Suspense>
|
|
||||||
{/* Controls within Suspense to allow for frame-perfect start of camera auto-rotate */}
|
|
||||||
<CanvasControl />
|
|
||||||
|
|
||||||
{display === TankopediaDisplay.DynamicArmor && <DynamicArmor />}
|
|
||||||
{display === TankopediaDisplay.StaticArmor && (
|
|
||||||
<StaticArmor thicknessRange={thicknessRange} />
|
|
||||||
)}
|
|
||||||
</Suspense>
|
|
||||||
|
|
||||||
<InitialCameraAligner />
|
|
||||||
</SmartCanvas>
|
</SmartCanvas>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function Content({ thicknessRange }: { thicknessRange: ThicknessRange }) {
|
||||||
|
const display = Tankopedia.use((state) => state.display);
|
||||||
|
const tank = useDuel("protagonist", DuelModule.Tank);
|
||||||
|
|
||||||
|
const { hasPbr } = useModel(tank.id);
|
||||||
|
|
||||||
|
const hideTankModelUnderArmor = TankopediaPersistent.use(
|
||||||
|
(state) => state.hideTankModelUnderArmor,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Lighting hasPbr={hasPbr} />
|
||||||
|
|
||||||
|
<SceneProps />
|
||||||
|
|
||||||
|
{(display === TankopediaDisplay.Model ||
|
||||||
|
(display === TankopediaDisplay.DynamicArmor &&
|
||||||
|
!hideTankModelUnderArmor)) && <TankModel />}
|
||||||
|
|
||||||
|
<ShotDisplay />
|
||||||
|
<ArmorPlateDisplay />
|
||||||
|
<CanvasAutoClear />
|
||||||
|
|
||||||
|
<Suspense>
|
||||||
|
{/* Controls within Suspense to allow for frame-perfect start of camera auto-rotate */}
|
||||||
|
<CanvasControl />
|
||||||
|
|
||||||
|
{display === TankopediaDisplay.DynamicArmor && <DynamicArmor />}
|
||||||
|
{display === TankopediaDisplay.StaticArmor && (
|
||||||
|
<StaticArmor thicknessRange={thicknessRange} />
|
||||||
|
)}
|
||||||
|
</Suspense>
|
||||||
|
|
||||||
|
<InitialCameraAligner />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
alias,
|
alias,
|
||||||
TIER_ROMAN_NUMERALS,
|
romanize,
|
||||||
} from "@blitzkit/core";
|
} from "@blitzkit/core";
|
||||||
import { literals } from "@blitzkit/i18n";
|
import { literals } from "@blitzkit/i18n";
|
||||||
import {
|
import {
|
||||||
@@ -161,7 +161,7 @@ function ModuleChooser({
|
|||||||
}
|
}
|
||||||
key={turret.id}
|
key={turret.id}
|
||||||
module="turret"
|
module="turret"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[turret.tier]}
|
discriminator={romanize(turret.tier)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onSelect?.(tankDefinition, turret);
|
onSelect?.(tankDefinition, turret);
|
||||||
}}
|
}}
|
||||||
@@ -179,7 +179,7 @@ function ModuleChooser({
|
|||||||
}
|
}
|
||||||
key={gun.id}
|
key={gun.id}
|
||||||
module="gun"
|
module="gun"
|
||||||
discriminator={TIER_ROMAN_NUMERALS[gun.tier]}
|
discriminator={romanize(gun.tier)}
|
||||||
secondaryDiscriminator={
|
secondaryDiscriminator={
|
||||||
<Text style={{ fontSize: "0.75em" }}>
|
<Text style={{ fontSize: "0.75em" }}>
|
||||||
{literals(strings.common.units.mm, {
|
{literals(strings.common.units.mm, {
|
||||||
|
|||||||
+8
-5
@@ -13,11 +13,14 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
gap: var(--space-5);
|
|
||||||
padding: var(--space-5);
|
|
||||||
|
|
||||||
overflow-y: auto;
|
|
||||||
|
|
||||||
background-color: var(--gray-2);
|
background-color: var(--gray-2);
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: var(--space-5);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { api } from "../../../../../api/dynamic";
|
import { api } from "../../../../../api/dynamic";
|
||||||
|
import { Scroller } from "../../../../../components/Scroller";
|
||||||
import type { ThicknessRange } from "../../../../../components/StaticArmor";
|
import type { ThicknessRange } from "../../../../../components/StaticArmor";
|
||||||
import { TankopediaCharacteristics } from "../../../../../components/TankopediaCharacteristics";
|
import { TankopediaCharacteristics } from "../../../../../components/TankopediaCharacteristics";
|
||||||
import { TankopediaGameModeAbilities } from "../../../../../components/TankopediaGameModeAbilities";
|
import { TankopediaGameModeAbilities } from "../../../../../components/TankopediaGameModeAbilities";
|
||||||
import { TankopediaLoadout } from "../../../../../components/TankopediaLoadout";
|
import { TankopediaLoadout } from "../../../../../components/TankopediaLoadout";
|
||||||
|
import { TankopediaSandbox } from "../../../../../components/TankopediaSandbox";
|
||||||
import { defaultEqualizer } from "../../../../../config/equalizer";
|
import { defaultEqualizer } from "../../../../../config/equalizer";
|
||||||
import { withErrorWrapper } from "../../../../../hocs/withErrorWrapper";
|
import { withErrorWrapper } from "../../../../../hocs/withErrorWrapper";
|
||||||
import { withLocale } from "../../../../../hocs/withLocale";
|
import { withLocale } from "../../../../../hocs/withLocale";
|
||||||
@@ -52,12 +54,17 @@ export const Page = withErrorWrapper(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.page}>
|
<div className={styles.page}>
|
||||||
<div className={styles.loadout}>
|
<Scroller className={styles.loadout} orientation="vertical">
|
||||||
<TankopediaLoadout characteristics={characteristics} />
|
<div className={styles.content}>
|
||||||
</div>
|
<TankopediaLoadout characteristics={characteristics} />
|
||||||
|
</div>
|
||||||
|
</Scroller>
|
||||||
|
|
||||||
<div className={styles.sandbox}>
|
<div className={styles.sandbox}>
|
||||||
{/* {!skeleton && <TankopediaSandbox thicknessRange={thicknessRange} />} */}
|
<TankopediaSandbox
|
||||||
|
skeleton={skeleton}
|
||||||
|
thicknessRange={thicknessRange}
|
||||||
|
/>
|
||||||
<TankopediaCharacteristics characteristics={characteristics} />
|
<TankopediaCharacteristics characteristics={characteristics} />
|
||||||
<TankopediaGameModeAbilities />
|
<TankopediaGameModeAbilities />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user