mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: equipment icons
This commit is contained in:
1 parent
b053018958
commit
a1f6bbdf1f
2 files changed
+38
-4
No files matched your search
@@ -1,7 +1,8 @@
|
|||||||
import { Flex, Heading } from '@radix-ui/themes';
|
import { Flex, Heading } from '@radix-ui/themes';
|
||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import { Dispatch, SetStateAction } from 'react';
|
import { Dispatch, SetStateAction, use } from 'react';
|
||||||
import { ModuleButton } from '../../../../../components/ModuleButton';
|
import { ModuleButton } from '../../../../../components/ModuleButton';
|
||||||
|
import { equipmentDefinitions } from '../../../../../core/blitzkrieg/equipmentDefinitions';
|
||||||
import { Duel } from '../page';
|
import { Duel } from '../page';
|
||||||
|
|
||||||
interface ConfigureProps {
|
interface ConfigureProps {
|
||||||
@@ -10,6 +11,10 @@ interface ConfigureProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Configure({ duel, setDuel }: ConfigureProps) {
|
export function Configure({ duel, setDuel }: ConfigureProps) {
|
||||||
|
const awaitedEquipmentDefinitions = use(equipmentDefinitions);
|
||||||
|
const equipmentRows =
|
||||||
|
awaitedEquipmentDefinitions.presets[duel.protagonist.tank.equipment];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex gap="6" direction="column">
|
<Flex gap="6" direction="column">
|
||||||
<Heading>Configure</Heading>
|
<Heading>Configure</Heading>
|
||||||
@@ -85,6 +90,29 @@ export function Configure({ duel, setDuel }: ConfigureProps) {
|
|||||||
|
|
||||||
<Flex gap="4" direction="column">
|
<Flex gap="4" direction="column">
|
||||||
<Heading size="5">Equipment</Heading>
|
<Heading size="5">Equipment</Heading>
|
||||||
|
|
||||||
|
<Flex direction="column" gap="2">
|
||||||
|
{equipmentRows.map((equipmentRow) => (
|
||||||
|
<Flex gap="2">
|
||||||
|
{equipmentRow.map((equipment) => (
|
||||||
|
<Flex>
|
||||||
|
<ModuleButton
|
||||||
|
type="equipment"
|
||||||
|
equipment={equipment[0]}
|
||||||
|
first
|
||||||
|
rowChild
|
||||||
|
/>
|
||||||
|
<ModuleButton
|
||||||
|
type="equipment"
|
||||||
|
equipment={equipment[1]}
|
||||||
|
last
|
||||||
|
rowChild
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
|
))}
|
||||||
|
</Flex>
|
||||||
|
))}
|
||||||
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,13 +18,17 @@ type ModuleButtonProps = Omit<ComponentProps<typeof Button>, 'type'> & {
|
|||||||
type: 'shell';
|
type: 'shell';
|
||||||
shell: string;
|
shell: string;
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
type: 'equipment';
|
||||||
|
equipment: number;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export function ModuleButton({
|
export function ModuleButton({
|
||||||
selected,
|
selected,
|
||||||
style,
|
style,
|
||||||
first = true,
|
first = false,
|
||||||
last = true,
|
last = false,
|
||||||
rowChild,
|
rowChild,
|
||||||
...props
|
...props
|
||||||
}: ModuleButtonProps) {
|
}: ModuleButtonProps) {
|
||||||
@@ -51,7 +55,9 @@ export function ModuleButton({
|
|||||||
src={asset(
|
src={asset(
|
||||||
props.type === 'module'
|
props.type === 'module'
|
||||||
? `icons/modules/${props.module}.webp`
|
? `icons/modules/${props.module}.webp`
|
||||||
: `icons/shells/${props.shell}.webp`,
|
: props.type === 'shell'
|
||||||
|
? `icons/shells/${props.shell}.webp`
|
||||||
|
: `icons/equipment/${props.equipment}.webp`,
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
width: 32,
|
width: 32,
|
||||||
|
|||||||
Reference in new issue
Block a user