From 0b251c566c7318d24c7528c57ddebf4054f960ff Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Sun, 29 Sep 2024 14:43:10 +0200 Subject: [PATCH] updated zenmode --- src/components/Board.tsx | 33 ++++++++++++++++++++------------- src/views/endless/Endless.tsx | 5 ++++- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/components/Board.tsx b/src/components/Board.tsx index 80c1431..d0745e5 100644 --- a/src/components/Board.tsx +++ b/src/components/Board.tsx @@ -23,7 +23,7 @@ import { cursorXAtom, cursorYAtom } from "../atoms"; import Coords from "./Coords"; import { cn } from "../lib/utils"; import { Button } from "./Button"; -import { Maximize2, Minimize2 } from "lucide-react"; +import { Maximize2, Minimize2, RotateCcw } from "lucide-react"; import useSound from "use-sound"; import explosion from "../sound/explosion.mp3"; @@ -32,6 +32,7 @@ interface BoardProps { game: ServerGame | ClientGame; onLeftClick: (x: number, y: number) => void; onRightClick: (x: number, y: number) => void; + restartGame: () => void; } interface ViewportInfo { @@ -51,7 +52,7 @@ const toViewportInfo = (viewport: PixiViewport) => { }; const Board: React.FC = (props) => { - const { game } = props; + const { game, restartGame } = props; const { data: user } = useWSQuery("user.getSelf", null); const ref = useRef(null); const [width, setWidth] = useState(0); @@ -124,18 +125,24 @@ const Board: React.FC = (props) => { ref={ref} >
- )} - + +
{zenMode && (
{game.minesCount - game.isFlagged.flat().filter((f) => f).length} diff --git a/src/views/endless/Endless.tsx b/src/views/endless/Endless.tsx index 80677d8..c43a1f4 100644 --- a/src/views/endless/Endless.tsx +++ b/src/views/endless/Endless.tsx @@ -38,9 +38,12 @@ const Endless = () => {
{ + const gameId = await startGame.mutateAsync(null); + setGameId(gameId.uuid); + }} onLeftClick={(x, y) => { reveal.mutateAsync({ x, y }); }}