mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
shell selector
This commit is contained in:
1 parent
9692110733
commit
e7b81f39b8
3 files changed
+53
-4
No files matched your search
@@ -122,6 +122,7 @@
|
|||||||
"provisions": "Provisions",
|
"provisions": "Provisions",
|
||||||
"modules": "Modules",
|
"modules": "Modules",
|
||||||
"equipment": "Equipment",
|
"equipment": "Equipment",
|
||||||
|
"shells": "Shells",
|
||||||
"alternative": "Alt"
|
"alternative": "Alt"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
gap: var(--space-2);
|
gap: var(--space-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.shells {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { useStrings } from "../../hooks/useStrings";
|
|||||||
import { useTankCompatibility } from "../../hooks/useTankCompatibility";
|
import { useTankCompatibility } from "../../hooks/useTankCompatibility";
|
||||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||||
import { Tankopedia } from "../../stores/tankopedia";
|
import { Tankopedia } from "../../stores/tankopedia";
|
||||||
import { hasUpgrades } from "../../tankopedia/hasUpgrades";
|
|
||||||
import { vehicleStatusKeys } from "../../tankopedia/tankState";
|
import { vehicleStatusKeys } from "../../tankopedia/tankState";
|
||||||
import type { ComputedCharacteristics } from "../../types/characteristics";
|
import type { ComputedCharacteristics } from "../../types/characteristics";
|
||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
@@ -31,11 +30,12 @@ interface TankopediaLoadoutProps {
|
|||||||
|
|
||||||
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 (
|
||||||
<>
|
<>
|
||||||
{/* {showModules && <Modules />} */}
|
{/* {showModules && <Modules />} */}
|
||||||
|
<Shells />
|
||||||
<Equipment />
|
<Equipment />
|
||||||
<Provisions />
|
<Provisions />
|
||||||
<Consumables characteristics={characteristics} />
|
<Consumables characteristics={characteristics} />
|
||||||
@@ -105,7 +105,6 @@ function Status() {
|
|||||||
key={key}
|
key={key}
|
||||||
radius="1"
|
radius="1"
|
||||||
className={styles.state}
|
className={styles.state}
|
||||||
data-selected={status[key]}
|
|
||||||
color={status[key] ? "amber" : "gray"}
|
color={status[key] ? "amber" : "gray"}
|
||||||
variant={status[key] ? "surface" : "soft"}
|
variant={status[key] ? "surface" : "soft"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -125,6 +124,52 @@ function Status() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Shells() {
|
||||||
|
const strings = useStrings();
|
||||||
|
const unwrap = useUnwrapper();
|
||||||
|
|
||||||
|
const gun = useDuel("protagonist", DuelModule.Gun);
|
||||||
|
const shell = useDuel("protagonist", DuelModule.Shell);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.section}>
|
||||||
|
<div className={styles.header}>
|
||||||
|
<Heading size="4">{strings.tanks.loadout.shells}</Heading>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.shells}>
|
||||||
|
{gun.shells.map((candidate) => {
|
||||||
|
const isSelected = candidate.id === shell.id;
|
||||||
|
const name = unwrap(candidate.name!);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip key={candidate.id} tooltip={name}>
|
||||||
|
<IconButton
|
||||||
|
aria-label={name}
|
||||||
|
size="major"
|
||||||
|
radius="1"
|
||||||
|
color={isSelected ? undefined : "gray"}
|
||||||
|
variant={isSelected ? "surface" : "soft"}
|
||||||
|
parentListChild
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.shell = candidate.id;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt={name}
|
||||||
|
src={alias("api", `/icons/shells/${candidate.icon}.webp`)}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function Provisions() {
|
function Provisions() {
|
||||||
const strings = useStrings();
|
const strings = useStrings();
|
||||||
const tank = useDuel("protagonist", DuelModule.Tank);
|
const tank = useDuel("protagonist", DuelModule.Tank);
|
||||||
@@ -447,7 +492,6 @@ function EquipmentOption({
|
|||||||
size="major"
|
size="major"
|
||||||
color={isSelected ? undefined : "gray"}
|
color={isSelected ? undefined : "gray"}
|
||||||
variant={isSelected ? "surface" : "soft"}
|
variant={isSelected ? "surface" : "soft"}
|
||||||
data-selected={isSelected}
|
|
||||||
radius="1"
|
radius="1"
|
||||||
parentListChild
|
parentListChild
|
||||||
className={styles.slot}
|
className={styles.slot}
|
||||||
|
|||||||
Reference in new issue
Block a user