diff --git a/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx b/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx index 6bb9ee06b..29d714543 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx @@ -104,24 +104,13 @@ export function HeroSection() { background: isFullScreen ? 'var(--color-background)' : undefined, }} > -
-
+ + -
+ -
+ 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 1aeb51054..1a54382bd 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx @@ -31,6 +31,7 @@ import { } from '../../../../../../../core/blitzkit/tankDefinitions/constants'; import { useEquipment } from '../../../../../../../hooks/useEquipment'; import { useFullScreen } from '../../../../../../../hooks/useFullScreen'; +import { useFullscreenAvailability } from '../../../../../../../hooks/useFullscreenAvailability'; import * as App from '../../../../../../../stores/app'; import * as Duel from '../../../../../../../stores/duel'; import * as TankopediaEphemeral from '../../../../../../../stores/tankopediaEphemeral'; @@ -60,8 +61,7 @@ export function Options() { (state) => state.model.visual.showSpacedArmor, ); const opaque = TankopediaPersistent.use((state) => state.model.visual.opaque); - const fullScreenAvailable = - typeof document !== 'undefined' && document.fullscreenEnabled; + const fullScreenAvailable = useFullscreenAvailability(); const environment = TankopediaPersistent.use( (state) => state.model.visual.environment, ); @@ -533,7 +533,6 @@ export function Options() { }); }} > - {/* TODO: consider removing this? */} View environment diff --git a/src/hooks/useFullscreenAvailability.ts b/src/hooks/useFullscreenAvailability.ts new file mode 100644 index 000000000..13824cacb --- /dev/null +++ b/src/hooks/useFullscreenAvailability.ts @@ -0,0 +1,11 @@ +import { useLayoutEffect, useState } from 'react'; + +export function useFullscreenAvailability() { + const [available, setAvailable] = useState(false); + + useLayoutEffect(() => { + setAvailable(document.fullscreenEnabled); + }, []); + + return available; +}