From c3e449745e02b1481b539a7ade7f5653801197f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:22:53 -0500 Subject: [PATCH] feat: better hero --- .../tankopedia/[id]/components/Control.tsx | 5 +- .../tankopedia/[id]/components/Lighting.tsx | 1 + .../[id]/components/Model/HeroSection.tsx | 167 +++++++---------- .../components/Model/components/Options.tsx | 177 +++++++++--------- .../[id]/components/QuickInputs/index.css.ts | 4 + .../[id]/components/QuickInputs/index.tsx | 13 +- src/app/tools/tankopedia/[id]/page.tsx | 7 +- src/components/Navbar/index.css.ts | 8 +- 8 files changed, 176 insertions(+), 206 deletions(-) diff --git a/src/app/tools/tankopedia/[id]/components/Control.tsx b/src/app/tools/tankopedia/[id]/components/Control.tsx index b462cc6b4..0bbdd0caa 100644 --- a/src/app/tools/tankopedia/[id]/components/Control.tsx +++ b/src/app/tools/tankopedia/[id]/components/Control.tsx @@ -11,6 +11,7 @@ import { useAwait } from '../../../../../hooks/useAwait'; import * as Duel from '../../../../../stores/duel'; import * as TankopediaEphemeral from '../../../../../stores/tankopediaEphemeral'; +const initialPosition = [0, 5, -16] as const; const poseDistances: Record = { [Pose.HullDown]: 15, [Pose.FaceHug]: 5, @@ -59,7 +60,7 @@ export function Controls() { const [autoRotate, setAutoRotate] = useState(true); useEffect(() => { - camera.position.set(-10, 5, -12); + camera.position.set(...initialPosition); orbitControls.current?.target.set(0, 1.25, 0); }, [camera]); @@ -150,7 +151,7 @@ export function Controls() { } case Pose.Default: { - camera.position.set(-4, 4, -16); + camera.position.set(...initialPosition); orbitControls.current?.target.set(0, 1.25, 0); break; } diff --git a/src/app/tools/tankopedia/[id]/components/Lighting.tsx b/src/app/tools/tankopedia/[id]/components/Lighting.tsx index 894970b48..dc2b21685 100644 --- a/src/app/tools/tankopedia/[id]/components/Lighting.tsx +++ b/src/app/tools/tankopedia/[id]/components/Lighting.tsx @@ -24,6 +24,7 @@ export function Lighting() { return ( <> + (null); - const protagonist = Duel.use((state) => state.protagonist.tank); - const antagonist = Duel.use((state) => state.antagonist.tank); - const compareTanks = - protagonist.id === antagonist.id - ? [protagonist.id] - : [protagonist.id, antagonist.id]; const isFullScreen = useFullScreen(); + const protagonist = Duel.use((state) => state.protagonist.tank); const Icon = classIcons[protagonist.class]; const [dummyLoader, setDummyLoader] = useState(true); const treeColor = @@ -58,102 +53,72 @@ export function HeroSection({ id }: HeroSectionProps) { }, []); return ( - - - - - - {' '} - - - - {protagonist.name} - - - - - - - - - - - - + + + {tank.name} - - - - - - - - - } - > - - - - - - - + + + BlitzKit Tankopedia + - + + + + + + + + } + > + + + + + + + + ); } diff --git a/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx b/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx index e07e81dfd..40a073b4d 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx @@ -1,14 +1,15 @@ import { CameraIcon, + ChevronLeftIcon, CopyIcon, DownloadIcon, EnterFullScreenIcon, ExitFullScreenIcon, EyeOpenIcon, GearIcon, + MixIcon, } from '@radix-ui/react-icons'; import { - Box, Button, Dialog, DropdownMenu, @@ -16,7 +17,6 @@ import { IconButton, Popover, SegmentedControl, - Strong, Tabs, Text, Tooltip, @@ -24,6 +24,7 @@ import { import { invalidate } from '@react-three/fiber'; import { RefObject, use, useEffect, useState } from 'react'; import { ThicknessRange } from '../../../../../../../components/Armor/components/StaticArmor'; +import { Link } from '../../../../../../../components/Link'; import { ModuleButton } from '../../../../../../../components/ModuleButtons/ModuleButton'; import { SmallTankIcon } from '../../../../../../../components/SmallTankIcon'; import { resolveNearPenetration } from '../../../../../../../core/blitz/resolveNearPenetration'; @@ -60,6 +61,12 @@ export function Options({ thicknessRange, canvas }: OptionsProps) { const [display, setDisplay] = useState( TankopediaDisplay.Model, ); + const antagonist = Duel.use((state) => state.antagonist.tank); + const protagonist = Duel.use((state) => state.protagonist.tank); + const compareTanks = + protagonist.id === antagonist.id + ? [protagonist.id] + : [protagonist.id, antagonist.id]; const isFullScreen = useFullScreen(); const showGrid = TankopediaPersistent.use( (state) => state.model.visual.showGrid, @@ -108,31 +115,6 @@ export function Options({ thicknessRange, canvas }: OptionsProps) { return ( <> - {isFullScreen && ( - - - BlitzKit Tankopedia - - - )} - {display === TankopediaDisplay.StaticArmor && ( @@ -360,73 +342,30 @@ export function Options({ thicknessRange, canvas }: OptionsProps) { )} - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + {display === TankopediaDisplay.DynamicArmor && ( @@ -472,7 +411,7 @@ export function Options({ thicknessRange, canvas }: OptionsProps) { )} - + { @@ -525,6 +464,7 @@ export function Options({ thicknessRange, canvas }: OptionsProps) { + @@ -621,6 +561,61 @@ export function Options({ thicknessRange, canvas }: OptionsProps) { + + + + + + + + + + + + + + + + + + + + {fullScreenAvailable && ( state.antagonist.tank); + const compareTanks = + protagonist.tank.id === antagonist.id + ? [protagonist.tank.id] + : [protagonist.tank.id, antagonist.id]; useEffect(() => { yawInput.current!.value = radToDeg(protagonist.yaw).toFixed(1); @@ -54,17 +59,17 @@ export function QuickInputs() { return ( - - - {!exempt && } + {/* */} + {!exempt && } + {!exempt && } diff --git a/src/components/Navbar/index.css.ts b/src/components/Navbar/index.css.ts index bdfd45529..91b9e95ba 100644 --- a/src/components/Navbar/index.css.ts +++ b/src/components/Navbar/index.css.ts @@ -1,7 +1,7 @@ import { style, styleVariants } from '@vanilla-extract/css'; const MIN_WIDTH = 640 + 128; -const HEIGHT = 48; +export const NAVBAR_HEIGHT = 48; export const hamburger = style({ display: 'inline-flex', @@ -24,7 +24,7 @@ export const tools = style({ }); export const navbar = style({ - height: HEIGHT, + height: NAVBAR_HEIGHT, marginBottom: -1, // 1px overlap with content to bleed color position: 'sticky', top: 0, @@ -42,7 +42,7 @@ const navbarExpanderBase = style({ '@media': { [`screen and (min-width: ${MIN_WIDTH}px)`]: { - maxHeight: HEIGHT, + maxHeight: NAVBAR_HEIGHT, }, }, }); @@ -51,7 +51,7 @@ export const navbarExpander = styleVariants({ false: [ navbarExpanderBase, { - maxHeight: HEIGHT, + maxHeight: NAVBAR_HEIGHT, }, ], true: [