@air-jam/sdk 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XSXI3RIS.js → chunk-B5DURUWT.js} +11 -3
- package/dist/chunk-B5DURUWT.js.map +1 -0
- package/dist/index.cjs +2346 -1931
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -41
- package/dist/index.d.ts +97 -41
- package/dist/index.js +2401 -2001
- package/dist/index.js.map +1 -1
- package/dist/protocol.cjs +10 -0
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +42 -1
- package/dist/protocol.d.ts +42 -1
- package/dist/protocol.js +1 -1
- package/package.json +5 -1
- package/src/AirJamClient.ts +1 -552
- package/src/audio/audio-manager.ts +12 -1
- package/src/audio/volume-store.ts +47 -0
- package/src/components/air-jam-debug.tsx +77 -0
- package/src/components/air-jam-overlay.tsx +243 -186
- package/src/components/controller-shell.tsx +174 -182
- package/src/components/debug-state-dialog.tsx +83 -0
- package/src/components/player-avatar.tsx +64 -0
- package/src/components/qr-scanner-dialog.tsx +2 -2
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/dialog.tsx +122 -0
- package/src/constants.ts +3 -2
- package/src/context/air-jam-context.tsx +3 -14
- package/src/hooks/use-air-jam-controller.ts +1 -1
- package/src/hooks/use-air-jam-host.ts +94 -49
- package/src/hooks/use-air-jam-shell.ts +36 -0
- package/src/index.ts +6 -0
- package/src/internal/input-manager.ts +28 -14
- package/src/protocol.ts +55 -0
- package/src/store/create-air-jam-store.ts +274 -0
- package/src/store/index.ts +1 -0
- package/src/utils/url-builder.ts +3 -3
- package/dist/chunk-XSXI3RIS.js.map +0 -1
|
@@ -1,33 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Check,
|
|
3
|
+
Copy,
|
|
4
|
+
ExternalLink,
|
|
5
|
+
MonitorSmartphone,
|
|
6
|
+
Pause,
|
|
7
|
+
Play,
|
|
8
|
+
QrCode,
|
|
9
|
+
Settings,
|
|
10
|
+
} from "lucide-react";
|
|
2
11
|
import QRCode from "qrcode";
|
|
3
12
|
import type { JSX } from "react";
|
|
4
13
|
import { useEffect, useMemo, useState } from "react";
|
|
5
|
-
import
|
|
14
|
+
import { useAirJamHost } from "../hooks/use-air-jam-host";
|
|
15
|
+
import type { ConnectionStatus } from "../protocol";
|
|
16
|
+
import { PlayerAvatar } from "./player-avatar";
|
|
6
17
|
import { Alert, AlertDescription } from "./ui/alert";
|
|
7
|
-
import { Avatar, AvatarImage } from "./ui/avatar";
|
|
8
18
|
import { Badge } from "./ui/badge";
|
|
9
19
|
import { Button } from "./ui/button";
|
|
10
|
-
import {
|
|
11
|
-
Card,
|
|
12
|
-
CardContent,
|
|
13
|
-
CardDescription,
|
|
14
|
-
CardHeader,
|
|
15
|
-
CardTitle,
|
|
16
|
-
} from "./ui/card";
|
|
20
|
+
import { Card, CardContent, CardDescription, CardTitle } from "./ui/card";
|
|
17
21
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs";
|
|
18
22
|
import { VolumeControls } from "./volume-controls";
|
|
19
23
|
|
|
20
|
-
interface AirJamOverlayProps {
|
|
21
|
-
roomId: string;
|
|
22
|
-
joinUrl: string;
|
|
23
|
-
connectionStatus: ConnectionStatus;
|
|
24
|
-
players: PlayerProfile[];
|
|
25
|
-
lastError?: string;
|
|
26
|
-
gameState: GameState;
|
|
27
|
-
onTogglePlayPause?: () => void;
|
|
28
|
-
isChildMode?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
24
|
const statusCopy: Record<ConnectionStatus, string> = {
|
|
32
25
|
idle: "Idle",
|
|
33
26
|
connecting: "Waiting for server…",
|
|
@@ -36,27 +29,22 @@ const statusCopy: Record<ConnectionStatus, string> = {
|
|
|
36
29
|
reconnecting: "Reconnecting…",
|
|
37
30
|
};
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
connectionStatus,
|
|
52
|
-
players,
|
|
53
|
-
lastError,
|
|
54
|
-
gameState,
|
|
55
|
-
onTogglePlayPause,
|
|
56
|
-
isChildMode = false,
|
|
57
|
-
}: AirJamOverlayProps): JSX.Element | null => {
|
|
32
|
+
export const AirJamOverlay = (): JSX.Element | null => {
|
|
33
|
+
const host = useAirJamHost();
|
|
34
|
+
const {
|
|
35
|
+
roomId,
|
|
36
|
+
joinUrl,
|
|
37
|
+
connectionStatus,
|
|
38
|
+
players,
|
|
39
|
+
lastError,
|
|
40
|
+
gameState,
|
|
41
|
+
toggleGameState,
|
|
42
|
+
isChildMode,
|
|
43
|
+
} = host;
|
|
58
44
|
const [qrUrl, setQrUrl] = useState<string | null>(null);
|
|
59
45
|
const [qrError, setQrError] = useState<string | null>(null);
|
|
46
|
+
const [copied, setCopied] = useState(false);
|
|
47
|
+
const [copiedPlayerId, setCopiedPlayerId] = useState<string | null>(null);
|
|
60
48
|
|
|
61
49
|
useEffect(() => {
|
|
62
50
|
// No need to generate QR in child mode
|
|
@@ -88,6 +76,63 @@ export const AirJamOverlay = ({
|
|
|
88
76
|
};
|
|
89
77
|
}, [joinUrl, isChildMode]);
|
|
90
78
|
|
|
79
|
+
const handleCopyUrl = async (): Promise<void> => {
|
|
80
|
+
if (!joinUrl) return;
|
|
81
|
+
try {
|
|
82
|
+
await navigator.clipboard.writeText(joinUrl);
|
|
83
|
+
setCopied(true);
|
|
84
|
+
setTimeout(() => setCopied(false), 2000);
|
|
85
|
+
} catch {
|
|
86
|
+
// Fallback for older browsers
|
|
87
|
+
const textArea = document.createElement("textarea");
|
|
88
|
+
textArea.value = joinUrl;
|
|
89
|
+
textArea.style.position = "fixed";
|
|
90
|
+
textArea.style.opacity = "0";
|
|
91
|
+
document.body.appendChild(textArea);
|
|
92
|
+
textArea.select();
|
|
93
|
+
try {
|
|
94
|
+
document.execCommand("copy");
|
|
95
|
+
setCopied(true);
|
|
96
|
+
setTimeout(() => setCopied(false), 2000);
|
|
97
|
+
} catch {
|
|
98
|
+
// Ignore
|
|
99
|
+
}
|
|
100
|
+
document.body.removeChild(textArea);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const handleOpenInNewTab = (): void => {
|
|
105
|
+
if (joinUrl) {
|
|
106
|
+
window.open(joinUrl, "_blank", "noopener,noreferrer");
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const handleCopyPlayerId = async (playerId: string): Promise<void> => {
|
|
111
|
+
try {
|
|
112
|
+
await navigator.clipboard.writeText(playerId);
|
|
113
|
+
console.log(`Copied player ID: ${playerId}`);
|
|
114
|
+
setCopiedPlayerId(playerId);
|
|
115
|
+
setTimeout(() => setCopiedPlayerId(null), 1000);
|
|
116
|
+
} catch {
|
|
117
|
+
// Fallback for older browsers
|
|
118
|
+
const textArea = document.createElement("textarea");
|
|
119
|
+
textArea.value = playerId;
|
|
120
|
+
textArea.style.position = "fixed";
|
|
121
|
+
textArea.style.opacity = "0";
|
|
122
|
+
document.body.appendChild(textArea);
|
|
123
|
+
textArea.select();
|
|
124
|
+
try {
|
|
125
|
+
document.execCommand("copy");
|
|
126
|
+
console.log(`Copied player ID: ${playerId}`);
|
|
127
|
+
setCopiedPlayerId(playerId);
|
|
128
|
+
setTimeout(() => setCopiedPlayerId(null), 1000);
|
|
129
|
+
} catch {
|
|
130
|
+
// Ignore
|
|
131
|
+
}
|
|
132
|
+
document.body.removeChild(textArea);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
91
136
|
const connectionVariant = useMemo<
|
|
92
137
|
"default" | "secondary" | "destructive" | "outline"
|
|
93
138
|
>(() => {
|
|
@@ -108,7 +153,7 @@ export const AirJamOverlay = ({
|
|
|
108
153
|
|
|
109
154
|
// Always render the navbar (unless child mode + playing)
|
|
110
155
|
return (
|
|
111
|
-
|
|
156
|
+
<div className="dark">
|
|
112
157
|
{/* Top Navbar - Always Visible */}
|
|
113
158
|
{!isChildMode && (
|
|
114
159
|
<div className="pointer-events-none absolute inset-x-0 top-0 z-99999">
|
|
@@ -132,18 +177,7 @@ export const AirJamOverlay = ({
|
|
|
132
177
|
{players.length > 0 && (
|
|
133
178
|
<div className="flex items-center -space-x-2">
|
|
134
179
|
{players.slice(0, 4).map((player) => (
|
|
135
|
-
<
|
|
136
|
-
key={player.id}
|
|
137
|
-
className="h-8 w-8 border-2"
|
|
138
|
-
style={{
|
|
139
|
-
borderColor: player.color || "hsl(var(--border))",
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
<AvatarImage
|
|
143
|
-
src={getPlayerAvatarUrl(player.id)}
|
|
144
|
-
alt={player.label}
|
|
145
|
-
/>
|
|
146
|
-
</Avatar>
|
|
180
|
+
<PlayerAvatar key={player.id} player={player} size="sm" />
|
|
147
181
|
))}
|
|
148
182
|
{players.length > 4 && (
|
|
149
183
|
<div className="border-background bg-muted flex h-8 w-8 items-center justify-center rounded-full border-2 text-xs font-medium">
|
|
@@ -154,22 +188,20 @@ export const AirJamOverlay = ({
|
|
|
154
188
|
)}
|
|
155
189
|
|
|
156
190
|
{/* Play/Pause button */}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
</Button>
|
|
172
|
-
)}
|
|
191
|
+
<Button
|
|
192
|
+
type="button"
|
|
193
|
+
variant="ghost"
|
|
194
|
+
size="icon"
|
|
195
|
+
onClick={toggleGameState}
|
|
196
|
+
aria-label={gameState === "playing" ? "Pause" : "Play"}
|
|
197
|
+
className="h-8 w-8"
|
|
198
|
+
>
|
|
199
|
+
{gameState === "playing" ? (
|
|
200
|
+
<Pause className="h-4 w-4" />
|
|
201
|
+
) : (
|
|
202
|
+
<Play className="h-4 w-4" />
|
|
203
|
+
)}
|
|
204
|
+
</Button>
|
|
173
205
|
</div>
|
|
174
206
|
</div>
|
|
175
207
|
</div>
|
|
@@ -180,7 +212,7 @@ export const AirJamOverlay = ({
|
|
|
180
212
|
{gameState === "paused" && (
|
|
181
213
|
<div className="pointer-events-none fixed inset-0 z-99998 flex items-center justify-center p-4">
|
|
182
214
|
<div className="pointer-events-auto w-full max-w-2xl">
|
|
183
|
-
<Card className="bg-card/20 flex h-[
|
|
215
|
+
<Card className="bg-card/20 flex max-h-[85vh] flex-col overflow-hidden border py-0 shadow-lg backdrop-blur-sm">
|
|
184
216
|
<Tabs
|
|
185
217
|
defaultValue={isChildMode ? "settings" : "room-code"}
|
|
186
218
|
className="flex h-full w-full flex-col gap-0"
|
|
@@ -218,29 +250,23 @@ export const AirJamOverlay = ({
|
|
|
218
250
|
value="room-code"
|
|
219
251
|
className="mt-0 min-h-0 flex-1 overflow-y-auto"
|
|
220
252
|
>
|
|
221
|
-
<div className="
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
<CardDescription className="text-xs tracking-[0.18em] uppercase">
|
|
237
|
-
Join URL
|
|
238
|
-
</CardDescription>
|
|
239
|
-
<p className="text-muted-foreground text-center font-mono text-xs break-all">
|
|
240
|
-
{joinUrl}
|
|
241
|
-
</p>
|
|
253
|
+
<div className="p-6">
|
|
254
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-[auto_1fr]">
|
|
255
|
+
{/* Left: QR Code Section */}
|
|
256
|
+
<div className="flex flex-col items-start gap-4">
|
|
257
|
+
<div className="space-y-2">
|
|
258
|
+
<CardTitle className="text-3xl font-bold tracking-wider">
|
|
259
|
+
{roomId}
|
|
260
|
+
</CardTitle>
|
|
261
|
+
<Badge
|
|
262
|
+
variant={connectionVariant}
|
|
263
|
+
className="w-fit"
|
|
264
|
+
>
|
|
265
|
+
{statusCopy[connectionStatus]}
|
|
266
|
+
</Badge>
|
|
267
|
+
</div>
|
|
242
268
|
|
|
243
|
-
<div className="border-border bg-card w-48 overflow-hidden rounded-lg border-2 shadow-md">
|
|
269
|
+
<div className="border-border bg-card w-48 shrink-0 overflow-hidden rounded-lg border-2 shadow-md">
|
|
244
270
|
{qrUrl ? (
|
|
245
271
|
<img
|
|
246
272
|
src={qrUrl}
|
|
@@ -255,45 +281,90 @@ export const AirJamOverlay = ({
|
|
|
255
281
|
</div>
|
|
256
282
|
)}
|
|
257
283
|
</div>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
{/* Right: Info Section */}
|
|
287
|
+
<div className="flex flex-col gap-6">
|
|
288
|
+
<div className="space-y-3">
|
|
289
|
+
<CardDescription className="text-xs tracking-[0.18em] uppercase">
|
|
290
|
+
Join URL
|
|
291
|
+
</CardDescription>
|
|
292
|
+
<div className="flex gap-2">
|
|
293
|
+
<input
|
|
294
|
+
type="text"
|
|
295
|
+
readOnly
|
|
296
|
+
value={joinUrl}
|
|
297
|
+
className="bg-background border-input text-foreground focus:ring-ring flex h-10 w-full rounded-md border px-3 py-2 font-mono text-xs focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
298
|
+
/>
|
|
299
|
+
<Button
|
|
300
|
+
type="button"
|
|
301
|
+
variant="outline"
|
|
302
|
+
size="icon"
|
|
303
|
+
onClick={handleCopyUrl}
|
|
304
|
+
className="h-10 shrink-0"
|
|
305
|
+
aria-label="Copy join URL"
|
|
306
|
+
>
|
|
307
|
+
{copied ? (
|
|
308
|
+
<Check className="h-4 w-4" />
|
|
309
|
+
) : (
|
|
310
|
+
<Copy className="h-4 w-4" />
|
|
311
|
+
)}
|
|
312
|
+
</Button>
|
|
313
|
+
<Button
|
|
314
|
+
type="button"
|
|
315
|
+
variant="outline"
|
|
316
|
+
size="icon"
|
|
317
|
+
onClick={handleOpenInNewTab}
|
|
318
|
+
className="h-10 shrink-0"
|
|
319
|
+
aria-label="Open join URL in new tab"
|
|
320
|
+
>
|
|
321
|
+
<ExternalLink className="h-4 w-4" />
|
|
322
|
+
</Button>
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
258
325
|
|
|
259
|
-
<div className="
|
|
326
|
+
<div className="space-y-3">
|
|
260
327
|
{players.length === 0 ? (
|
|
261
|
-
<p className="text-
|
|
328
|
+
<p className="text-sm text-white">
|
|
262
329
|
Waiting for controllers to join…
|
|
263
330
|
</p>
|
|
264
331
|
) : (
|
|
265
|
-
|
|
266
|
-
<p className="text-foreground text-
|
|
332
|
+
<>
|
|
333
|
+
<p className="text-foreground text-sm font-medium">
|
|
267
334
|
Connected Players ({players.length})
|
|
268
335
|
</p>
|
|
269
|
-
<ul className="
|
|
336
|
+
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
|
270
337
|
{players.map((player) => (
|
|
271
338
|
<li
|
|
272
339
|
key={player.id}
|
|
273
|
-
className="flex flex-col items-
|
|
340
|
+
className="flex min-w-0 flex-col items-start gap-2"
|
|
274
341
|
>
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
342
|
+
<div className="flex w-full min-w-0 items-center gap-2">
|
|
343
|
+
<PlayerAvatar
|
|
344
|
+
player={player}
|
|
345
|
+
size="md"
|
|
346
|
+
/>
|
|
347
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5 overflow-hidden">
|
|
348
|
+
<span className="text-card-foreground truncate text-sm font-medium">
|
|
349
|
+
{player.label}
|
|
350
|
+
</span>
|
|
351
|
+
<div
|
|
352
|
+
onClick={() =>
|
|
353
|
+
handleCopyPlayerId(player.id)
|
|
354
|
+
}
|
|
355
|
+
className="text-muted-foreground m-0 inline min-w-0 cursor-pointer truncate border-0 font-mono text-xs transition-colors hover:text-white"
|
|
356
|
+
title="Click to copy player ID"
|
|
357
|
+
>
|
|
358
|
+
{copiedPlayerId === player.id
|
|
359
|
+
? "Copied!"
|
|
360
|
+
: player.id.slice(0, 8)}
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
292
363
|
</div>
|
|
293
364
|
</li>
|
|
294
365
|
))}
|
|
295
366
|
</ul>
|
|
296
|
-
|
|
367
|
+
</>
|
|
297
368
|
)}
|
|
298
369
|
</div>
|
|
299
370
|
|
|
@@ -303,21 +374,19 @@ export const AirJamOverlay = ({
|
|
|
303
374
|
</Alert>
|
|
304
375
|
)}
|
|
305
376
|
|
|
306
|
-
{/* Play button
|
|
307
|
-
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
</div>
|
|
318
|
-
)}
|
|
377
|
+
{/* Play button - bottom right */}
|
|
378
|
+
<div className="mt-auto flex justify-end">
|
|
379
|
+
<Button
|
|
380
|
+
type="button"
|
|
381
|
+
onClick={toggleGameState}
|
|
382
|
+
size="lg"
|
|
383
|
+
>
|
|
384
|
+
<Play className="mr-2 h-5 w-5" />
|
|
385
|
+
Play
|
|
386
|
+
</Button>
|
|
387
|
+
</div>
|
|
319
388
|
</div>
|
|
320
|
-
</
|
|
389
|
+
</div>
|
|
321
390
|
</div>
|
|
322
391
|
</TabsContent>
|
|
323
392
|
)}
|
|
@@ -327,64 +396,52 @@ export const AirJamOverlay = ({
|
|
|
327
396
|
value="info"
|
|
328
397
|
className="mt-0 min-h-0 flex-1 overflow-y-auto"
|
|
329
398
|
>
|
|
330
|
-
<div className="
|
|
331
|
-
<
|
|
332
|
-
<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
<CardContent className="space-y-6">
|
|
341
|
-
<div className="flex flex-col items-center space-y-4">
|
|
342
|
-
<div className="w-full">
|
|
343
|
-
<div className="space-y-3">
|
|
344
|
-
<p className="text-foreground text-center text-sm font-medium">
|
|
345
|
-
Connected Players ({players.length})
|
|
346
|
-
</p>
|
|
347
|
-
<ul className="flex flex-wrap items-center justify-center gap-4">
|
|
348
|
-
{players.map((player) => (
|
|
349
|
-
<li
|
|
350
|
-
key={player.id}
|
|
351
|
-
className="flex flex-col items-center gap-2"
|
|
352
|
-
>
|
|
353
|
-
<img
|
|
354
|
-
src={getPlayerAvatarUrl(player.id)}
|
|
355
|
-
alt={player.label}
|
|
356
|
-
className="bg-secondary/30 h-16 w-16 rounded-full border-4 shadow-md"
|
|
357
|
-
style={{
|
|
358
|
-
borderColor:
|
|
359
|
-
player.color || "hsl(var(--border))",
|
|
360
|
-
}}
|
|
361
|
-
/>
|
|
362
|
-
<div className="flex flex-col items-center gap-0.5">
|
|
363
|
-
<span className="text-card-foreground max-w-[100px] truncate text-center text-sm font-medium">
|
|
364
|
-
{player.label}
|
|
365
|
-
</span>
|
|
366
|
-
</div>
|
|
367
|
-
</li>
|
|
368
|
-
))}
|
|
369
|
-
</ul>
|
|
370
|
-
</div>
|
|
371
|
-
</div>
|
|
399
|
+
<div className="p-6">
|
|
400
|
+
<div className="space-y-6">
|
|
401
|
+
<div className="space-y-2">
|
|
402
|
+
<CardTitle className="text-2xl font-bold tracking-wider">
|
|
403
|
+
Connected to Platform
|
|
404
|
+
</CardTitle>
|
|
405
|
+
<CardDescription>
|
|
406
|
+
This game is running inside the Air Jam Platform.
|
|
407
|
+
</CardDescription>
|
|
408
|
+
</div>
|
|
372
409
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
410
|
+
<div className="space-y-3">
|
|
411
|
+
<p className="text-foreground text-sm font-medium">
|
|
412
|
+
Connected Players ({players.length})
|
|
413
|
+
</p>
|
|
414
|
+
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
|
415
|
+
{players.map((player) => (
|
|
416
|
+
<li
|
|
417
|
+
key={player.id}
|
|
418
|
+
className="flex min-w-0 flex-col items-start gap-2"
|
|
380
419
|
>
|
|
381
|
-
<
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
420
|
+
<div className="flex w-full min-w-0 items-center gap-2">
|
|
421
|
+
<PlayerAvatar player={player} size="md" />
|
|
422
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5 overflow-hidden">
|
|
423
|
+
<span className="text-card-foreground truncate text-sm font-medium">
|
|
424
|
+
{player.label}
|
|
425
|
+
</span>
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
</li>
|
|
429
|
+
))}
|
|
430
|
+
</ul>
|
|
386
431
|
</div>
|
|
387
|
-
|
|
432
|
+
|
|
433
|
+
{/* Play button in paused state */}
|
|
434
|
+
<div className="pt-2">
|
|
435
|
+
<Button
|
|
436
|
+
type="button"
|
|
437
|
+
onClick={toggleGameState}
|
|
438
|
+
size="lg"
|
|
439
|
+
>
|
|
440
|
+
<Play className="mr-2 h-5 w-5" />
|
|
441
|
+
Resume Game
|
|
442
|
+
</Button>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
388
445
|
</div>
|
|
389
446
|
</TabsContent>
|
|
390
447
|
)}
|
|
@@ -451,6 +508,6 @@ export const AirJamOverlay = ({
|
|
|
451
508
|
</div>
|
|
452
509
|
</div>
|
|
453
510
|
)}
|
|
454
|
-
|
|
511
|
+
</div>
|
|
455
512
|
);
|
|
456
513
|
};
|