mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
state buttons
This commit is contained in:
1 parent
c854e8f7cb
commit
b297babde5
3 files changed
+124
No files matched your search
@@ -263,6 +263,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"loadout": {
|
"loadout": {
|
||||||
|
"state": "State",
|
||||||
"consumables": "Consumables",
|
"consumables": "Consumables",
|
||||||
"modules": "Modules",
|
"modules": "Modules",
|
||||||
"equipment": "Equipment",
|
"equipment": "Equipment",
|
||||||
|
|||||||
@@ -13,6 +13,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.state {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: var(--space-3);
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.consumables {
|
.consumables {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
CornerBottomLeftIcon,
|
CornerBottomLeftIcon,
|
||||||
DoubleArrowLeftIcon,
|
DoubleArrowLeftIcon,
|
||||||
DoubleArrowRightIcon,
|
DoubleArrowRightIcon,
|
||||||
|
ExclamationTriangleIcon,
|
||||||
ResetIcon,
|
ResetIcon,
|
||||||
TrashIcon,
|
TrashIcon,
|
||||||
} from "@radix-ui/react-icons";
|
} from "@radix-ui/react-icons";
|
||||||
@@ -54,6 +55,7 @@ export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<State />
|
||||||
{showModules && <Modules />}
|
{showModules && <Modules />}
|
||||||
<Equipment />
|
<Equipment />
|
||||||
<Consumables characteristics={characteristics} />
|
<Consumables characteristics={characteristics} />
|
||||||
@@ -61,6 +63,117 @@ export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function State() {
|
||||||
|
const strings = useStrings();
|
||||||
|
const isShooting = Tankopedia.use((state) => state.protagonist.isShooting);
|
||||||
|
const isGunDamaged = Tankopedia.use(
|
||||||
|
(state) => state.protagonist.isGunDamaged,
|
||||||
|
);
|
||||||
|
const isTurretTraversing = Tankopedia.use(
|
||||||
|
(state) => state.protagonist.isTurretTraversing,
|
||||||
|
);
|
||||||
|
const isHullTraversing = Tankopedia.use(
|
||||||
|
(state) => state.protagonist.isHullTraversing,
|
||||||
|
);
|
||||||
|
const isCaughtOnFire = Tankopedia.use(
|
||||||
|
(state) => state.protagonist.isCaughtOnFire,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.section}>
|
||||||
|
<div className={styles.header}>
|
||||||
|
<Heading size="4">{strings.tanks.loadout.state}</Heading>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
color="red"
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.consumables = [];
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TrashIcon />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.state}>
|
||||||
|
<IconButton
|
||||||
|
radius="1"
|
||||||
|
className={styles.toggle}
|
||||||
|
color={isShooting ? undefined : "gray"}
|
||||||
|
variant={isShooting ? "surface" : "soft"}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.isShooting = !draft.protagonist.isShooting;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ExclamationTriangleIcon />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
radius="1"
|
||||||
|
className={styles.toggle}
|
||||||
|
color={isGunDamaged ? undefined : "gray"}
|
||||||
|
variant={isGunDamaged ? "surface" : "soft"}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.isGunDamaged = !draft.protagonist.isGunDamaged;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ExclamationTriangleIcon />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
radius="1"
|
||||||
|
className={styles.toggle}
|
||||||
|
color={isTurretTraversing ? undefined : "gray"}
|
||||||
|
variant={isTurretTraversing ? "surface" : "soft"}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.isTurretTraversing =
|
||||||
|
!draft.protagonist.isTurretTraversing;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ExclamationTriangleIcon />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
radius="1"
|
||||||
|
className={styles.toggle}
|
||||||
|
color={isHullTraversing ? undefined : "gray"}
|
||||||
|
variant={isHullTraversing ? "surface" : "soft"}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.isHullTraversing =
|
||||||
|
!draft.protagonist.isHullTraversing;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ExclamationTriangleIcon />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
radius="1"
|
||||||
|
className={styles.toggle}
|
||||||
|
color={isCaughtOnFire ? undefined : "gray"}
|
||||||
|
variant={isCaughtOnFire ? "surface" : "soft"}
|
||||||
|
onClick={() => {
|
||||||
|
Tankopedia.mutate((draft) => {
|
||||||
|
draft.protagonist.isCaughtOnFire =
|
||||||
|
!draft.protagonist.isCaughtOnFire;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ExclamationTriangleIcon />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
interface ConsumablesProps {
|
interface ConsumablesProps {
|
||||||
characteristics: ComputedCharacteristics;
|
characteristics: ComputedCharacteristics;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user