mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: better antagonist bar
This commit is contained in:
1 parent
9a91a8bb13
commit
d0d905ccfb
1 file changed
+40
-29
@@ -1,4 +1,4 @@
|
|||||||
import { CaretRightIcon, Cross1Icon, ShuffleIcon } from '@radix-ui/react-icons';
|
import { Cross1Icon, ShuffleIcon } from '@radix-ui/react-icons';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -6,10 +6,8 @@ import {
|
|||||||
Flex,
|
Flex,
|
||||||
Heading,
|
Heading,
|
||||||
Tabs,
|
Tabs,
|
||||||
Text,
|
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from '@radix-ui/themes';
|
} from '@radix-ui/themes';
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { ModuleButton } from '../../../../../components/ModuleButtons/ModuleButton';
|
import { ModuleButton } from '../../../../../components/ModuleButtons/ModuleButton';
|
||||||
import { ShellButton } from '../../../../../components/ModuleButtons/ShellButton';
|
import { ShellButton } from '../../../../../components/ModuleButtons/ShellButton';
|
||||||
@@ -37,11 +35,11 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
const [tab, setTab] = useState('search');
|
const [tab, setTab] = useState('search');
|
||||||
const [antagonistSelectorOpen, setAntagonistSelectorVisible] =
|
const [antagonistSelectorOpen, setAntagonistSelectorVisible] =
|
||||||
useState(false);
|
useState(false);
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
if (mode !== 'armor') return null;
|
if (mode !== 'armor') return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Flex justify="center">
|
||||||
<Card
|
<Card
|
||||||
style={
|
style={
|
||||||
floating
|
floating
|
||||||
@@ -54,7 +52,14 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Flex align="center" justify="between" gap="6">
|
<Flex
|
||||||
|
align="center"
|
||||||
|
justify="center"
|
||||||
|
wrap="wrap"
|
||||||
|
style={{
|
||||||
|
gap: 'min(5vw, 32px)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Flex>
|
<Flex>
|
||||||
{antagonist.gun.shells.map((shell, index) => {
|
{antagonist.gun.shells.map((shell, index) => {
|
||||||
return (
|
return (
|
||||||
@@ -78,9 +83,22 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
})}
|
})}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex align="center" gap="4">
|
<Button
|
||||||
{!floating && <Text>Versus</Text>}
|
variant="ghost"
|
||||||
|
onClick={() => {
|
||||||
|
mutateDuel((draft) => {
|
||||||
|
[draft.protagonist, draft.antagonist] = [
|
||||||
|
draft.antagonist,
|
||||||
|
draft.protagonist,
|
||||||
|
];
|
||||||
|
pushTankopediaPath(draft.antagonist!.tank.id);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ShuffleIcon /> Swap
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Flex align="center" gap="4">
|
||||||
{floating && (
|
{floating && (
|
||||||
<Flex gap="2" align="center">
|
<Flex gap="2" align="center">
|
||||||
Versus {antagonist.tank.name}
|
Versus {antagonist.tank.name}
|
||||||
@@ -96,9 +114,8 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
<Dialog.Trigger>
|
<Dialog.Trigger>
|
||||||
<Button variant="ghost">
|
<Button variant="ghost">
|
||||||
<Flex gap="2" align="center">
|
<Flex gap="2" align="center">
|
||||||
{antagonist.tank.name}
|
Versus {antagonist.tank.name}
|
||||||
<SmallTankIcon id={antagonist.tank.id} size={16} />
|
<SmallTankIcon id={antagonist.tank.id} size={16} />
|
||||||
<CaretRightIcon />
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Button>
|
</Button>
|
||||||
</Dialog.Trigger>
|
</Dialog.Trigger>
|
||||||
@@ -159,8 +176,12 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
|
|
||||||
<Flex gap="2" wrap="wrap">
|
<Flex gap="2" wrap="wrap">
|
||||||
<Flex>
|
<Flex>
|
||||||
{antagonist.tank.turrets.map((turret, index) => (
|
{antagonist.tank.turrets.map(
|
||||||
<Tooltip content={turret.name} key={turret.id}>
|
(turret, index) => (
|
||||||
|
<Tooltip
|
||||||
|
content={turret.name}
|
||||||
|
key={turret.id}
|
||||||
|
>
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
rowChild
|
rowChild
|
||||||
first={index === 0}
|
first={index === 0}
|
||||||
@@ -190,7 +211,8 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
module="turret"
|
module="turret"
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
))}
|
),
|
||||||
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex>
|
<Flex>
|
||||||
{antagonist.turret.guns.map((gun, index) => (
|
{antagonist.turret.guns.map((gun, index) => (
|
||||||
@@ -205,7 +227,8 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.antagonist!.gun = gun;
|
draft.antagonist!.gun = gun;
|
||||||
draft.antagonist!.shell = gun.shells[0];
|
draft.antagonist!.shell =
|
||||||
|
gun.shells[0];
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
selected={antagonist.gun.id === gun.id}
|
selected={antagonist.gun.id === gun.id}
|
||||||
@@ -236,7 +259,9 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
<li key={shell.id}>
|
<li key={shell.id}>
|
||||||
{SHELL_NAMES[shell.type]}:{' '}
|
{SHELL_NAMES[shell.type]}:{' '}
|
||||||
<b>
|
<b>
|
||||||
{resolveNearPenetration(shell.penetration)}
|
{resolveNearPenetration(
|
||||||
|
shell.penetration,
|
||||||
|
)}
|
||||||
mm
|
mm
|
||||||
</b>
|
</b>
|
||||||
, {shell.damage.armor}HP
|
, {shell.damage.armor}HP
|
||||||
@@ -253,22 +278,8 @@ export function AntagonistBar({ floating }: AntagonistBarProps) {
|
|||||||
</Dialog.Root>
|
</Dialog.Root>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
onClick={() => {
|
|
||||||
mutateDuel((draft) => {
|
|
||||||
[draft.protagonist, draft.antagonist] = [
|
|
||||||
draft.antagonist,
|
|
||||||
draft.protagonist,
|
|
||||||
];
|
|
||||||
pushTankopediaPath(draft.antagonist!.tank.id);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ShuffleIcon /> Swap
|
|
||||||
</Button>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Card>
|
</Card>
|
||||||
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user