From 3e2c3bf9f379ff718358b01b0389e965fc8318bd Mon Sep 17 00:00:00 2001 From: aodulov Date: Mon, 13 Oct 2025 15:21:32 +0300 Subject: [PATCH] 1. Headings lined up. 2. Color scheme for results. --- .gitignore | 3 +- backend/src/ws/index.ts | 3 +- frontend/src/components/ResultsDisplay.tsx | 16 +++++------ frontend/src/hooks/useSession.ts | 1 + frontend/src/pages/SessionPage.tsx | 33 +++++++++++----------- 5 files changed, 29 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 95ef1f7..7d57d90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /frontend/node_modules /backend/node_modules -/.context \ No newline at end of file +/.context +.env \ No newline at end of file diff --git a/backend/src/ws/index.ts b/backend/src/ws/index.ts index 2139677..601db52 100644 --- a/backend/src/ws/index.ts +++ b/backend/src/ws/index.ts @@ -143,7 +143,7 @@ export const createWebSocketServer = (server: any) => { if (!sessionData.clients.has(clientId)) { sessionData.clients.set(clientId, ws); console.log(`Client ${clientId} registered for session: ${sessionId}. Total clients: ${sessionData.clients.size}`); - ws.send(JSON.stringify({ type: 'STATE_UPDATE', payload: { session: getSerializableSession(sessionData) } })); + ws.send(JSON.stringify({ type: 'STATE_UPDATE', payload: { session: getSerializableSession(sessionData, clientId) } })); } console.log(`Received message from ${clientId} in session ${sessionId}:`, type); @@ -202,6 +202,7 @@ export const handleWebSocketMessage = async (ws: WebSocket, sessionId: string, p switch (type) { case 'REGISTER_CLIENT': + console.log(`Client ${clientId} registered successfully for session ${sessionId}.`); break; case 'SETUP_SESSION': diff --git a/frontend/src/components/ResultsDisplay.tsx b/frontend/src/components/ResultsDisplay.tsx index 5f034e3..cd4c90c 100644 --- a/frontend/src/components/ResultsDisplay.tsx +++ b/frontend/src/components/ResultsDisplay.tsx @@ -8,8 +8,8 @@ interface ResultsDisplayProps { decision: Decision; } -const CategorySection: React.FC<{ title: string; desire: string; defaultExpanded?: boolean }> - = ({ title, desire, defaultExpanded = true }) => { +const CategorySection: React.FC<{ title: string; desire: string; defaultExpanded?: boolean; borderColor?: string }> + = ({ title, desire, defaultExpanded = true, borderColor = '#e0e0e0' }) => { const [expanded, setExpanded] = React.useState(defaultExpanded); if (!desire) { @@ -17,7 +17,7 @@ const CategorySection: React.FC<{ title: string; desire: string; defaultExpanded } return ( - + {title} @@ -46,11 +46,11 @@ const ResultsDisplay: React.FC = ({ decision }) => { Cooperative Decision - - - - - + {/* Pale Green */} + {/* Pale Blue */} + {/* Grey (default) */} + {/* Pale Yellow */} + {/* Pale Red */} ); }; diff --git a/frontend/src/hooks/useSession.ts b/frontend/src/hooks/useSession.ts index 8475ae6..a62b067 100644 --- a/frontend/src/hooks/useSession.ts +++ b/frontend/src/hooks/useSession.ts @@ -80,6 +80,7 @@ export const useSession = (sessionId: string): [Session | null, Dispatch { console.log('useSession: Processing incoming message:', message); if (message.type === 'STATE_UPDATE') { + console.log('useSession: Received STATE_UPDATE, session payload:', message.payload.session); setSession(message.payload.session); setError(null); // Clear error on successful state update } else if (message.type === 'ERROR') { diff --git a/frontend/src/pages/SessionPage.tsx b/frontend/src/pages/SessionPage.tsx index 2fc6d74..ef8b901 100644 --- a/frontend/src/pages/SessionPage.tsx +++ b/frontend/src/pages/SessionPage.tsx @@ -54,21 +54,11 @@ const SessionPage = () => { return ( - {wsError && {wsError}} - - - {session.topic || session.sessionId} - - {session.description && ( - - {session.description} - - )} {session.state === SessionState.SETUP && ( - - - Set Up Desires Harmonization + + + Harmonize Desires { )} - {/* Session status is hidden as per FR-008 */} {session.state !== SessionState.SETUP && ( - - Expected Responses: {session.expectedResponses} - + + + {session.topic || session.sessionId} + + {session.description && ( + + Details: {session.description} + + )} + + Expected Responses: {session.expectedResponses} + + )} {session.state === SessionState.GATHERING && !hasSubmittedCurrentParticipant && (