diff --git a/src/Display.tsx b/src/Display.tsx index d0e7765..09fd5aa 100644 --- a/src/Display.tsx +++ b/src/Display.tsx @@ -3,10 +3,14 @@ import { Stack, Container } from "react-bootstrap"; import { isEmpty } from "lodash"; import { socket } from "./socket"; -import { useAppSelector } from "./hooks"; +import { useAppSelector, useAppDispatch } from "./hooks"; import { selectRoomCode } from "./store/commonSlice"; import { selectContestants } from "./store/displaySlice"; -import { selectCategories, selectActiveClue } from "./store/cluesSlice"; +import { + selectCategories, + selectActiveClue, + clearActiveClue, +} from "./store/cluesSlice"; import ContestantWidget from "./ContestantWidget"; import Gameboard from "./display/Gameboard"; import ClueDisplay from "./display/ClueDisplay"; @@ -16,9 +20,13 @@ const Display = () => { const contestants = useAppSelector(selectContestants); const categories = useAppSelector(selectCategories); const activeClue = useAppSelector(selectActiveClue); + const dispatch = useAppDispatch(); useEffect(() => { + console.log(socket); socket.emit("new-game"); + socket.on("clue-clock-off", () => dispatch(clearActiveClue())); + socket.on("contestant-scores", () => dispatch(clearActiveClue())); }, []); return ( diff --git a/src/display/ClueDisplay.tsx b/src/display/ClueDisplay.tsx index 95654b3..1d810c2 100644 --- a/src/display/ClueDisplay.tsx +++ b/src/display/ClueDisplay.tsx @@ -22,7 +22,7 @@ const ClueDisplay = ({ activeClue }: Props) => { }, []); return ( <> -