diff --git a/packages/website/src/components/GuessRenderer.tsx b/packages/website/src/components/GuessRenderer.tsx index 18573f8ec..b81e0574e 100644 --- a/packages/website/src/components/GuessRenderer.tsx +++ b/packages/website/src/components/GuessRenderer.tsx @@ -1,6 +1,5 @@ import { useModel } from "../hooks/useModel"; import { Guess, GuessState } from "../stores/guess"; -import { Controls } from "./CanvasControl"; import { Lighting } from "./Lighting"; import { SmartCanvas } from "./SmartCanvas"; import { TankModel } from "./TankModel"; diff --git a/packages/website/src/components/TankModel.tsx b/packages/website/src/components/TankModel.tsx index 78fb50895..d21cc9a9a 100644 --- a/packages/website/src/components/TankModel.tsx +++ b/packages/website/src/components/TankModel.tsx @@ -103,7 +103,10 @@ export function TankModel() { } function onPointerDown(event: ThreeEvent) { - if (isTrack && Tankopedia.state.display === TankopediaDisplay.Model) { + if ( + isTrack && + Tankopedia.state.loaders.display.loaded === TankopediaDisplay.Model + ) { position.set(event.clientX, event.clientY); event.stopPropagation(); diff --git a/packages/website/src/components/TankopediaSandbox/index.tsx b/packages/website/src/components/TankopediaSandbox/index.tsx index 737b18787..148ff23ab 100644 --- a/packages/website/src/components/TankopediaSandbox/index.tsx +++ b/packages/website/src/components/TankopediaSandbox/index.tsx @@ -49,7 +49,7 @@ export function TankopediaSandbox({ const model = Tankopedia.use((state) => state.protagonist.model); const turretModelDefinition = model.turrets[turret.id]; const gunModelDefinition = turretModelDefinition.guns[gun.id]; - const display = Tankopedia.use((state) => state.display); + const display = Tankopedia.use((state) => state.loaders.display.loaded); function handlePointerDown() { window.addEventListener("pointermove", handlePointerMove); @@ -185,7 +185,7 @@ export function TankopediaSandbox({ } function Content({ thicknessRange }: { thicknessRange: ThicknessRange }) { - const display = Tankopedia.use((state) => state.display); + const display = Tankopedia.use((state) => state.loaders.display.loaded); const tank = useDuel("protagonist", DuelModule.Tank); const { hasPbr } = useModel(tank.id); diff --git a/packages/website/src/components/TankopediaSkinSwitcher/index.module.css b/packages/website/src/components/TankopediaSkinSwitcher/index.module.css index 0d667f026..6c47eb625 100644 --- a/packages/website/src/components/TankopediaSkinSwitcher/index.module.css +++ b/packages/website/src/components/TankopediaSkinSwitcher/index.module.css @@ -12,10 +12,17 @@ transform: translate(calc(100% + var(--space-4)), -50%); + gap: var(--space-3); + &[data-visible="true"] { transform: translate(0, -50%); } + .group { + display: flex; + flex-direction: column; + } + .camouflage-icon { border-radius: 50%; } diff --git a/packages/website/src/components/TankopediaSkinSwitcher/index.tsx b/packages/website/src/components/TankopediaSkinSwitcher/index.tsx index 615477cf3..7a5f31d9f 100644 --- a/packages/website/src/components/TankopediaSkinSwitcher/index.tsx +++ b/packages/website/src/components/TankopediaSkinSwitcher/index.tsx @@ -32,45 +32,57 @@ export function TankopediaSkinSwitcher() { if (skins.length === 0) return null; + const groups = [ + skins.filter((camouflage) => !camouflage.attachment), + skins.filter((camouflage) => camouflage.attachment), + ].filter((group) => group.length > 0); + return (
- {skins.map((camouflage) => { - const name = unwrap(camouflage.name!).replace( - "%(camo_num)", - SKIN_NUMBER, - ); + {groups.map((group, index) => ( +
+ {group.map((camouflage) => { + const name = unwrap(camouflage.name!).replace( + "%(camo_num)", + SKIN_NUMBER, + ); - const selected = skin === camouflage.id; + const selected = skin === camouflage.id; - return ( - - { - Tankopedia.mutate((draft) => { - draft.loaders.skin.requested = - draft.loaders.skin.requested === camouflage.id - ? undefined - : camouflage.id; - }); - }} - > - {name} - - - ); - })} + return ( + + { + Tankopedia.mutate((draft) => { + draft.loaders.skin.requested = + draft.loaders.skin.requested === camouflage.id + ? undefined + : camouflage.id; + }); + }} + > + {name} + + + ); + })} +
+ ))}
); } diff --git a/packages/website/src/stores/tankopedia.ts b/packages/website/src/stores/tankopedia.ts index 2ab6d8adc..50c39c704 100644 --- a/packages/website/src/stores/tankopedia.ts +++ b/packages/website/src/stores/tankopedia.ts @@ -81,6 +81,21 @@ interface LoaderState { loaded: Type; } +type HighlightArmor = { + editingPlate: boolean; + name: string; + point: Vector3; + thickness: number; + color: string; +} & ( + | { + type: ArmorType.Primary | ArmorType.Spaced; + thicknessAngled: number; + angle: number; + } + | { type: ArmorType.External } +); + interface Tankopedia { disturbed: boolean; revealed: boolean; @@ -98,22 +113,11 @@ interface Tankopedia { attachment: LoaderState; }; - // shot?: Shot; + shot?: Shot; + highlightArmor?: HighlightArmor; + // editStatic: boolean; - // highlightArmor?: { - // editingPlate: boolean; - // name: string; - // point: Vector3; - // thickness: number; - // color: string; - // } & ( - // | { - // type: ArmorType.Primary | ArmorType.Spaced; - // thicknessAngled: number; - // angle: number; - // } - // | { type: ArmorType.External } - // ); + // xpMultiplier: (typeof XP_MULTIPLIERS)[number]; // customShell?: ShellDefinition; // statSearch?: string;