mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +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,
|
background: isFullScreen ? 'var(--color-background)' : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<Box width="100%" height="100%" position="absolute">
|
||||||
style={{
|
<Box width="100%" height="100%">
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
position: 'absolute',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TankSandbox />
|
<TankSandbox />
|
||||||
</div>
|
</Box>
|
||||||
|
|
||||||
<Options />
|
<Options />
|
||||||
</div>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
} 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 { useFullScreen } from '../../../../../../../hooks/useFullScreen';
|
||||||
|
import { useFullscreenAvailability } from '../../../../../../../hooks/useFullscreenAvailability';
|
||||||
import * as App from '../../../../../../../stores/app';
|
import * as App from '../../../../../../../stores/app';
|
||||||
import * as Duel from '../../../../../../../stores/duel';
|
import * as Duel from '../../../../../../../stores/duel';
|
||||||
import * as TankopediaEphemeral from '../../../../../../../stores/tankopediaEphemeral';
|
import * as TankopediaEphemeral from '../../../../../../../stores/tankopediaEphemeral';
|
||||||
@@ -60,8 +61,7 @@ export function Options() {
|
|||||||
(state) => state.model.visual.showSpacedArmor,
|
(state) => state.model.visual.showSpacedArmor,
|
||||||
);
|
);
|
||||||
const opaque = TankopediaPersistent.use((state) => state.model.visual.opaque);
|
const opaque = TankopediaPersistent.use((state) => state.model.visual.opaque);
|
||||||
const fullScreenAvailable =
|
const fullScreenAvailable = useFullscreenAvailability();
|
||||||
typeof document !== 'undefined' && document.fullscreenEnabled;
|
|
||||||
const environment = TankopediaPersistent.use(
|
const environment = TankopediaPersistent.use(
|
||||||
(state) => state.model.visual.environment,
|
(state) => state.model.visual.environment,
|
||||||
);
|
);
|
||||||
@@ -533,7 +533,6 @@ export function Options() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* TODO: consider removing this? */}
|
|
||||||
View environment
|
View environment
|
||||||
</DropdownMenu.CheckboxItem>
|
</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