mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: fullscreen hydration
This commit is contained in:
1 parent
74d4b8edf4
commit
c27ebdbcb3
3 files changed
+17
-18
No files matched your search
@@ -104,24 +104,13 @@ export function HeroSection() {
|
||||
background: isFullScreen ? 'var(--color-background)' : undefined,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
position: 'absolute',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
<Box width="100%" height="100%" position="absolute">
|
||||
<Box width="100%" height="100%">
|
||||
<TankSandbox />
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
<Options />
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -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
|
||||
</DropdownMenu.CheckboxItem>
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { useLayoutEffect, useState } from 'react';
|
||||
|
||||
export function useFullscreenAvailability() {
|
||||
const [available, setAvailable] = useState(false);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setAvailable(document.fullscreenEnabled);
|
||||
}, []);
|
||||
|
||||
return available;
|
||||
}
|
||||
Reference in new issue
Block a user