From c8d2357fb86152ac47b3700fb14dc4f057867bfb Mon Sep 17 00:00:00 2001 From: Gift-Naomi Date: Thu, 5 Sep 2024 22:45:39 +0100 Subject: [PATCH] implement new game mode option for Tutoria --- client/src/dojo/game/types/mode.ts | 1 + client/src/ui/actions/Start.tsx | 15 ++++++-- client/src/ui/screens/Home.tsx | 58 +++++++++++++++++------------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/client/src/dojo/game/types/mode.ts b/client/src/dojo/game/types/mode.ts index acf16466..7c90f9fd 100644 --- a/client/src/dojo/game/types/mode.ts +++ b/client/src/dojo/game/types/mode.ts @@ -2,6 +2,7 @@ export enum ModeType { None = "None", Normal = "Normal", Daily = "Daily", + Tutorial = "Totorial", } export class Mode { diff --git a/client/src/ui/actions/Start.tsx b/client/src/ui/actions/Start.tsx index 1fb5d914..ac081495 100644 --- a/client/src/ui/actions/Start.tsx +++ b/client/src/ui/actions/Start.tsx @@ -62,7 +62,7 @@ export const Start: React.FC = ({ sqrt_ratio_hint: proof_verify_hint, beta: beta, }); - handleGameMode() + handleGameMode(); } finally { setIsLoading(false); } @@ -87,7 +87,18 @@ export const Start: React.FC = ({ return (

- {mode === ModeType.Daily ? "Daily Mode" : "Normal Mode"} + {(() => { + switch (mode) { + case ModeType.Daily: + return <>Daily Mode; + case ModeType.Normal: + return <>Normal Mode; + case ModeType.Tutorial: + return <>Tutorial Mode; + default: + return <>Normal Mode; + } + })()}

Potential Winnings: {potentialWinnings} diff --git a/client/src/ui/screens/Home.tsx b/client/src/ui/screens/Home.tsx index 94ec3c3a..f5284c18 100644 --- a/client/src/ui/screens/Home.tsx +++ b/client/src/ui/screens/Home.tsx @@ -15,11 +15,7 @@ import NextLine from "../components/NextLine"; import { Surrender } from "../actions/Surrender"; import { Content as Leaderboard } from "../modules/Leaderboard"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faFire, - faGlobe, - faStar, -} from "@fortawesome/free-solid-svg-icons"; +import { faFire, faGlobe, faStar } from "@fortawesome/free-solid-svg-icons"; import GoogleFormEmbed from "../components/GoogleFormEmbed"; import { useQuerySync } from "@dojoengine/react"; import { ModeType } from "@/dojo/game/types/mode"; @@ -54,7 +50,7 @@ export const Home = () => { const [isPreviewOpen, setIsPreviewOpen] = useState(false); const [level, setLevel] = useState(0); const [score, setScore] = useState(0); - const [imgData, setImgData] = useState(''); + const [imgData, setImgData] = useState(""); useEffect(() => { if (game?.over) { @@ -224,20 +220,28 @@ export const Home = () => {

- {(!game || (!!game && isGameOn === "isOver" ))&& (
- setIsGameOn("isOn")} - potentialWinnings="100 STRK" - remainingTime="02:15:00" + {(!game || (!!game && isGameOn === "isOver")) && ( +
+ setIsGameOn("isOn")} + potentialWinnings="100 STRK" + remainingTime="02:15:00" /> - setIsGameOn("isOn")} - potentialWinnings="50 STRK" - remainingTime="02:15:00" - /> -
)} + setIsGameOn("isOn")} + potentialWinnings="100 STRK" + remainingTime="02:15:00" + /> + setIsGameOn("isOn")} + potentialWinnings="0 STRK" + remainingTime="02:15:00" + /> +
+ )} {!game && (
@@ -265,9 +269,9 @@ export const Home = () => {
{game.max_combo} + icon={faGlobe} + className="text-slate-700 ml-2" + />
@@ -309,9 +313,15 @@ export const Home = () => { )}
- + - {!animationDone && ( + {!animationDone && ( <> <>