@nualang/nualang-ui-components 0.1.1419 → 0.1.1421

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.
@@ -1,28 +1,69 @@
1
1
  import { useState } from "react";
2
- import { IconButton, Typography, Grid, Box, Divider, Button, ListItem, ListItemIcon, ListItemText, Avatar, Tooltip } from "@mui/material";
3
- import PlaceholderImages from "../../utils/placeholder-images/index";
4
- import { useTheme } from "@mui/material/styles";
5
- import useMediaQuery from "@mui/material/useMediaQuery";
2
+ import { IconButton, Typography, Grid, Box, Divider, Button, Avatar, Tooltip, Popover, Chip } from "@mui/material";
3
+ import PlayCircleOutlineOutlinedIcon from '@mui/icons-material/PlayCircleOutlineOutlined';
4
+ import ImageSearchIcon from "@mui/icons-material/ImageSearch";
5
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
6
+ import ExpandLessIcon from "@mui/icons-material/ExpandLess";
7
+ import People from "@mui/icons-material/People";
8
+ import OndemandVideo from "@mui/icons-material/OndemandVideo";
6
9
  import Hearing from "@mui/icons-material/Hearing";
7
10
  import SwapHorizIcon from "@mui/icons-material/SwapHoriz";
8
- import PlayCircleOutlined from "@mui/icons-material/PlayCircleOutlined";
9
- import People from "@mui/icons-material/People";
10
- import StudentWaitingMessage from "../../Misc/StudentWaitingMessage/StudentWaitingMessage";
11
11
  import AutoStoriesIcon from "@mui/icons-material/AutoStories";
12
- import ExtensionIcon from '@mui/icons-material/Extension';
12
+ import ExtensionIcon from "@mui/icons-material/Extension";
13
13
  import EditNoteIcon from "@mui/icons-material/EditNote";
14
+ import StudentWaitingMessage from "../../Misc/StudentWaitingMessage/StudentWaitingMessage";
14
15
  import MedalSelector from "../../Misc/MedalSelector/MedalSelector";
15
- import OndemandVideo from "@mui/icons-material/OndemandVideo";
16
16
  import VideoViewer from "../../Dialogs/VideoViewer/VideoViewer";
