From c98e262fd00b8c3eb808263011629495d6ac14ba Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Fri, 16 Jan 2026 10:24:47 -0700 Subject: [PATCH] Fix lobby jank --- components/Lobby.tsx | 142 +++++++++++++++++++++++--------- tests/components/Lobby.test.tsx | 11 ++- 2 files changed, 108 insertions(+), 45 deletions(-) diff --git a/components/Lobby.tsx b/components/Lobby.tsx index c88f63d..a15914d 100644 --- a/components/Lobby.tsx +++ b/components/Lobby.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { Player } from '../types'; import { motion, AnimatePresence } from 'framer-motion'; -import { Sparkles, User, X, Link, Check } from 'lucide-react'; +import { Sparkles, User, X, Link, Check, QrCode } from 'lucide-react'; import { QRCodeSVG } from 'qrcode.react'; import { PlayerAvatar } from './PlayerAvatar'; import toast from 'react-hot-toast'; @@ -44,51 +44,111 @@ export const Lobby: React.FC = ({ quizTitle, players, gamePin, role, return (
-
-
- {isHost && gamePin && ( -
+
+
+
+

{quizTitle}

+
+
+ Live +
+
+ +
+
+ Game PIN +
+ {gamePin} +
+
+ +
+ Players +
+ + {realPlayers.length} +
+
+ + {isHost && ( +
+
- )} -
- Game PIN -
-
- {gamePin} + className="flex-1 bg-white/20 hover:bg-white/30 border-2 border-white/10 rounded-xl flex items-center justify-center gap-2 transition-all active:scale-95 py-2" + > + + QR Code + + +
+ )} +
+
+ +
+
+ {isHost && gamePin && ( + + )} + +
+ Join at kaboot.com +
+
+ {gamePin} +
+ {isHost && ( + + )}
- {isHost && ( - - )}
-
- -
-
{quizTitle}
-
-
- Live Lobby + +
+

+ {quizTitle} +

+
+
+ Live Lobby +
+
+ +
+
+ {realPlayers.length} + Players +
-
- -
- {realPlayers.length} - Players
diff --git a/tests/components/Lobby.test.tsx b/tests/components/Lobby.test.tsx index be7b49c..0ac7efd 100644 --- a/tests/components/Lobby.test.tsx +++ b/tests/components/Lobby.test.tsx @@ -99,13 +99,15 @@ describe('Lobby', () => { it('displays game PIN', () => { render(); - expect(screen.getByText('ABC123')).toBeInTheDocument(); + const pins = screen.getAllByText('ABC123'); + expect(pins.length).toBeGreaterThan(0); }); - it('displays quiz title on larger screens', () => { + it('displays quiz title on all screen sizes', () => { render(); - expect(screen.getByText('Test Quiz')).toBeInTheDocument(); + const titles = screen.getAllByText('Test Quiz'); + expect(titles.length).toBeGreaterThan(0); }); it('displays player count', () => { @@ -115,7 +117,8 @@ describe('Lobby', () => { ]; render(); - expect(screen.getByText('2')).toBeInTheDocument(); + const counts = screen.getAllByText('2'); + expect(counts.length).toBeGreaterThan(0); }); it('shows waiting message when no players have joined', () => {