mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 04:59:50 +01:00
well at least some of it is showing up i guess
This commit is contained in:
1 parent
43fc98e37d
commit
4694d495bb
4 files changed
+228
-202
No files matched your search
@@ -69,6 +69,13 @@
|
||||
|
||||
.label {
|
||||
white-space: nowrap;
|
||||
|
||||
line-height: 1;
|
||||
|
||||
img,
|
||||
svg {
|
||||
height: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
&:has(input:checked) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
.options {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
align-items: center;
|
||||
|
||||
transition: var(--duration-brief);
|
||||
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: var(--space-4);
|
||||
|
||||
transform: translate(-50%, calc(100% + var(--space-4)) s);
|
||||
|
||||
&[data-visible="true"] {
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
.controls {
|
||||
display: flex;
|
||||
gap: var(--space-4);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { alias, romanize, uniqueGuns } from "@blitzkit/core";
|
||||
import { literals } from "@blitzkit/i18n/src/literals";
|
||||
import { Flex, IconButton, Popover, Text } from "@radix-ui/themes";
|
||||
import { uniqueGuns } from "@blitzkit/core";
|
||||
import { ShadowInnerIcon, ShadowNoneIcon } from "@radix-ui/react-icons";
|
||||
import { useState, type RefObject } from "react";
|
||||
import { DuelModule, useDuel } from "../../hooks/useDuel";
|
||||
import { useEquipment } from "../../hooks/useEquipment";
|
||||
@@ -11,26 +10,16 @@ import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||
import { Tankopedia } from "../../stores/tankopedia";
|
||||
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
||||
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
||||
import type { ComputedCharacteristics } from "../../types/characteristics";
|
||||
import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
|
||||
import { EqualIcon } from "../EqualIcon";
|
||||
import { ModuleButton } from "../ModuleButtons/ModuleButton";
|
||||
import {
|
||||
SidebarIconButton,
|
||||
SidebarIconGroup,
|
||||
} from "../TankopediaSidebarIconButtons";
|
||||
import { CustomShellButton } from "./components/CustomShellButton";
|
||||
import { IconButton } from "../IconButton";
|
||||
import { SegmentedControl } from "../SegmentedControl";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
type OptionsProps = MaybeSkeletonComponentProps & {
|
||||
canvas: RefObject<HTMLCanvasElement>;
|
||||
antagonistCharacteristics: ComputedCharacteristics;
|
||||
};
|
||||
|
||||
export function TankopediaOptions({
|
||||
canvas,
|
||||
skeleton,
|
||||
antagonistCharacteristics,
|
||||
}: OptionsProps) {
|
||||
export function TankopediaOptions({ canvas, skeleton }: OptionsProps) {
|
||||
const strings = useStrings();
|
||||
const unwrap = useUnwrapper();
|
||||
|
||||
@@ -59,215 +48,216 @@ export function TankopediaOptions({
|
||||
const equalize = Tankopedia.use((state) => state.environment.equalize);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
<div className={styles.options}>
|
||||
<div className={styles.controls}>
|
||||
{disturbed && (
|
||||
<>
|
||||
{requestedDisplay === TankopediaDisplay.DynamicArmor && (
|
||||
<IconButton
|
||||
size="minor"
|
||||
highContrast
|
||||
onClick={() => {
|
||||
TankopediaPersistent.mutate((draft) => {
|
||||
draft.advancedHighlighting = !draft.advancedHighlighting;
|
||||
});
|
||||
}}
|
||||
color={advancedHighlighting ? undefined : "gray"}
|
||||
variant={advancedHighlighting ? "solid" : "surface"}
|
||||
>
|
||||
{advancedHighlighting ? (
|
||||
<ShadowInnerIcon />
|
||||
) : (
|
||||
<ShadowNoneIcon />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
{/* <Flex
|
||||
direction="column"
|
||||
align="center"
|
||||
position="absolute"
|
||||
bottom={revealed ? "4" : "-100%"}
|
||||
left="50%"
|
||||
style={{ transform: "translateX(-50%)", transitionDuration: "200ms" }}
|
||||
gap="2"
|
||||
>
|
||||
<Flex
|
||||
gap="2"
|
||||
align="center"
|
||||
style={{ transitionDuration: "200ms" }}
|
||||
position="relative"
|
||||
>
|
||||
{disturbed && (
|
||||
<>
|
||||
{requestedDisplay === TankopediaDisplay.DynamicArmor && (
|
||||
{/* <DropdownMenu.Root>
|
||||
<DropdownMenu.Trigger>
|
||||
<IconButton
|
||||
size="2"
|
||||
variant="surface"
|
||||
highContrast
|
||||
onClick={() => {
|
||||
TankopediaPersistent.mutate((draft) => {
|
||||
draft.advancedHighlighting = !draft.advancedHighlighting;
|
||||
});
|
||||
}}
|
||||
color={advancedHighlighting ? undefined : "gray"}
|
||||
variant={advancedHighlighting ? "solid" : "surface"}
|
||||
color="gray"
|
||||
>
|
||||
{advancedHighlighting ? (
|
||||
<ShadowInnerIcon />
|
||||
) : (
|
||||
<ShadowNoneIcon />
|
||||
)}
|
||||
<EyeOpenIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
</DropdownMenu.Trigger>
|
||||
|
||||
<DropdownMenu.Root>
|
||||
<DropdownMenu.Trigger>
|
||||
<IconButton
|
||||
size="2"
|
||||
variant="surface"
|
||||
highContrast
|
||||
color="gray"
|
||||
>
|
||||
<EyeOpenIcon />
|
||||
</IconButton>
|
||||
</DropdownMenu.Trigger>
|
||||
<DropdownMenu.Content>
|
||||
<DropdownMenu.Item
|
||||
onClick={() => poseEvent.emit(Pose.HullDown)}
|
||||
>
|
||||
{strings.tanks.poses.hull_down}
|
||||
</DropdownMenu.Item>
|
||||
|
||||
<DropdownMenu.Content>
|
||||
<DropdownMenu.Item
|
||||
onClick={() => poseEvent.emit(Pose.HullDown)}
|
||||
>
|
||||
{strings.tanks.poses.hull_down}
|
||||
</DropdownMenu.Item>
|
||||
<DropdownMenu.Item onClick={() => poseEvent.emit(Pose.FaceHug)}>
|
||||
{strings.tanks.poses.face_hug}
|
||||
</DropdownMenu.Item>
|
||||
|
||||
<DropdownMenu.Item
|
||||
onClick={() => poseEvent.emit(Pose.FaceHug)}
|
||||
>
|
||||
{strings.tanks.poses.face_hug}
|
||||
</DropdownMenu.Item>
|
||||
<DropdownMenu.Item onClick={() => poseEvent.emit(Pose.Default)}>
|
||||
{strings.tanks.poses.default}
|
||||
</DropdownMenu.Item>
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Root> */}
|
||||
|
||||
<DropdownMenu.Item
|
||||
onClick={() => poseEvent.emit(Pose.Default)}
|
||||
>
|
||||
{strings.tanks.poses.default}
|
||||
</DropdownMenu.Item>
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Root>
|
||||
<IconButton
|
||||
size="2"
|
||||
highContrast
|
||||
onClick={() => {
|
||||
TankopediaPersistent.mutate((draft) => {
|
||||
draft.highGraphics = !draft.highGraphics;
|
||||
});
|
||||
}}
|
||||
color={highGraphics ? undefined : "gray"}
|
||||
variant={highGraphics ? "solid" : "surface"}
|
||||
>
|
||||
<SunIcon />
|
||||
</IconButton>
|
||||
|
||||
<ScreenshotButton
|
||||
color="gray"
|
||||
size="2"
|
||||
variant="surface"
|
||||
highContrast
|
||||
canvas={canvas}
|
||||
name={protagonistTank.slug}
|
||||
/>
|
||||
|
||||
{fullScreenAvailable && (
|
||||
<IconButton
|
||||
size="2"
|
||||
highContrast
|
||||
onClick={() => {
|
||||
TankopediaPersistent.mutate((draft) => {
|
||||
draft.highGraphics = !draft.highGraphics;
|
||||
});
|
||||
if (isFullScreen) {
|
||||
document.exitFullscreen();
|
||||
} else document.body.requestFullscreen();
|
||||
}}
|
||||
color={highGraphics ? undefined : "gray"}
|
||||
variant={highGraphics ? "solid" : "surface"}
|
||||
color={isFullScreen ? undefined : "gray"}
|
||||
variant={isFullScreen ? "solid" : "surface"}
|
||||
>
|
||||
<SunIcon />
|
||||
{isFullScreen ? (
|
||||
<ExitFullScreenIcon />
|
||||
) : (
|
||||
<EnterFullScreenIcon />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ScreenshotButton
|
||||
color="gray"
|
||||
size="2"
|
||||
variant="surface"
|
||||
highContrast
|
||||
canvas={canvas}
|
||||
name={protagonistTank.slug}
|
||||
/>
|
||||
<div gap="3" align="center" mt="2">
|
||||
<SegmentedControl
|
||||
onValueChange={(value) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.requestedDisplay = Number(value);
|
||||
});
|
||||
}}
|
||||
value={`${requestedDisplay}`}
|
||||
options={[
|
||||
{
|
||||
label: <img src="/assets/images/icons/tankopedia-model.png" />,
|
||||
value: `${TankopediaDisplay.Model}`,
|
||||
},
|
||||
{
|
||||
label: (
|
||||
<img src="/assets/images/icons/tankopedia-dynamic-armor.png" />
|
||||
),
|
||||
value: `${TankopediaDisplay.DynamicArmor}`,
|
||||
},
|
||||
{
|
||||
label: (
|
||||
<img src="/assets/images/icons/tankopedia-static-armor.png" />
|
||||
),
|
||||
value: `${TankopediaDisplay.StaticArmor}`,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{/* <SegmentedControl.Root
|
||||
variant="classic"
|
||||
value={`${disturbed ? requestedDisplay : -1}`}
|
||||
onValueChange={(value) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.disturbed = true;
|
||||
draft.requestedDisplay = Number(value);
|
||||
});
|
||||
}}
|
||||
>
|
||||
<SegmentedControl.Item value={`${TankopediaDisplay.Model}`}>
|
||||
<Tooltip tooltip={strings.tanks.tabs.model}>
|
||||
<div height="100%" align="center">
|
||||
|
||||
</Tooltip>
|
||||
</SegmentedControl.Item>
|
||||
<SegmentedControl.Item value={`${TankopediaDisplay.DynamicArmor}`}>
|
||||
<Tooltip tooltip={strings.tanks.tabs.dynamic_armor}>
|
||||
<div height="100%" align="center">
|
||||
<img
|
||||
src="/assets/images/icons/tankopedia-dynamic-armor.png"
|
||||
style={{ height: "1.25em" }}
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</SegmentedControl.Item>
|
||||
<SegmentedControl.Item value={`${TankopediaDisplay.StaticArmor}`}>
|
||||
<Tooltip tooltip={strings.tanks.tabs.model}>
|
||||
<div height="100%" align="center">
|
||||
<img
|
||||
src="/assets/images/icons/tankopedia-static-armor.png"
|
||||
style={{ height: "1.25em" }}
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</SegmentedControl.Item>
|
||||
</SegmentedControl.Root> */}
|
||||
|
||||
{fullScreenAvailable && (
|
||||
<IconButton
|
||||
size="2"
|
||||
highContrast
|
||||
onClick={() => {
|
||||
if (isFullScreen) {
|
||||
document.exitFullscreen();
|
||||
} else document.body.requestFullscreen();
|
||||
}}
|
||||
color={isFullScreen ? undefined : "gray"}
|
||||
variant={isFullScreen ? "solid" : "surface"}
|
||||
>
|
||||
{isFullScreen ? (
|
||||
<ExitFullScreenIcon />
|
||||
) : (
|
||||
<EnterFullScreenIcon />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Flex>
|
||||
|
||||
<Flex gap="3" align="center" mt="2">
|
||||
<SegmentedControl.Root
|
||||
variant="classic"
|
||||
value={`${disturbed ? requestedDisplay : -1}`}
|
||||
onValueChange={(value) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.disturbed = true;
|
||||
draft.requestedDisplay = Number(value);
|
||||
});
|
||||
}}
|
||||
{requestedDisplay === TankopediaDisplay.DynamicArmor && (
|
||||
<Dialog.Root
|
||||
open={antagonistSelectorOpen}
|
||||
onOpenChange={setAntagonistSelectorOpen}
|
||||
>
|
||||
<SegmentedControl.Item value={`${TankopediaDisplay.Model}`}>
|
||||
<Tooltip tooltip={strings.tanks.tabs.model}>
|
||||
<Flex height="100%" align="center">
|
||||
<img
|
||||
src="/assets/images/icons/tankopedia-model.png"
|
||||
style={{ height: "1.25em" }}
|
||||
/>
|
||||
</Flex>
|
||||
</Tooltip>
|
||||
</SegmentedControl.Item>
|
||||
<SegmentedControl.Item value={`${TankopediaDisplay.DynamicArmor}`}>
|
||||
<Tooltip tooltip={strings.tanks.tabs.dynamic_armor}>
|
||||
<Flex height="100%" align="center">
|
||||
<img
|
||||
src="/assets/images/icons/tankopedia-dynamic-armor.png"
|
||||
style={{ height: "1.25em" }}
|
||||
/>
|
||||
</Flex>
|
||||
</Tooltip>
|
||||
</SegmentedControl.Item>
|
||||
<SegmentedControl.Item value={`${TankopediaDisplay.StaticArmor}`}>
|
||||
<Tooltip tooltip={strings.tanks.tabs.model}>
|
||||
<Flex height="100%" align="center">
|
||||
<img
|
||||
src="/assets/images/icons/tankopedia-static-armor.png"
|
||||
style={{ height: "1.25em" }}
|
||||
/>
|
||||
</Flex>
|
||||
</Tooltip>
|
||||
</SegmentedControl.Item>
|
||||
</SegmentedControl.Root>
|
||||
<Dialog.Trigger>
|
||||
<Button variant="solid" highContrast>
|
||||
<Crosshair1Icon />
|
||||
{unwrap(antagonistTank.name!)}
|
||||
<SmallTankIcon id={antagonistTank.id} size={16} />
|
||||
</Button>
|
||||
</Dialog.Trigger>
|
||||
|
||||
{requestedDisplay === TankopediaDisplay.DynamicArmor && (
|
||||
<Dialog.Root
|
||||
open={antagonistSelectorOpen}
|
||||
onOpenChange={setAntagonistSelectorOpen}
|
||||
>
|
||||
<Dialog.Trigger>
|
||||
<Button variant="solid" highContrast>
|
||||
<Crosshair1Icon />
|
||||
{unwrap(antagonistTank.name!)}
|
||||
<SmallTankIcon id={antagonistTank.id} size={16} />
|
||||
</Button>
|
||||
</Dialog.Trigger>
|
||||
<Dialog.Content>
|
||||
<Dialog.Title align="center">
|
||||
{strings.website.common.tank_search.select_dialog_title}
|
||||
</Dialog.Title>
|
||||
|
||||
<Dialog.Content>
|
||||
<Dialog.Title align="center">
|
||||
{strings.website.common.tank_search.select_dialog_title}
|
||||
</Dialog.Title>
|
||||
<Tabs.Root
|
||||
value={tab}
|
||||
onValueChange={setTab}
|
||||
style={{ position: "relative" }}
|
||||
>
|
||||
<TankSearch
|
||||
compact
|
||||
onSelect={(tank) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.antagonist.tank = tank.id;
|
||||
draft.antagonist.engine = tank.engines.at(-1)!.id;
|
||||
draft.antagonist.track = tank.tracks.at(-1)!.id;
|
||||
|
||||
<Tabs.Root
|
||||
value={tab}
|
||||
onValueChange={setTab}
|
||||
style={{ position: "relative" }}
|
||||
>
|
||||
<TankSearch
|
||||
compact
|
||||
onSelect={(tank) => {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.antagonist.tank = tank.id;
|
||||
draft.antagonist.engine = tank.engines.at(-1)!.id;
|
||||
draft.antagonist.track = tank.tracks.at(-1)!.id;
|
||||
const turret = tank.turrets.at(-1)!;
|
||||
const gun = turret.guns.at(-1)!;
|
||||
|
||||
const turret = tank.turrets.at(-1)!;
|
||||
const gun = turret.guns.at(-1)!;
|
||||
|
||||
draft.antagonist.turret = turret.id;
|
||||
draft.antagonist.gun = gun.id;
|
||||
draft.antagonist.shell = gun.shells[0].id;
|
||||
});
|
||||
setAntagonistSelectorOpen(false);
|
||||
}}
|
||||
/>
|
||||
</Tabs.Root>
|
||||
</Dialog.Content>
|
||||
</Dialog.Root>
|
||||
)}
|
||||
</Flex>
|
||||
</Flex> */}
|
||||
</>
|
||||
draft.antagonist.turret = turret.id;
|
||||
draft.antagonist.gun = gun.id;
|
||||
draft.antagonist.shell = gun.shells[0].id;
|
||||
});
|
||||
setAntagonistSelectorOpen(false);
|
||||
}}
|
||||
/>
|
||||
</Tabs.Root>
|
||||
</Dialog.Content>
|
||||
</Dialog.Root>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { SmartCanvas } from "../SmartCanvas";
|
||||
import { StaticArmor, type ThicknessRange } from "../StaticArmor";
|
||||
import { TankModel } from "../TankModel";
|
||||
import { TankopediaAntagonistControl } from "../TankopediaAntagonistControl";
|
||||
import { TankopediaOptions } from "../TankopediaOptions";
|
||||
import { TankopediaSkinSwitcher } from "../TankopediaSkinSwitcher";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
@@ -178,6 +179,7 @@ export function TankopediaSandbox({
|
||||
<TankopediaAntagonistControl
|
||||
antagonistCharacteristics={antagonistCharacteristics}
|
||||
/>
|
||||
<TankopediaOptions />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user