diff --git a/client/src/pages/Game/Game.jsx b/client/src/pages/Game/Game.jsx new file mode 100644 index 0000000..33cc5fa --- /dev/null +++ b/client/src/pages/Game/Game.jsx @@ -0,0 +1,33 @@ +import {useContext, useEffect, useState} from "react"; +import {GroupContext} from "@/common/contexts/GroupContext.jsx"; +import {Navigate} from "react-router"; +import "./styles.sass"; +import Waiting from "@/pages/Game/states/Waiting"; +import {socket} from "@/common/utils/socket.js"; +import Calculate from "@/pages/Game/states/Calculate/index.js"; + +export const Game = () => { + const {groups} = useContext(GroupContext); + + const [currentState, setCurrentState] = useState("hint"); + + useEffect(() => { + const timeout = setTimeout(() => { + setCurrentState("waiting"); + socket.emit("SUBMISSION_READY"); + }, 5000); + + return () => clearTimeout(timeout); + }, []); + + if (groups.length === 0) return ; + + return ( +
+ {currentState === "hint" &&

Ziel: Erhalte durch den Verkauf von Kuchen + so viel Gewinn wie möglich.

} + {currentState === "waiting" && } + {currentState === "calculate" && } +
+ ) +} \ No newline at end of file