Skip to content
Open
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
11 changes: 7 additions & 4 deletions frontend/src/Pages/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Game: React.FC = () => {
gameResult: {
isReady: false,
isWinner: false,
points: false,
points: 0,
totalPoints: 0,
evaluationMessage: "no data",
},
Expand All @@ -32,17 +32,20 @@ const Game: React.FC = () => {
});

const websocketRef = useRef<WebSocket | null>(null);
const lastTypingStateRef = useRef<boolean>(false);
const lastSpeakingStateRef = useRef<boolean>(false);
const _lastTypingStateRef = useRef<boolean>(false);
const _lastSpeakingStateRef = useRef<boolean>(false);
void _lastTypingStateRef; // Reserved for typing indicator feature
void _lastSpeakingStateRef; // Reserved for speaking indicator feature
Comment on lines +35 to +38
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These refs are renamed and then intentionally unused (only referenced via void). This leaves dead code paths in a core page and makes it harder to understand what is actually used. Prefer removing them until the typing/speaking indicator feature is implemented, or wire them into the existing TYPING_* / SPEAKING_* handlers if that feature already exists in this component.

Copilot uses AI. Check for mistakes.

const sendWebSocketMessage = useCallback((payload: Record<string, unknown>) => {
const _sendWebSocketMessage = useCallback((payload: Record<string, unknown>) => {
const ws = websocketRef.current;
if (ws?.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(payload));
} else {
console.warn("Attempted to send message while WebSocket was not open.", payload);
}
}, []);
void _sendWebSocketMessage; // Reserved for future WebSocket messaging
Comment on lines +40 to +48
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_sendWebSocketMessage is defined but unused (then void’d). If this helper isn’t currently needed, remove it to reduce noise; otherwise, use it in the message-sending call sites so it provides value and stays covered by compiler/lint checks.

Copilot uses AI. Check for mistakes.

type GameWebSocketMessage = {
type: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Pages/OnlineDebateRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const BASE_URL = import.meta.env.VITE_BASE_URL || window.location.origin;

const WS_BASE_URL = BASE_URL.replace(
/^https?/,
(match) => (match === "https" ? "wss" : "ws")
(match: string) => (match === "https" ? "wss" : "ws")
);


Expand Down
5 changes: 3 additions & 2 deletions frontend/src/Pages/TeamDebateRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ const TeamDebateRoom: React.FC = () => {
}, [timer, debatePhase, isMyTurn, speechTranscripts, localRole, debateId]);

useEffect(() => {
currentUserIdRef.current = currentUser?.id;
currentUserIdRef.current = currentUser?.id ?? null;
myTeamIdRef.current = myTeamId;
isTeam1Ref.current = isTeam1;
debatePhaseRef.current = debatePhase;
Expand Down Expand Up @@ -738,7 +738,8 @@ const TeamDebateRoom: React.FC = () => {
const amTeam1 = isTeam1Ref.current;
const currentMyTeamId = myTeamIdRef.current;
const currentUserId = currentUserIdRef.current;
const currentPhase = debatePhaseRef.current;
const _currentPhase = debatePhaseRef.current;
void _currentPhase; // Available for phase-aware message handling
Comment on lines +741 to +742
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_currentPhase is introduced but unused (only referenced via void). If phase-aware handling isn’t implemented yet, it’s clearer to remove the unused variable until it’s needed, rather than keeping placeholder code in the message handler.

Suggested change
const _currentPhase = debatePhaseRef.current;
void _currentPhase; // Available for phase-aware message handling

Copilot uses AI. Check for mistakes.

switch (data.type) {
case "stateSync": {
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/CommentTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useUser } from '../hooks/useUser';
import ProfileHover from './ProfileHover';
import UserProfileModal from './UserProfileModal';
import {
commentsByTranscriptAtom,
getCommentsForTranscriptAtom,
setCommentsForTranscriptAtom,
addCommentToTranscriptAtom,
Expand Down Expand Up @@ -229,8 +228,9 @@ const CommentTree: React.FC<CommentTreeProps> = ({
const { user } = useUser();
const [commentsAtom] = useAtom(getCommentsForTranscriptAtom(transcriptId));
const [, setCommentsAtom] = useAtom(setCommentsForTranscriptAtom(transcriptId));
const [, addCommentAtom] = useAtom(addCommentToTranscriptAtom(transcriptId));
const [, _addCommentAtom] = useAtom(addCommentToTranscriptAtom(transcriptId));
const [, removeCommentAtom] = useAtom(removeCommentFromTranscriptAtom(transcriptId));
void _addCommentAtom; // Reserved for future use
Comment on lines 229 to +233
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_addCommentAtom is initialized via useAtom(...) but intentionally unused (only referenced via void). This adds dead code and an extra atom subscription; if the add-comment atom isn’t needed here, remove the useAtom(addCommentToTranscriptAtom(...)) call (and any related import) until it’s actually used.

Copilot uses AI. Check for mistakes.

const [comments, setComments] = useState<Comment[]>([]);
const [loading, setLoading] = useState(true);
Expand Down Expand Up @@ -392,7 +392,8 @@ const CommentTree: React.FC<CommentTreeProps> = ({
}

const result = await response.json();
const newComment: Comment = result.comment;
const _newComment: Comment = result.comment;
void _newComment; // Result used via fetchComments refresh
Comment on lines 394 to +396
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_newComment is assigned from the POST response but never used (only void’d). If the comment isn’t needed because you refresh via fetchComments(), drop the unused assignment and just await the refresh; otherwise, use the returned comment to update state/atoms directly to avoid an extra network round-trip.

Copilot uses AI. Check for mistakes.

// Fetch updated comments (including the new one) and update atom
await fetchComments();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useContext, useEffect } from "react";
import { NavLink, useLocation, useNavigate } from "react-router-dom";
import { Bell, Menu, X, Home, BarChart, User, Info, LogOut, Check } from "lucide-react";
import { Bell, Menu, X, Home, BarChart, User, Info, LogOut } from "lucide-react";
import { useAtom } from "jotai";
import { userAtom } from "@/state/userAtom";
import { AuthContext } from "@/context/authContext";
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/JudgementPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const JudgmentPopup: React.FC<JudgmentPopupProps> = ({
botName,
userStance,
botStance,
botDesc,
forRole,
againstRole,
localRole = null,
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/SpeechTranscripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import React from 'react';
interface SpeechTranscriptsProps {
transcripts: { [key: string]: string };
currentPhase: string;
liveTranscript?: string;
}

const SpeechTranscripts: React.FC<SpeechTranscriptsProps> = ({
transcripts,
currentPhase,
liveTranscript,
}) => {
const phases = [
'openingFor',
Expand Down Expand Up @@ -77,6 +79,11 @@ const SpeechTranscripts: React.FC<SpeechTranscriptsProps> = ({
<div className='text-sm text-gray-800 bg-white p-2 rounded border'>
{transcript}
</div>
) : isCurrentPhase && liveTranscript ? (
<div className='text-sm text-gray-800 bg-white p-2 rounded border animate-pulse'>
{liveTranscript}
<span className='text-orange-500 ml-1'>▋</span>
</div>
) : (
<div className='text-sm text-gray-500 italic'>
No transcript available yet
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/services/teamDebateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const getMatchmakingPool = async (): Promise<TeamMatchmakingPoolResponse>
throw new Error("Failed to get matchmaking pool");
}

const data: MatchmakingPoolResponse = await response.json();
const data: TeamMatchmakingPoolResponse = await response.json();
return data;
};

Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "debateai-monorepo",
"version": "1.0.0",
"private": true,
"description": "DebateAI Monorepo - Run frontend and backend together",
"scripts": {
"dev": "concurrently -n \"FE,BE\" -c \"cyan,yellow\" \"npm run dev:frontend\" \"npm run dev:backend\"",
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev script starts two long-running processes, but it doesn’t configure concurrently to stop the other process when one exits/fails. This can mask backend crashes while the frontend keeps running (or vice versa). Consider enabling concurrently’s kill-others-on-fail behavior so the overall npm run dev clearly fails when either service fails.

Suggested change
"dev": "concurrently -n \"FE,BE\" -c \"cyan,yellow\" \"npm run dev:frontend\" \"npm run dev:backend\"",
"dev": "concurrently --kill-others-on-fail -n \"FE,BE\" -c \"cyan,yellow\" \"npm run dev:frontend\" \"npm run dev:backend\"",

Copilot uses AI. Check for mistakes.
"dev:frontend": "cd frontend && npm run dev",
"dev:backend": "cd backend && go run ./cmd/server/",
"build": "concurrently \"npm run build:frontend\" \"npm run build:backend\"",
"build:frontend": "cd frontend && npm run build",
"build:backend": "cd backend && go build ./cmd/server/",
"install:frontend": "cd frontend && npm install",
"install:all": "npm install && npm run install:frontend"
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm install at the repo root will only install root devDependencies (e.g., concurrently) and will not install frontend/ dependencies. As written, the PR description’s “npm install && npm run dev” flow will fail unless users manually run npm install in frontend/ first. Consider adding a root postinstall (or using npm workspaces / npm --prefix frontend install) so a single root install is sufficient, or adjust scripts so dev ensures frontend deps are installed.

Suggested change
"install:all": "npm install && npm run install:frontend"
"install:all": "npm install && npm run install:frontend",
"postinstall": "npm --prefix frontend install"

Copilot uses AI. Check for mistakes.
},
Comment on lines +6 to +15
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

npm install alone won't bootstrap frontend — contributors hitting a broken npm run dev on fresh clone.

The PR states the usage is npm install; npm run dev, but npm install only installs root devDependencies (concurrently). Frontend dependencies in frontend/package.json are never installed, so dev:frontend will fail on a fresh clone.

Consider adding a postinstall hook to automate this, or at minimum update the documented workflow to use install:all:

Proposed fix
   "scripts": {
     "dev": "concurrently -n \"FE,BE\" -c \"cyan,yellow\" \"npm run dev:frontend\" \"npm run dev:backend\"",
     "dev:frontend": "cd frontend && npm run dev",
     "dev:backend": "cd backend && go run ./cmd/server/",
     "build": "concurrently \"npm run build:frontend\" \"npm run build:backend\"",
     "build:frontend": "cd frontend && npm run build",
     "build:backend": "cd backend && go build ./cmd/server/",
     "install:frontend": "cd frontend && npm install",
-    "install:all": "npm install && npm run install:frontend"
+    "install:all": "npm install && npm run install:frontend",
+    "postinstall": "npm run install:frontend"
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"scripts": {
"dev": "concurrently -n \"FE,BE\" -c \"cyan,yellow\" \"npm run dev:frontend\" \"npm run dev:backend\"",
"dev:frontend": "cd frontend && npm run dev",
"dev:backend": "cd backend && go run ./cmd/server/",
"build": "concurrently \"npm run build:frontend\" \"npm run build:backend\"",
"build:frontend": "cd frontend && npm run build",
"build:backend": "cd backend && go build ./cmd/server/",
"install:frontend": "cd frontend && npm install",
"install:all": "npm install && npm run install:frontend"
},
"scripts": {
"dev": "concurrently -n \"FE,BE\" -c \"cyan,yellow\" \"npm run dev:frontend\" \"npm run dev:backend\"",
"dev:frontend": "cd frontend && npm run dev",
"dev:backend": "cd backend && go run ./cmd/server/",
"build": "concurrently \"npm run build:frontend\" \"npm run build:backend\"",
"build:frontend": "cd frontend && npm run build",
"build:backend": "cd backend && go build ./cmd/server/",
"install:frontend": "cd frontend && npm install",
"install:all": "npm install && npm run install:frontend",
"postinstall": "npm run install:frontend"
},
🤖 Prompt for AI Agents
In `@package.json` around lines 6 - 15, The root package.json’s current scripts
leave frontend deps uninstalled causing npm run dev (which invokes dev:frontend)
to fail on a fresh clone; update package.json to automatically install frontend
deps after root install by adding a postinstall script that runs the existing
"install:all" (or directly "npm run install:frontend"), so that "npm install"
will bootstrap both root and frontend, and ensure the change references the
existing script names "install:all", "install:frontend", "dev", and
"dev:frontend".

"devDependencies": {
"concurrently": "^8.2.2"
},
"engines": {
"node": ">=18.0.0"
}
}
Loading