From 2b3be6569f5e82b2779a3975f7295308657e92d6 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sun, 25 Jan 2026 08:54:04 -0700 Subject: [PATCH] Fix host --- components/HostReconnected.tsx | 83 +++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 21 deletions(-) diff --git a/components/HostReconnected.tsx b/components/HostReconnected.tsx index 4783fef..2396f1c 100644 --- a/components/HostReconnected.tsx +++ b/components/HostReconnected.tsx @@ -1,57 +1,98 @@ import React from 'react'; -import { motion } from 'framer-motion'; -import { Play, Users, X } from 'lucide-react'; +import { motion, AnimatePresence } from 'framer-motion'; +import { Play, Users, X, Wifi, WifiOff } from 'lucide-react'; +import { Player } from '../types'; +import { PlayerAvatar } from './PlayerAvatar'; interface HostReconnectedProps { quizTitle: string; currentQuestionIndex: number; totalQuestions: number; - playerCount: number; + players: Player[]; onResume: () => void; onEndGame: () => void; + connectedPlayerIds: string[]; } export const HostReconnected: React.FC = ({ quizTitle, currentQuestionIndex, totalQuestions, - playerCount, + players, onResume, onEndGame, + connectedPlayerIds, }) => { + const realPlayers = players.filter(p => p.id !== 'host'); + const connectedCount = connectedPlayerIds.length; + const totalCount = realPlayers.length; + return (
- + -

Game Restored

-

{quizTitle}

+

Game Restored

+

{quizTitle}

-
-
-

Question

-

{currentQuestionIndex + 1} / {totalQuestions}

+
+
+

Question

+

{currentQuestionIndex + 1} / {totalQuestions}

-
-

Players

-

- - {playerCount} +

+

Connected

+

+ + {connectedCount} / {totalCount}

-

+ {/* Player list showing connection status */} + {realPlayers.length > 0 && ( +

+
+ + {realPlayers.map((player) => { + const isConnected = connectedPlayerIds.includes(player.id); + return ( + + {isConnected ? ( + + ) : ( + + )} + + {player.name} + + ); + })} + +
+
+ )} + +

Players will rejoin automatically when they reconnect

@@ -60,7 +101,7 @@ export const HostReconnected: React.FC = ({ whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} onClick={onResume} - className="w-full bg-white text-theme-primary px-8 py-4 rounded-full text-xl font-black shadow-[0_6px_0_rgba(0,0,0,0.2)] hover:shadow-[0_4px_0_rgba(0,0,0,0.2)] hover:translate-y-[2px] active:shadow-none active:translate-y-[6px] transition-all flex items-center justify-center gap-3" + className="w-full bg-white text-theme-primary px-6 md:px-8 py-3 md:py-4 rounded-full text-lg md:text-xl font-black shadow-[0_6px_0_rgba(0,0,0,0.2)] hover:shadow-[0_4px_0_rgba(0,0,0,0.2)] hover:translate-y-[2px] active:shadow-none active:translate-y-[6px] transition-all flex items-center justify-center gap-3" > Resume Game @@ -70,7 +111,7 @@ export const HostReconnected: React.FC = ({ whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} onClick={onEndGame} - className="w-full bg-white/20 text-white px-8 py-4 rounded-full text-lg font-bold hover:bg-white/30 transition-all flex items-center justify-center gap-2" + className="w-full bg-white/20 text-white px-6 md:px-8 py-3 md:py-4 rounded-full text-base md:text-lg font-bold hover:bg-white/30 transition-all flex items-center justify-center gap-2" > End Game