feat: settings basework

This commit is contained in:
TrèsAbhi committed 2024-01-06 17:59:31 -06:00
1 parent 6753a72d97
commit 857cba902a
2 files changed
+34 -15

No files matched your search

+32 -15
View File
@@ -5,6 +5,7 @@ import {
CaretRightIcon,
EnterFullScreenIcon,
ExitFullScreenIcon,
GearIcon,
MagnifyingGlassIcon,
} from '@radix-ui/react-icons';
import {
@@ -38,6 +39,7 @@ import {
tankNamesDiacritics,
} from '../../../../core/blitzkrieg/tankDefinitions';
import { theme } from '../../../../stitches.config';
import mutateTankopedia from '../../../../stores/tankopedia';
import { Loader } from '../../components/Loader';
import { Controls } from './components/Control';
import { RotationInputs } from './components/RotationInputs';
@@ -169,27 +171,42 @@ export default function Page({ params }: { params: { id: string } }) {
</Canvas>
</div>
<Button
variant="ghost"
<Flex
gap="4"
style={{
position: 'absolute',
top: 18,
right: 18,
}}
onClick={() => {
if (isFullScreen) {
document.exitFullscreen();
} else {
canvasWrapper.current?.requestFullscreen();
}
}}
>
{isFullScreen ? (
<ExitFullScreenIcon />
) : (
<EnterFullScreenIcon />
)}
</Button>
<Button
variant="ghost"
onClick={() => {
mutateTankopedia((draft) => {
draft.showSettings = true;
});
}}
>
<GearIcon />
</Button>
<Button
variant="ghost"
onClick={() => {
if (isFullScreen) {
document.exitFullscreen();
} else {
canvasWrapper.current?.requestFullscreen();
}
}}
>
{isFullScreen ? (
<ExitFullScreenIcon />
) : (
<EnterFullScreenIcon />
)}
</Button>
</Flex>
<RotationInputs
gunId={gun.id}
+2
View File
@@ -25,6 +25,7 @@ type Tankopedia = {
gunPitch: number;
controlsEnabled: boolean;
};
showSettings: boolean;
};
export const useTankopedia = create<Tankopedia>()(() => ({
@@ -45,6 +46,7 @@ export const useTankopedia = create<Tankopedia>()(() => ({
turretYaw: 0,
controlsEnabled: true,
},
showSettings: false,
}));
export default function mutateTankopedia(recipe: (draft: Tankopedia) => void) {