17
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ const EXERCISE_ICONS = {
19
+ listening: Hearing,
20
+ translation: SwapHorizIcon,
21
+ meaning: ExtensionIcon,
22
+ "meaning-read-and-write": EditNoteIcon,
23
+ "roleplay-story": AutoStoriesIcon
24
+ };
25
+ const MAX_STACK_THUMBS = 3;
26
+ const NAME_MAX_CHARS = 30;
27
+ const truncate = (name = "") => name.length > NAME_MAX_CHARS ? `${name.slice(0, NAME_MAX_CHARS)}…` : name;
28
+ const LEVEL_1_SHADOW = "0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)";
29
+ function Thumb({
30
+ picture,
31
+ size,
32
+ radius
33
+ }) {
34
+ return picture ? /*#__PURE__*/_jsx(Box, {
35
+ sx: {
36
+ width: size,
37
+ height: size,
38
+ borderRadius: `${radius}px`,
39
+ flex: "none",
40
+ backgroundImage: `url('${picture}')`,
41
+ backgroundSize: "cover",
42
+ backgroundPosition: "center"
43
+ }
44
+ }) : /*#__PURE__*/_jsx(Box, {
45
+ sx: {
46
+ width: size,
47
+ height: size,
48
+ borderRadius: `${radius}px`,
49
+ flex: "none",
50
+ backgroundColor: "#BDBDBD",
51
+ display: "flex",
52
+ alignItems: "center",
53
+ justifyContent: "center"
54
+ },
55
+ children: /*#__PURE__*/_jsx(ImageSearchIcon, {
56
+ sx: {
57
+ fontSize: size * 0.55,
58
+ color: "#fff"
59
+ }
60
+ })
61
+ });
62
+ }
18
63
  export default function WaitingRoom({
19
- topicImage,
20
- phraseListImage,
21
64
  t,
22
65
  topicName,
23
- topicDescription,
24
66
  exerciseName,
25
- exerciseDescription,
26
67
  membersInRoom = [],
27
68
  handleUpdateGame,
28
69
  isCreator,
@@ -33,14 +74,21 @@ export default function WaitingRoom({
33
74
  exercise,
34
75
  selectedRoleplay,
35
76
  gameAward,
36
- videoUrl
77
+ sources
37
78
  }) {
38
- const theme = useTheme();
39
- const isLgScreen = useMediaQuery(theme.breakpoints.up("md"));
40
- const [isViewVideoOpen, setIsViewVideoOpen] = useState(false);
41
- const handleOpenViewVideo = () => {
42
- setIsViewVideoOpen(true);
43
- };
79
+ const [selectedVideo, setSelectedVideo] = useState(null);
80
+ const [sourcesAnchor, setSourcesAnchor] = useState(null);
81
+ const exerciseKey = exercise?.toLowerCase();
82
+ const exerciseLabel = t(exerciseKey === "meaning-read-and-write" ? "meaning_read_write" : exerciseName || exercise);
83
+ // Title is always the exercise name (e.g. "Story"); the scenario/list name
84
+ // lives in the chip beside it.
85
+ const title = exerciseLabel;
86
+ const ExerciseIcon = selectedRoleplay ? AutoStoriesIcon : EXERCISE_ICONS[exerciseKey];
87
+ const hasSources = Array.isArray(sources) && sources.length > 0;
88
+ const stackThumbs = hasSources ? sources.slice(0, MAX_STACK_THUMBS) : [];
89
+ // Scenario games show a single chip built from the selected roleplay.
90
+ const isScenario = !hasSources && !!selectedRoleplay;
91
+ const scenarioName = selectedRoleplay?.roleplayName || "";
44
92
 
45
93
  // Fixed-footprint style for the lobby media image. Constraining both
46
94
  // dimensions with object-fit keeps every source (roleplay/phrase list/topic
@@ -56,202 +104,335 @@ export default function WaitingRoom({
56
104
  return /*#__PURE__*/_jsxs(_Fragment, {
57
105
  children: [/*#__PURE__*/_jsxs(Box, {
58
106
  sx: {
59
- margin: 2,
60
- width: isLgScreen ? "100%" : "auto",
61
- maxWidth: "800px"
107
+ width: "100%",
108
+ maxWidth: 1000,
109
+ mx: "auto",
110
+ p: {
111
+ xs: "24px 16px",
112
+ md: "32px 24px"
113
+ },
114
+ display: "flex",
115
+ flexDirection: "column",
116
+ gap: 3
62
117
  },
63
- children: [/*#__PURE__*/_jsxs(Grid, {
64
- container: true,
118
+ children: [/*#__PURE__*/_jsxs(Box, {
65
119
  sx: {
66
- width: "100%",
67
- mb: 2,
68
- display: "flex"
120
+ display: "flex",
121
+ alignItems: "center",
122
+ justifyContent: "space-between",
123
+ gap: 3,
124
+ flexWrap: "wrap"
69
125
  },
70
- spacing: 4,
71
- children: [/*#__PURE__*/_jsx(Grid, {
72
- size: {
73
- lg: 4,
74
- md: 4,
75
- xs: 12
76
- },
77
- children: /*#__PURE__*/_jsx(Box, {
78
- sx: {
79
- textAlign: "center"
80
- },
81
- children: selectedRoleplay ? /*#__PURE__*/_jsx("img", {
82
- src: selectedRoleplay.picture,
83
- alt: "",
84
- style: mediaImageStyle
85
- }) : phraseListImage ? /*#__PURE__*/_jsx("img", {
86
- src: phraseListImage,
87
- alt: topicName || t("topic_image"),
88
- style: mediaImageStyle
89
- }) : topicImage ? /*#__PURE__*/_jsx("img", {
90
- src: topicImage,
91
- alt: "",
92
- style: mediaImageStyle
93
- }) : /*#__PURE__*/_jsx("img", {
94
- src: PlaceholderImages.topic,
95
- alt: "",
96
- style: mediaImageStyle
97
- })
98
- })
99
- }), /*#__PURE__*/_jsxs(Grid, {
126
+ children: [/*#__PURE__*/_jsxs(Box, {
100
127
  sx: {
101
128
  display: "flex",
102
- flexDirection: "column"
103
- },
104
- size: {
105
- lg: 6,
106
- md: 6,
107
- xs: 12
129
+ alignItems: "center",
130
+ gap: 2,
131
+ minWidth: 0
108
132
  },
109
- children: [selectedRoleplay ? /*#__PURE__*/_jsx(Typography, {
110
- variant: "h6",
111
- component: "h1",
112
- align: "left",
113
- gutterBottom: true,
114
- sx: {
115
- fontWeight: 700
116
- },
117
- children: selectedRoleplay.roleplayName
118
- }) : topicName && /*#__PURE__*/_jsx(Typography, {
119
- variant: "h6",
120
- component: "h1",
121
- align: "left",
122
- gutterBottom: true,
133
+ children: [/*#__PURE__*/_jsxs(Box, {
123
134
  sx: {
124
- fontWeight: 700
135
+ display: "flex",
136
+ alignItems: "center",
137
+ gap: 1.5,
138
+ minWidth: 0,
139
+ flex: "none"
125
140
  },
126
- children: topicName
127
- }), selectedRoleplay ? /*#__PURE__*/_jsx(Typography, {
128
- sx: {
129
- textAlign: "left",
130
- maxWidth: 500
141
+ children: [ExerciseIcon && /*#__PURE__*/_jsx(ExerciseIcon, {
142
+ sx: {
143
+ fontSize: 32,
144
+ color: "text.primary",
145
+ flex: "none"
146
+ }
147
+ }), /*#__PURE__*/_jsx(Typography, {
148
+ component: "h1",
149
+ sx: {
150
+ fontSize: 26,
151
+ fontWeight: 700,
152
+ color: "text.primary",
153
+ lineHeight: 1.2
154
+ },
155
+ children: title
156
+ })]
157
+ }), hasSources && /*#__PURE__*/_jsxs(Box, {
158
+ role: "button",
159
+ tabIndex: 0,
160
+ "aria-haspopup": "true",
161
+ "aria-expanded": Boolean(sourcesAnchor),
162
+ onClick: e => setSourcesAnchor(e.currentTarget),
163
+ onKeyDown: e => {
164
+ if (e.key === "Enter" || e.key === " ") {
165
+ e.preventDefault();
166
+ setSourcesAnchor(e.currentTarget);
167
+ }
131
168
  },
132
- color: "textSecondary",
133
- children: selectedRoleplay.description
134
- }) : topicDescription && /*#__PURE__*/_jsx(Typography, {
135
169
  sx: {
136
- textAlign: "left",
137
- maxWidth: 500
170
+ display: "flex",
171
+ alignItems: "center",
172
+ gap: 1,
173
+ pl: 0.5,
174
+ pr: 1.5,
175
+ py: 0.5,
176
+ border: "1px solid",
177
+ borderColor: "divider",
178
+ borderRadius: "25px",
179
+ backgroundColor: "background.paper",
180
+ boxShadow: LEVEL_1_SHADOW,
181
+ cursor: "pointer",
182
+ transition: "background-color 200ms cubic-bezier(0.4,0,0.2,1)",
183
+ "&:hover": {
184
+ backgroundColor: "action.hover"
185
+ }
138
186
  },
139
- color: "textSecondary",
140
- children: topicDescription
141
- }), /*#__PURE__*/_jsxs(ListItem, {
187
+ children: [/*#__PURE__*/_jsx(Box, {
188
+ sx: {
189
+ display: "flex",
190
+ alignItems: "center"
191
+ },
192
+ children: stackThumbs.map((s, i) => /*#__PURE__*/_jsx(Box, {
193
+ sx: {
194
+ ml: i === 0 ? 0 : "-10px",
195
+ borderRadius: "50%",
196
+ border: "2px solid",
197
+ borderColor: "background.paper",
198
+ flex: "none",
199
+ zIndex: stackThumbs.length - i
200
+ },
201
+ children: /*#__PURE__*/_jsx(Thumb, {
202
+ picture: s.picture,
203
+ size: 28,
204
+ radius: 14
205
+ })
206
+ }, s.phraseListId))
207
+ }), /*#__PURE__*/_jsxs(Box, {
208
+ sx: {
209
+ display: "flex",
210
+ alignItems: "center",
211
+ gap: 0.75,
212
+ minWidth: 0
213
+ },
214
+ children: [/*#__PURE__*/_jsx(Typography, {
215
+ noWrap: true,
216
+ sx: {
217
+ fontSize: 14,
218
+ fontWeight: 600,
219
+ color: "text.primary"
220
+ },
221
+ children: truncate(sources[0].phraseListName)
222
+ }), sources.length > 1 && /*#__PURE__*/_jsx(Chip, {
223
+ size: "small",
224
+ label: `+${sources.length - 1}`,
225
+ sx: {
226
+ flexShrink: 0,
227
+ height: 20,
228
+ fontSize: "0.7rem",
229
+ fontWeight: 600,
230
+ backgroundColor: "action.selected",
231
+ color: "text.secondary",
232
+ "& .MuiChip-label": {
233
+ px: "6px"
234
+ }
235
+ }
236
+ })]
237
+ }), sourcesAnchor ? /*#__PURE__*/_jsx(ExpandLessIcon, {
238
+ sx: {
239
+ fontSize: 20,
240
+ color: "text.secondary"
241
+ }
242
+ }) : /*#__PURE__*/_jsx(ExpandMoreIcon, {
243
+ sx: {
244
+ fontSize: 20,
245
+ color: "text.secondary"
246
+ }
247
+ })]
248
+ }), isScenario && /*#__PURE__*/_jsxs(Box, {
142
249
  sx: {
143
- paddingLeft: 0
250
+ display: "flex",
251
+ alignItems: "center",
252
+ gap: 1,
253
+ pl: 0.5,
254
+ pr: 1.5,
255
+ py: 0.5,
256
+ border: "1px solid",
257
+ borderColor: "divider",
258
+ borderRadius: "25px",
259
+ backgroundColor: "background.paper",
260
+ boxShadow: LEVEL_1_SHADOW
144
261
  },
145
- children: [exercise.toLowerCase() === "listening" && /*#__PURE__*/_jsx(ListItemIcon, {
146
- children: /*#__PURE__*/_jsx(Hearing, {
147
- fontSize: "large"
148
- })
149
- }), exercise.toLowerCase() === "translation" && /*#__PURE__*/_jsx(ListItemIcon, {
150
- children: /*#__PURE__*/_jsx(SwapHorizIcon, {
151
- fontSize: "large"
152
- })
153
- }), exercise.toLowerCase() === "roleplay-story" && /*#__PURE__*/_jsx(ListItemIcon, {
154
- children: /*#__PURE__*/_jsx(AutoStoriesIcon, {
155
- fontSize: "large"
156
- })
157
- }), exercise.toLowerCase() === "meaning" && /*#__PURE__*/_jsx(ListItemIcon, {
158
- children: /*#__PURE__*/_jsx(ExtensionIcon, {
159
- fontSize: "large",
160
- "aria-hidden": "true"
161
- })
162
- }), exercise.toLowerCase() === "meaning-read-and-write" && /*#__PURE__*/_jsx(ListItemIcon, {
163
- children: /*#__PURE__*/_jsx(EditNoteIcon, {
164
- fontSize: "large",
165
- "aria-hidden": "true"
262
+ children: [/*#__PURE__*/_jsx(Box, {
263
+ sx: {
264
+ borderRadius: "50%",
265
+ border: "2px solid",
266
+ borderColor: "background.paper",
267
+ flex: "none"
268
+ },
269
+ children: /*#__PURE__*/_jsx(Thumb, {
270
+ picture: selectedRoleplay.picture,
271
+ size: 28,
272
+ radius: 14
166
273
  })
167
- }), /*#__PURE__*/_jsx(ListItemText, {
168
- primary: t(exercise.toLowerCase() === "meaning-read-and-write" ? "meaning_read_write" : exerciseName),
169
- secondary: isLgScreen ? t(exerciseDescription) : /*#__PURE__*/_jsx(_Fragment, {
170
- children: /*#__PURE__*/_jsx(Typography, {
171
- variant: "body2",
172
- component: "p",
173
- color: "textSecondary",
174
- children: t(exerciseDescription)
175
- })
176
- }),
177
- "data-cy": "waitingRoomExercise"
274
+ }), /*#__PURE__*/_jsx(Typography, {
275
+ noWrap: true,
276
+ sx: {
277
+ fontSize: 14,
278
+ fontWeight: 600,
279
+ color: "text.primary"
280
+ },
281
+ children: truncate(scenarioName)
178
282
  })]
179
- }), isCreator && videoUrl && /*#__PURE__*/_jsx(Button, {
283
+ })]
284
+ }), isCreator && /*#__PURE__*/_jsx(Box, {
285
+ sx: {
286
+ display: "flex",
287
+ alignItems: "center",
288
+ gap: 1.5,
289
+ flex: "none"
290
+ },
291
+ children: /*#__PURE__*/_jsx(Button, {
180
292
  variant: "contained",
181
- color: "primary",
182
- startIcon: /*#__PURE__*/_jsx(OndemandVideo, {}),
183
- onClick: handleOpenViewVideo,
293
+ color: "success",
184
294
  sx: {
185
- alignSelf: "flex-start"
295
+ color: "white"
186
296
  },
187
- children: t("play_video")
188
- })]
189
- }), isCreator && /*#__PURE__*/_jsx(Grid, {
190
- size: {
191
- lg: 2,
192
- md: 2,
193
- xs: 12
297
+ disabled: membersInRoom.length === 0,
298
+ startIcon: /*#__PURE__*/_jsx(PlayCircleOutlineOutlinedIcon, {}),
299
+ onClick: () => {
300
+ handleUpdateGame();
301
+ },
302
+ id: "startGame",
303
+ "data-cy": "startGameButton",
304
+ children: t("start")
305
+ })
306
+ })]
307
+ }), /*#__PURE__*/_jsx(Popover, {
308
+ open: Boolean(sourcesAnchor),
309
+ anchorEl: sourcesAnchor,
310
+ onClose: () => setSourcesAnchor(null),
311
+ anchorOrigin: {
312
+ vertical: "bottom",
313
+ horizontal: "left"
314
+ },
315
+ transformOrigin: {
316
+ vertical: "top",
317
+ horizontal: "left"
318
+ },
319
+ slotProps: {
320
+ paper: {
321
+ sx: {
322
+ mt: 1,
323
+ borderRadius: "12px",
324
+ minWidth: 320,
325
+ maxWidth: 400,
326
+ overflow: "hidden"
327
+ }
328
+ }
329
+ },
330
+ children: (sources || []).map((s, i) => /*#__PURE__*/_jsxs(Box, {
331
+ sx: {
332
+ display: "flex",
333
+ alignItems: "center",
334
+ gap: 1.5,
335
+ p: 1.5,
336
+ ...(i > 0 ? {
337
+ borderTop: "1px solid",
338
+ borderColor: "divider"
339
+ } : {})
194
340
  },
195
- children: /*#__PURE__*/_jsx(Grid, {
196
- container: true,
341
+ children: [/*#__PURE__*/_jsx(Thumb, {
342
+ picture: s.picture,
343
+ size: 40,
344
+ radius: 8
345
+ }), /*#__PURE__*/_jsxs(Box, {
197
346
  sx: {
198
- width: "100%",
199
- paddingTop: 2
347
+ display: "flex",
348
+ flexDirection: "column",
349
+ gap: 0.25,
350
+ minWidth: 0,
351
+ flex: 1
200
352
  },
201
- size: 12,
202
- children: /*#__PURE__*/_jsx(Grid, {
203
- size: {
204
- xs: 12,
205
- md: 12,
206
- lg: 12
353
+ children: [/*#__PURE__*/_jsx(Typography, {
354
+ noWrap: true,
355
+ sx: {
356
+ fontSize: 16,
357
+ fontWeight: 600,
358
+ color: "text.primary"
207
359
  },
208
- children: /*#__PURE__*/_jsx("div", {
209
- style: {
210
- display: "flex",
211
- alignItems: "center",
212
- marginBottom: "16px"
213
- },
214
- children: /*#__PURE__*/_jsx(Button, {
215
- variant: "contained",
216
- color: "success",
217
- sx: {
218
- color: "white",
219
- marginBottom: 2
220
- },
221
- disabled: membersInRoom.length === 0,
222
- startIcon: /*#__PURE__*/_jsx(PlayCircleOutlined, {}),
223
- onClick: () => {
224
- handleUpdateGame();
225
- },
226
- id: "startGame",
227
- "data-cy": "startGameButton",
228
- children: t("start")
229
- })
230
- })
360
+ children: s.phraseListName
361
+ }), /*#__PURE__*/_jsx(Typography, {
362
+ noWrap: true,
363
+ sx: {
364
+ fontSize: 14,
365
+ color: "text.secondary"
366
+ },
367
+ children: s.phraseCount != null ? t("source_card_meta", {
368
+ topic: s.topicName || "",
369
+ count: s.phraseCount
370
+ }) : s.topicName || ""
371
+ })]
372
+ }), s.topicVideoUrl && /*#__PURE__*/_jsx(Tooltip, {
373
+ title: t("play_video"),
374
+ children: /*#__PURE__*/_jsx(IconButton, {
375
+ size: "small",
376
+ color: "primary",
377
+ "data-cy": "sourcePlayVideoButton",
378
+ sx: {
379
+ flex: "none"
380
+ },
381
+ onClick: () => {
382
+ setSelectedVideo({
383
+ url: s.topicVideoUrl,
384
+ title: s.topicName || s.phraseListName
385
+ });
386
+ setSourcesAnchor(null);
387
+ },
388
+ children: /*#__PURE__*/_jsx(OndemandVideo, {})
231
389
  })
232
- })
233
- })]
390
+ })]
391
+ }, s.phraseListId))
234
392
  }), /*#__PURE__*/_jsx(Divider, {
235
393
  sx: {
236
- borderBottomWidth: 5,
237
- marginBottom: 2
394
+ borderBottomWidth: 2
238
395
  }
239
- }), isCreator && gameStatus !== "LIVE" ? /*#__PURE__*/_jsxs(Typography, {
240
- align: "center",
396
+ }), isCreator && gameStatus !== "LIVE" ? /*#__PURE__*/_jsxs(Box, {
241
397
  sx: {
242
- marginBottom: 4,
243
- fontWeight: "bold"
398
+ display: "flex",
399
+ flexDirection: "column",
400
+ alignItems: "center",
401
+ gap: 1,
402
+ pt: 1
244
403
  },
245
- variant: "h6",
246
- children: [`${membersInRoom.length} ${membersInRoom.length === 1 ? t("player") : t("players")}`, /*#__PURE__*/_jsx(Tooltip, {
247
- title: t("members"),
248
- children: /*#__PURE__*/_jsx(IconButton, {
249
- onClick: handleOpenMembersDrawer,
250
- id: "gameMembers",
251
- children: /*#__PURE__*/_jsx(People, {
252
- color: "primary"
404
+ children: [/*#__PURE__*/_jsxs(Box, {
405
+ sx: {
406
+ display: "flex",
407
+ alignItems: "center",
408
+ gap: 1.5
409
+ },
410
+ children: [/*#__PURE__*/_jsx(Typography, {
411
+ sx: {
412
+ fontSize: 24,
413
+ fontWeight: 700,
414
+ color: "text.primary"
415
+ },
416
+ children: `${membersInRoom.length} ${membersInRoom.length === 1 ? t("player") : t("players")}`
417
+ }), /*#__PURE__*/_jsx(Tooltip, {
418
+ title: t("members"),
419
+ children: /*#__PURE__*/_jsx(IconButton, {
420
+ onClick: handleOpenMembersDrawer,
421
+ id: "gameMembers",
422
+ children: /*#__PURE__*/_jsx(People, {
423
+ sx: {
424
+ fontSize: 28,
425
+ color: "primary.main"
426
+ }
427
+ })
253
428
  })
254
- })
429
+ })]
430
+ }), /*#__PURE__*/_jsx(Typography, {
431
+ sx: {
432
+ fontSize: 16,
433
+ color: "text.secondary"
434
+ },
435
+ children: t("waiting_for_students")
255
436
  })]
256
437
  }) : /*#__PURE__*/_jsx(StudentWaitingMessage, {
257
438
  t: t
@@ -262,80 +443,54 @@ export default function WaitingRoom({
262
443
  justifyContent: "center",
263
444
  alignItems: "flex-start"
264
445
  },
265
- children: membersInRoom.map(member => {
266
- return /*#__PURE__*/_jsx(Grid, {
267
- size: {
268
- lg: 2.4,
269
- xs: 6,
270
- md: 4
446
+ children: membersInRoom.map(member => /*#__PURE__*/_jsx(Grid, {
447
+ size: {
448
+ lg: 2.4,
449
+ xs: 6,
450
+ md: 4
451
+ },
452
+ children: /*#__PURE__*/_jsxs(Box, {
453
+ sx: {
454
+ display: "flex",
455
+ flexDirection: "column",
456
+ alignItems: "center",
457
+ height: "100%"
271
458
  },
272
- children: /*#__PURE__*/_jsxs(Box, {
459
+ children: [/*#__PURE__*/_jsx(Avatar, {
460
+ src: member.userImage,
461
+ alt: member.username,
273
462
  sx: {
274
- display: "flex",
275
- flexDirection: "column",
276
- alignItems: "center",
277
- height: "100%"
463
+ width: 75,
464
+ height: 75
465
+ }
466
+ }), /*#__PURE__*/_jsx(Box, {
467
+ sx: {
468
+ position: "relative",
469
+ display: "inline-block"
278
470
  },
279
- children: [/*#__PURE__*/_jsx(Avatar, {
280
- src: member.userImage,
281
- alt: member.username,
471
+ children: ["gold", "silver", "bronze"].includes(member.gameAward) && /*#__PURE__*/_jsx(MedalSelector, {
472
+ color: member.gameAward,
473
+ width: 24,
474
+ fade: false,
475
+ backgroundColor: true,
282
476
  sx: {
283
- width: 75,
284
- height: 75
477
+ position: "absolute",
478
+ padding: "1px",
479
+ bottom: "-3px",
480
+ right: "-35px",
481
+ borderRadius: "50%"
285
482
  }
286
- }), /*#__PURE__*/_jsxs("div", {
287
- style: {
288
- position: "relative",
289
- display: "inline-block"
290
- },
291
- children: [member.gameAward === "gold" && /*#__PURE__*/_jsx(MedalSelector, {
292
- color: "gold",
293
- width: 24,
294
- fade: false,
295
- backgroundColor: true,
296
- sx: {
297
- position: "absolute",
298
- padding: "1px",
299
- bottom: "-3px",
300
- right: "-35px",
301
- borderRadius: "50%"
302
- }
303
- }), member.gameAward === "silver" && /*#__PURE__*/_jsx(MedalSelector, {
304
- color: "silver",
305
- width: 24,
306
- fade: false,
307
- backgroundColor: true,
308
- sx: {
309
- position: "absolute",
310
- padding: "1px",
311
- bottom: "-3px",
312
- right: "-35px",
313
- borderRadius: "50%"
314
- }
315
- }), member.gameAward === "bronze" && /*#__PURE__*/_jsx(MedalSelector, {
316
- color: "bronze",
317
- width: 24,
318
- fade: false,
319
- backgroundColor: true,
320
- sx: {
321
- position: "absolute",
322
- padding: "1px",
323
- bottom: "-3px",
324
- right: "-35px",
325
- borderRadius: "50%"
326
- }
327
- })]
328
- }), /*#__PURE__*/_jsx(Typography, {
329
- variant: "h5",
330
- align: "center",
331
- sx: {
332
- fontWeight: "bold"
333
- },
334
- children: member?.username?.length > 18 ? member.username.substring(0, 18) + "..." : member.username
335
- })]
336
- })
337
- }, member.username);
338
- })
483
+ })
484
+ }), /*#__PURE__*/_jsx(Typography, {
485
+ variant: "h6",
486
+ align: "center",
487
+ sx: {
488
+ fontWeight: "bold"
489
+ },
490
+ children: member?.username?.length > 18 ? member.username.substring(0, 18) + "..." : member.username
491
+ })]
492
+ })
493
+ }, member.username))
339
494
  }) : /*#__PURE__*/_jsx(Grid, {
340
495
  container: true,
341
496
  spacing: 2,
@@ -358,25 +513,13 @@ export default function WaitingRoom({
358
513
  width: 75,
359
514
  height: 75
360
515
  }
361
- }), /*#__PURE__*/_jsxs("div", {
362
- style: {
516
+ }), /*#__PURE__*/_jsx(Box, {
517
+ sx: {
363
518
  position: "relative",
364
519
  display: "inline-block"
365
520
  },
366
- children: [gameAward === "gold" && /*#__PURE__*/_jsx(MedalSelector, {
367
- color: "gold",
368
- width: 24,
369
- fade: false,
370
- backgroundColor: true,
371
- sx: {
372
- position: "absolute",
373
- padding: "1px",
374
- bottom: "-3px",
375
- right: "-35px",
376
- borderRadius: "50%"
377
- }
378
- }), gameAward === "silver" && /*#__PURE__*/_jsx(MedalSelector, {
379
- color: "silver",
521
+ children: ["gold", "silver", "bronze"].includes(gameAward) && /*#__PURE__*/_jsx(MedalSelector, {
522
+ color: gameAward,
380
523
  width: 24,
381
524
  fade: false,
382
525
  backgroundColor: true,
@@ -387,19 +530,7 @@ export default function WaitingRoom({
387
530
  right: "-35px",
388
531
  borderRadius: "50%"
389
532
  }
390
- }), gameAward === "bronze" && /*#__PURE__*/_jsx(MedalSelector, {
391
- color: "bronze",
392
- width: 24,
393
- fade: false,
394
- backgroundColor: true,
395
- sx: {
396
- position: "absolute",
397
- padding: "1px",
398
- bottom: "-3px",
399
- right: "-35px",
400
- borderRadius: "50%"
401
- }
402
- })]
533
+ })
403
534
  }), /*#__PURE__*/_jsx(Typography, {
404
535
  variant: "h5",
405
536
  align: "center",
@@ -413,10 +544,10 @@ export default function WaitingRoom({
413
544
  })]
414
545
  }), /*#__PURE__*/_jsx(VideoViewer, {
415
546
  t: t,
416
- title: topicName,
417
- s3Url: videoUrl,
418
- open: isViewVideoOpen,
419
- handleClose: () => setIsViewVideoOpen(false)
547
+ title: selectedVideo?.title || topicName,
548
+ s3Url: selectedVideo?.url || "",
549
+ open: Boolean(selectedVideo),
550
+ handleClose: () => setSelectedVideo(null)
420
551
  })]
421
552
  });
422
553
  }