Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions frontend/src/Components/Deck.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState,useRef } from "react";
import { useSelector, useDispatch } from "react-redux";
import { clickCard, setPendingReveal, revealLocal, resetAll, updateCardClickedBy } from "../store/slices/cardsSlice";
import { showOverlay, hideOverlay, showClueDisplay, hideClueDisplay, toggleConfirmTarget, removeConfirmTarget, clearConfirmTargets } from "../store/slices/uiSlice";
import { showOverlay, hideOverlay, showClueDisplay, hideClueDisplay, toggleConfirmTarget, clearConfirmTargets } from "../store/slices/uiSlice";
import { updatePlayers } from "../store/slices/playersSlice";
import { setCurrentTurn } from "../store/slices/gameSlice";
import socket from "../socket";
Expand All @@ -23,7 +23,6 @@
const { gameId } = useParams();
const cards = useSelector((state) => state.cards?.cards ?? []);
const overlayActive = useSelector((state) => state.ui?.overlayActive ?? false);
const clueDisplayActive = useSelector((state) => state.ui?.clueDisplayActive ?? false);
const lastClue = useSelector((state) => state.ui?.lastClue ?? null);
const confirmTargetIds = useSelector((state) => state.ui?.confirmTargetIds ?? []);
const currentTurn = useSelector((state) => state.game?.currentTurn ?? "red");
Expand Down Expand Up @@ -57,7 +56,6 @@
// clear the stored role and mark that we need to tell the server
// this player should now be a spectator (so the players list updates).
const prevTitle = localStorage.getItem('joinedTitle');
const prevTeam = localStorage.getItem('joinedTeam');
if (prevTitle === 'Concealers') {
console.log("🧹 Detected stale 'Concealers' on refresh — will update server to spectator after join");
needsSpectatorUpdate.current = true;
Expand Down Expand Up @@ -150,7 +148,7 @@
}

fetchScores();
}, []);

Check warning on line 151 in frontend/src/Components/Deck.jsx

View workflow job for this annotation

GitHub Actions / build-frontend

React Hook useEffect has missing dependencies: 'dispatch' and 'gameId'. Either include them or remove the dependency array

const handleClueSubmit = (clueData) => {
dispatch(showOverlay(clueData));
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Components/PlayerList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useContext } from "react";

const PlayerList = ({ team, title, players, colorClasses }) => {
const { teamInfo, titleInfo, handleJoin } = useContext(JoinContext);
const [joinedTeam, setJoinedTeam] = teamInfo;
const [joinedTitle, setJoinedTitle] = titleInfo;
const [joinedTeam] = teamInfo;
const [joinedTitle] = titleInfo;

// Whether the user already belongs to this exact team+title
const isAlreadyJoined = joinedTeam === team && joinedTitle === title;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/TeamPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PlayerList from "./PlayerList";

const TeamPanel = ({ team, score, concealers, revealers, joinFunction }) => {
const TeamPanel = ({ team, score, concealers, revealers }) => {
const colorClasses = team === 'red'
? {
bg: 'bg-red-500 dark:bg-red-700',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/slices/cardsSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const clickCard = createAsyncThunk(
async ({ id, word, team, gameId }, { rejectWithValue }) => {
try {
// send the exact payload your server expects
const res = await axios.post(`${API_URL}/api/click`, { gameId, word });
await axios.post(`${API_URL}/api/click`, { gameId, word });

// optionally use server response (res.data) if you want to sync board/scores
socket.emit('sendMessage', { message: `${word} clicked`, team });
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/store/slices/clueInput.js
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
import { createSlice } from "@reduxjs/toolkit";
import socket from "../../socket";
1 change: 0 additions & 1 deletion frontend/src/store/slices/scoreSlice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createSlice } from "@reduxjs/toolkit";
import axios from "axios";

const scoreSlice = createSlice({
name: "scores",
Expand Down
Loading