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
+21 -2

No files matched your search

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