mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: cleaner fullscreen
This commit is contained in:
1 parent
c9cfb16469
commit
cebc4392ed
6 files changed
+13
-30
No files matched your search
+1
-3
@@ -12,7 +12,6 @@ import Navbar from '../components/Navbar';
|
|||||||
import { Party3 } from '../components/Party3';
|
import { Party3 } from '../components/Party3';
|
||||||
import isDev from '../core/blitzkit/isDev';
|
import isDev from '../core/blitzkit/isDev';
|
||||||
import { isLocalhost } from '../core/blitzkit/isLocalhost';
|
import { isLocalhost } from '../core/blitzkit/isLocalhost';
|
||||||
import { useFullScreen } from '../hooks/useFullScreen';
|
|
||||||
import { useApp } from '../stores/app';
|
import { useApp } from '../stores/app';
|
||||||
|
|
||||||
config();
|
config();
|
||||||
@@ -34,7 +33,6 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
const isRoot = pathname === '/';
|
const isRoot = pathname === '/';
|
||||||
const darkMode = useApp((state) => state.darkMode);
|
const darkMode = useApp((state) => state.darkMode);
|
||||||
const [showDevBuildAlert, setShowDevBuildAlert] = useState(false);
|
const [showDevBuildAlert, setShowDevBuildAlert] = useState(false);
|
||||||
const isFullScreen = useFullScreen();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setShowDevBuildAlert(
|
setShowDevBuildAlert(
|
||||||
@@ -120,7 +118,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
{children}
|
{children}
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
||||||
{!isEmbed && !isFullScreen && <Footer />}
|
{!isEmbed && <Footer />}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Theme>
|
</Theme>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import {
|
|||||||
GUN_TYPE_NAMES,
|
GUN_TYPE_NAMES,
|
||||||
} from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
} from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
||||||
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
||||||
import { useFullScreen } from '../../../../../../hooks/useFullScreen';
|
|
||||||
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
||||||
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
||||||
import { useTankopediaTemporary } from '../../../../../../stores/tankopedia';
|
import { useTankopediaTemporary } from '../../../../../../stores/tankopedia';
|
||||||
@@ -38,7 +37,6 @@ export function Characteristics() {
|
|||||||
const awaitedProvisionDefinitions = use(provisionDefinitions);
|
const awaitedProvisionDefinitions = use(provisionDefinitions);
|
||||||
const crewSkills = useTankopediaTemporary((state) => state.skills);
|
const crewSkills = useTankopediaTemporary((state) => state.skills);
|
||||||
const penetrationDistanceInput = useRef<HTMLInputElement>(null);
|
const penetrationDistanceInput = useRef<HTMLInputElement>(null);
|
||||||
const isFullScreen = useFullScreen();
|
|
||||||
const hasImprovedVentilation = useEquipment(102);
|
const hasImprovedVentilation = useEquipment(102);
|
||||||
const crewMastery = useDuel((state) => state.protagonist!.crewMastery);
|
const crewMastery = useDuel((state) => state.protagonist!.crewMastery);
|
||||||
const [penetrationDistance, setPenetrationDistance] = useState(250);
|
const [penetrationDistance, setPenetrationDistance] = useState(250);
|
||||||
@@ -127,8 +125,6 @@ export function Characteristics() {
|
|||||||
});
|
});
|
||||||
}, [hasImprovedVerticalStabilizer]);
|
}, [hasImprovedVerticalStabilizer]);
|
||||||
|
|
||||||
if (isFullScreen) return null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex direction={wideFormat ? 'row' : 'column'} gap="8" wrap="wrap">
|
<Flex direction={wideFormat ? 'row' : 'column'} gap="8" wrap="wrap">
|
||||||
<Flex direction="column" gap="8" style={{ flex: 1 }}>
|
<Flex direction="column" gap="8" style={{ flex: 1 }}>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { ChevronLeftIcon, MixIcon } from '@radix-ui/react-icons';
|
|||||||
import { Button, Flex, Heading, Text } from '@radix-ui/themes';
|
import { Button, Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
||||||
|
import { useFullScreen } from '../../../../../../hooks/useFullScreen';
|
||||||
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
||||||
import strings from '../../../../../../lang/en-US.json';
|
import strings from '../../../../../../lang/en-US.json';
|
||||||
import { theme } from '../../../../../../stitches.config';
|
import { theme } from '../../../../../../stitches.config';
|
||||||
@@ -17,6 +18,7 @@ export function HeroSection() {
|
|||||||
protagonistTank.id === antagonistTank.id
|
protagonistTank.id === antagonistTank.id
|
||||||
? [protagonistTank.id]
|
? [protagonistTank.id]
|
||||||
: [protagonistTank.id, antagonistTank.id];
|
: [protagonistTank.id, antagonistTank.id];
|
||||||
|
const isFullScreen = useFullScreen();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@@ -87,9 +89,14 @@ export function HeroSection() {
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
height: wideFormat ? 512 : undefined,
|
|
||||||
flex: 2,
|
flex: 2,
|
||||||
position: 'relative',
|
position: isFullScreen ? 'fixed' : 'relative',
|
||||||
|
top: isFullScreen ? 0 : undefined,
|
||||||
|
left: isFullScreen ? 0 : undefined,
|
||||||
|
width: isFullScreen ? '100vw' : undefined,
|
||||||
|
height: isFullScreen ? '100vh' : wideFormat ? 512 : undefined,
|
||||||
|
zIndex: isFullScreen ? 3 : undefined,
|
||||||
|
background: isFullScreen ? theme.colors.appBackground1 : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { PerspectiveCamera } from '@react-three/drei';
|
import { PerspectiveCamera } from '@react-three/drei';
|
||||||
import { Canvas } from '@react-three/fiber';
|
import { Canvas } from '@react-three/fiber';
|
||||||
import { Suspense, use, useEffect, useRef, useState } from 'react';
|
import { Suspense, use, useEffect, useRef } from 'react';
|
||||||
import { isMobile } from 'react-device-detect';
|
|
||||||
import { Armor } from '../../../../../../components/Armor';
|
import { Armor } from '../../../../../../components/Armor';
|
||||||
import { ShotDisplay } from '../../../../../../components/Armor/components/ShotDisplay';
|
import { ShotDisplay } from '../../../../../../components/Armor/components/ShotDisplay';
|
||||||
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
@@ -9,13 +8,8 @@ import { modelDefinitions } from '../../../../../../core/blitzkit/modelDefinitio
|
|||||||
import { modelTransformEvent } from '../../../../../../core/blitzkit/modelTransform';
|
import { modelTransformEvent } from '../../../../../../core/blitzkit/modelTransform';
|
||||||
import { Pose, poseEvent } from '../../../../../../core/blitzkit/pose';
|
import { Pose, poseEvent } from '../../../../../../core/blitzkit/pose';
|
||||||
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
||||||
import { useFullScreen } from '../../../../../../hooks/useFullScreen';
|
|
||||||
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
|
||||||
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
||||||
import {
|
import { mutateTankopediaTemporary } from '../../../../../../stores/tankopedia';
|
||||||
mutateTankopediaTemporary,
|
|
||||||
useTankopediaPersistent,
|
|
||||||
} from '../../../../../../stores/tankopedia';
|
|
||||||
import { Controls } from '../Control';
|
import { Controls } from '../Control';
|
||||||
import { Lighting } from '../Lighting';
|
import { Lighting } from '../Lighting';
|
||||||
import { SceneProps } from '../SceneProps';
|
import { SceneProps } from '../SceneProps';
|
||||||
@@ -26,17 +20,11 @@ export function TankSandbox() {
|
|||||||
const canvas = useRef<HTMLCanvasElement>(null);
|
const canvas = useRef<HTMLCanvasElement>(null);
|
||||||
const hasImprovedVerticalStabilizer = useEquipment(122);
|
const hasImprovedVerticalStabilizer = useEquipment(122);
|
||||||
const awaitedModelDefinitions = use(modelDefinitions);
|
const awaitedModelDefinitions = use(modelDefinitions);
|
||||||
const canvasWrapper = useRef<HTMLDivElement>(null);
|
|
||||||
const mode = useTankopediaPersistent((state) => state.mode);
|
|
||||||
const protagonist = useDuel((state) => state.protagonist!);
|
const protagonist = useDuel((state) => state.protagonist!);
|
||||||
const tankModelDefinition = awaitedModelDefinitions[protagonist.tank.id];
|
const tankModelDefinition = awaitedModelDefinitions[protagonist.tank.id];
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
tankModelDefinition.turrets[protagonist.turret.id];
|
tankModelDefinition.turrets[protagonist.turret.id];
|
||||||
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
|
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
|
||||||
const wideFormat = useWideFormat();
|
|
||||||
const [loadModel, setLoadModel] = useState(wideFormat || !isMobile);
|
|
||||||
const duel = useDuel();
|
|
||||||
const isFullScreen = useFullScreen();
|
|
||||||
|
|
||||||
function handlePointerDown() {
|
function handlePointerDown() {
|
||||||
window.addEventListener('pointermove', handlePointerMove);
|
window.addEventListener('pointermove', handlePointerMove);
|
||||||
|
|||||||
@@ -2,16 +2,14 @@ import { Flex, Heading, Link } from '@radix-ui/themes';
|
|||||||
import { use } from 'react';
|
import { use } from 'react';
|
||||||
import PageWrapper from '../../../../../components/PageWrapper';
|
import PageWrapper from '../../../../../components/PageWrapper';
|
||||||
import { videoDefinitions } from '../../../../../core/blitzkit/videos';
|
import { videoDefinitions } from '../../../../../core/blitzkit/videos';
|
||||||
import { useFullScreen } from '../../../../../hooks/useFullScreen';
|
|
||||||
import { useDuel } from '../../../../../stores/duel';
|
import { useDuel } from '../../../../../stores/duel';
|
||||||
|
|
||||||
export function Videos() {
|
export function Videos() {
|
||||||
const isFullScreen = useFullScreen();
|
|
||||||
const tank = useDuel((state) => state.protagonist!.tank);
|
const tank = useDuel((state) => state.protagonist!.tank);
|
||||||
const awaitedVideoDefinitions = use(videoDefinitions);
|
const awaitedVideoDefinitions = use(videoDefinitions);
|
||||||
const videos = awaitedVideoDefinitions[tank.id]?.videos ?? [];
|
const videos = awaitedVideoDefinitions[tank.id]?.videos ?? [];
|
||||||
|
|
||||||
if (isFullScreen || videos.length === 0) return null;
|
if (videos.length === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapper noFlex1>
|
<PageWrapper noFlex1>
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { TOOLS } from '../../constants/tools';
|
|||||||
import { authURL } from '../../core/blitz/authURL';
|
import { authURL } from '../../core/blitz/authURL';
|
||||||
import { extendAuth } from '../../core/blitz/extendAuth';
|
import { extendAuth } from '../../core/blitz/extendAuth';
|
||||||
import { logout } from '../../core/blitz/logout';
|
import { logout } from '../../core/blitz/logout';
|
||||||
import { useFullScreen } from '../../hooks/useFullScreen';
|
|
||||||
import { useWideFormat } from '../../hooks/useWideFormat';
|
import { useWideFormat } from '../../hooks/useWideFormat';
|
||||||
import { BlitzkitWide } from '../../icons/BlitzkitWide';
|
import { BlitzkitWide } from '../../icons/BlitzkitWide';
|
||||||
import { PatreonIcon } from '../../icons/Patreon';
|
import { PatreonIcon } from '../../icons/Patreon';
|
||||||
@@ -30,7 +29,6 @@ import { useApp } from '../../stores/app';
|
|||||||
import { LoggedIn } from './components/LoggedIn';
|
import { LoggedIn } from './components/LoggedIn';
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
const isFullScreen = useFullScreen();
|
|
||||||
const wideFormat = useWideFormat(480);
|
const wideFormat = useWideFormat(480);
|
||||||
const login = useApp((state) => state.login);
|
const login = useApp((state) => state.login);
|
||||||
|
|
||||||
@@ -47,8 +45,6 @@ export default function Navbar() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isFullScreen) return null;
|
|
||||||
|
|
||||||
const plugs = (
|
const plugs = (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
Reference in new issue
Block a user