feat: Add exit functionality and confirmation modal to DraftView, and include draft state in join room callback.

This commit is contained in:
2025-12-16 21:30:51 +01:00
parent ca76405986
commit b9c5905474
6 changed files with 262 additions and 95 deletions

View File

@@ -88,13 +88,14 @@ io.on('connection', (socket) => {
console.log(`Player ${playerName} joined room ${roomId}`);
io.to(room.id).emit('room_update', room); // Broadcast update
// If drafting, send state immediately
// If drafting, send state immediately and include in callback
let currentDraft = null;
if (room.status === 'drafting') {
const draft = draftManager.getDraft(roomId);
if (draft) socket.emit('draft_update', draft);
currentDraft = draftManager.getDraft(roomId);
if (currentDraft) socket.emit('draft_update', currentDraft);
}
callback({ success: true, room });
callback({ success: true, room, draftState: currentDraft });
} else {
callback({ success: false, message: 'Room not found or full' });
}