@100mslive/roomkit-react 0.3.10-alpha.16 → 0.3.10-alpha.18

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.
Files changed (46) hide show
  1. package/dist/{HLSView-WF5O5RAH.css → HLSView-LNCDKSKQ.css} +3 -3
  2. package/dist/{HLSView-WF5O5RAH.css.map → HLSView-LNCDKSKQ.css.map} +1 -1
  3. package/dist/{HLSView-GCQTTWZN.js → HLSView-SJJ2GAYJ.js} +18 -3
  4. package/dist/HLSView-SJJ2GAYJ.js.map +7 -0
  5. package/dist/Prebuilt/common/constants.d.ts +0 -2
  6. package/dist/Prebuilt/common/hooks.d.ts +8 -1
  7. package/dist/Prebuilt/components/Polls/Voting/StandardVoting.d.ts +4 -2
  8. package/dist/Prebuilt/components/Polls/Voting/TimedVoting.d.ts +4 -2
  9. package/dist/Prebuilt/layouts/WaitingView.d.ts +6 -0
  10. package/dist/{chunk-FFWLNZPI.js → chunk-FMGGXDNB.js} +901 -788
  11. package/dist/chunk-FMGGXDNB.js.map +7 -0
  12. package/dist/index.cjs.css +2 -2
  13. package/dist/index.cjs.css.map +1 -1
  14. package/dist/index.cjs.js +1063 -941
  15. package/dist/index.cjs.js.map +4 -4
  16. package/dist/index.css +2 -2
  17. package/dist/index.css.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/meta.cjs.json +138 -108
  20. package/dist/meta.esbuild.json +154 -123
  21. package/package.json +7 -7
  22. package/src/Prebuilt/common/constants.ts +0 -2
  23. package/src/Prebuilt/common/hooks.ts +34 -1
  24. package/src/Prebuilt/common/utils.js +11 -11
  25. package/src/Prebuilt/components/AppData/AppData.tsx +0 -2
  26. package/src/Prebuilt/components/AppData/useUISettings.js +0 -3
  27. package/src/Prebuilt/components/Chat/Chat.tsx +26 -6
  28. package/src/Prebuilt/components/Chat/ChatFooter.tsx +18 -2
  29. package/src/Prebuilt/components/Chat/ChatStates.tsx +1 -1
  30. package/src/Prebuilt/components/Footer/ChatToggle.tsx +5 -1
  31. package/src/Prebuilt/components/Footer/ParticipantList.tsx +4 -2
  32. package/src/Prebuilt/components/Footer/PollsToggle.tsx +1 -1
  33. package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.tsx +2 -15
  34. package/src/Prebuilt/components/Polls/Voting/LeaderboardSummary.tsx +71 -66
  35. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +39 -40
  36. package/src/Prebuilt/components/Polls/Voting/StandardVoting.tsx +12 -6
  37. package/src/Prebuilt/components/Polls/Voting/TimedVoting.tsx +21 -10
  38. package/src/Prebuilt/components/Polls/Voting/Voting.tsx +44 -2
  39. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +13 -17
  40. package/src/Prebuilt/layouts/HLSView.jsx +14 -11
  41. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +44 -9
  42. package/src/Prebuilt/layouts/WaitingView.tsx +52 -0
  43. package/dist/HLSView-GCQTTWZN.js.map +0 -7
  44. package/dist/chunk-FFWLNZPI.js.map +0 -7
  45. package/src/Prebuilt/layouts/NonPublisherView.jsx +0 -51
  46. package/src/Prebuilt/layouts/WaitingView.jsx +0 -51
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.3.10-alpha.16",
13
+ "version": "0.3.10-alpha.18",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -74,12 +74,12 @@
74
74
  "react": ">=17.0.2 <19.0.0"
75
75
  },
76
76
  "dependencies": {
77
- "@100mslive/hls-player": "0.3.10-alpha.16",
77
+ "@100mslive/hls-player": "0.3.10-alpha.18",
78
78
  "@100mslive/hms-noise-cancellation": "0.0.1",
79
- "@100mslive/hms-virtual-background": "1.13.10-alpha.16",
80
- "@100mslive/hms-whiteboard": "0.0.0-alpha.10",
81
- "@100mslive/react-icons": "0.10.10-alpha.16",
82
- "@100mslive/react-sdk": "0.10.10-alpha.16",
79
+ "@100mslive/hms-virtual-background": "1.13.10-alpha.18",
80
+ "@100mslive/hms-whiteboard": "0.0.0-alpha.12",
81
+ "@100mslive/react-icons": "0.10.10-alpha.18",
82
+ "@100mslive/react-sdk": "0.10.10-alpha.18",
83
83
  "@100mslive/types-prebuilt": "0.12.8",
84
84
  "@emoji-mart/data": "^1.0.6",
85
85
  "@emoji-mart/react": "^1.0.1",
@@ -115,5 +115,5 @@
115
115
  "uuid": "^8.3.2",
116
116
  "worker-timers": "^7.0.40"
117
117
  },
118
- "gitHead": "a59fc418ff4591c05259eb505d14722bfcd1aa85"
118
+ "gitHead": "9443f8d47837b1c8412b40c4e7569f13311ae46c"
119
119
  }
@@ -1,6 +1,5 @@
1
1
  import { parsedUserAgent } from '@100mslive/react-sdk';
2
2
 
3
- export const DEFAULT_WAITING_VIEWER_ROLE = 'waiting-room';
4
3
  export const QUERY_PARAM_SKIP_PREVIEW = 'skip_preview';
5
4
  export const QUERY_PARAM_SKIP_PREVIEW_HEADFUL = 'skip_preview_headful';
6
5
  export const QUERY_PARAM_NAME = 'name';
@@ -30,7 +29,6 @@ export const APP_DATA = {
30
29
  appConfig: 'appConfig',
31
30
  sidePane: 'sidePane',
32
31
  hlsStats: 'hlsStats',
33
- waitingViewerRole: 'waitingViewerRole',
34
32
  subscribedNotifications: 'subscribedNotifications',
35
33
  logo: 'logo',
36
34
  hlsStarted: 'hlsStarted',
@@ -1,17 +1,22 @@
1
- import { useCallback, useEffect, useRef, useState } from 'react';
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import { HMSHLSPlayer } from '@100mslive/hls-player';
4
4
  import { JoinForm_JoinBtnType } from '@100mslive/types-prebuilt/elements/join_form';
5
5
  import {
6
+ HMSPeer,
6
7
  HMSRecording,
7
8
  parsedUserAgent,
8
9
  selectAvailableRoleNames,
10
+ selectIsAllowedToPublish,
9
11
  selectIsConnectedToRoom,
12
+ selectLocalPeerRole,
10
13
  selectPeerCount,
11
14
  selectPeerMetadata,
12
15
  selectPeers,
16
+ selectPeersByRoles,
13
17
  selectRecordingState,
14
18
  selectRemotePeers,
19
+ selectRolesMap,
15
20
  useHMSActions,
16
21
  useHMSStore,
17
22
  useHMSVanillaStore,
@@ -218,3 +223,31 @@ export function getResolution(
218
223
  }
219
224
  return resolution;
220
225
  }
226
+
227
+ export interface WaitingRoomInfo {
228
+ isNotAllowedToPublish: boolean;
229
+ isScreenOnlyPublishParams: boolean;
230
+ hasSubscribedRolePublishing: boolean;
231
+ }
232
+ export function useWaitingRoomInfo(): WaitingRoomInfo {
233
+ const localPeerRole = useHMSStore(selectLocalPeerRole);
234
+ const { video, audio, screen } = useHMSStore(selectIsAllowedToPublish);
235
+ const roles = useHMSStore(selectRolesMap);
236
+ const peersByRoles = useHMSStore(selectPeersByRoles(localPeerRole?.subscribeParams.subscribeToRoles || []));
237
+ const isNotAllowedToPublish = video && audio && screen;
238
+ const isScreenOnlyPublishParams: boolean = screen;
239
+ const hasSubscribedRolePublishing: boolean = useMemo(() => {
240
+ return peersByRoles.some((peer: HMSPeer) => {
241
+ if (peer.roleName && roles[peer.roleName] && !peer.isLocal) {
242
+ return !!roles[peer.roleName].publishParams?.allowed.length;
243
+ }
244
+ return false;
245
+ });
246
+ }, [peersByRoles, roles]);
247
+
248
+ return {
249
+ isNotAllowedToPublish,
250
+ isScreenOnlyPublishParams,
251
+ hasSubscribedRolePublishing,
252
+ };
253
+ }
@@ -142,22 +142,22 @@ export const getPeerResponses = (questions, peerid, userid) => {
142
142
  return questions.map(question =>
143
143
  question.responses?.filter(
144
144
  response =>
145
- ((response && response.peer?.peerid === peerid) || response.peer?.userid === userid) && !response.skipped,
145
+ response && (response.peer?.peerid === peerid || response.peer?.userid === userid) && !response.skipped,
146
146
  ),
147
147
  );
148
148
  };
149
149
 
150
- export const getLastAttemptedIndex = (questions, peerid, userid = '') => {
151
- const peerResponses = getPeerResponses(questions, peerid, userid) || [];
152
- for (let i = 0; i < peerResponses.length; i++) {
153
- // If another peer has attempted, undefined changes to an empty array
154
- if (peerResponses[i] === undefined || peerResponses[i].length === 0) {
155
- // Backend question index starts at 1
156
- return i + 1;
150
+ export const getIndexToShow = responses => {
151
+ let lastAttemptedIndex = 0;
152
+
153
+ Object.keys(responses).forEach(key => {
154
+ const keyNum = parseInt(key);
155
+ if (keyNum > lastAttemptedIndex && responses[key]) {
156
+ lastAttemptedIndex = keyNum;
157
157
  }
158
- }
159
- // To indicate all have been attempted
160
- return questions.length + 1;
158
+ });
159
+
160
+ return lastAttemptedIndex + 1;
161
161
  };
162
162
 
163
163
  export const getPeerParticipationSummary = (poll, localPeerID, localCustomerUserID) => {
@@ -21,7 +21,6 @@ import { useSetAppDataByKey } from './useUISettings';
21
21
  import {
22
22
  APP_DATA,
23
23
  CHAT_SELECTOR,
24
- DEFAULT_WAITING_VIEWER_ROLE,
25
24
  POLL_STATE,
26
25
  SIDE_PANE_OPTIONS,
27
26
  UI_MODE_GRID,
@@ -56,7 +55,6 @@ const initialAppData = {
56
55
  [APP_DATA.hlsStarted]: false,
57
56
  [APP_DATA.rtmpStarted]: false,
58
57
  [APP_DATA.recordingStarted]: false,
59
- [APP_DATA.waitingViewerRole]: DEFAULT_WAITING_VIEWER_ROLE,
60
58
  [APP_DATA.dropdownList]: [],
61
59
  [APP_DATA.authToken]: '',
62
60
  [APP_DATA.minimiseInset]: false,
@@ -48,9 +48,6 @@ export const useSetUiSettings = uiSettingKey => {
48
48
  return [value, setValue];
49
49
  };
50
50
 
51
- export const useWaitingViewerRole = () => {
52
- return useHMSStore(selectAppData(APP_DATA.waitingViewerRole));
53
- };
54
51
  export const useIsHLSStartedFromUI = () => {
55
52
  return useHMSStore(selectAppData(APP_DATA.hlsStarted));
56
53
  };
@@ -10,17 +10,20 @@ import { Box, Flex } from '../../../Layout';
10
10
  import { config as cssConfig } from '../../../Theme';
11
11
  // @ts-ignore: No implicit any
12
12
  import { EmojiReaction } from '../EmojiReaction';
13
+ import { MoreSettings } from '../MoreSettings/MoreSettings';
14
+ import { RaiseHand } from '../RaiseHand';
13
15
  import { ChatBody } from './ChatBody';
14
16
  import { ChatFooter } from './ChatFooter';
15
17
  import { ChatBlocked, ChatPaused } from './ChatStates';
16
18
  import { PinnedMessage } from './PinnedMessage';
17
19
  import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
18
20
  import { useSidepaneResetOnLayoutUpdate } from '../AppData/useSidepaneResetOnLayoutUpdate';
21
+ import { useIsPeerBlacklisted } from '../hooks/useChatBlacklist';
19
22
  import { useLandscapeHLSStream, useMobileHLSStream } from '../../common/hooks';
20
23
  import { SESSION_STORE_KEY, SIDE_PANE_OPTIONS } from '../../common/constants';
21
24
 
22
25
  export const Chat = () => {
23
- const { elements } = useRoomLayoutConferencingScreen();
26
+ const { elements, screenType } = useRoomLayoutConferencingScreen();
24
27
  const listRef = useRef<VariableSizeList | null>(null);
25
28
  const hmsActions = useHMSActions();
26
29
  const vanillaStore = useHMSVanillaStore();
@@ -29,6 +32,7 @@ export const Chat = () => {
29
32
  const isMobileHLSStream = useMobileHLSStream();
30
33
  const isLandscapeStream = useLandscapeHLSStream();
31
34
  useSidepaneResetOnLayoutUpdate('chat', SIDE_PANE_OPTIONS.CHAT);
35
+ const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
32
36
 
33
37
  const scrollToBottom = useCallback(
34
38
  (unreadCount = 0) => {
@@ -57,20 +61,27 @@ export const Chat = () => {
57
61
  >
58
62
  {isMobile && elements?.chat?.is_overlay && !streaming ? null : <PinnedMessage />}
59
63
  <ChatBody ref={listRef} scrollToBottom={scrollToBottom} />
60
-
61
- <ChatPaused />
62
- <ChatBlocked />
64
+ <Flex align="center" css={{ w: '100%', gap: '$2' }}>
65
+ <ChatPaused />
66
+ <ChatBlocked />
67
+ {streaming && (!isChatEnabled || isLocalPeerBlacklisted) && (
68
+ <>
69
+ <RaiseHand css={{ bg: '$surface_default' }} />
70
+ <MoreSettings elements={elements} screenType={screenType} />
71
+ </>
72
+ )}
73
+ </Flex>
63
74
  {isMobile && elements?.chat?.is_overlay && !streaming ? <PinnedMessage /> : null}
64
75
  {isChatEnabled ? (
65
76
  <ChatFooter onSend={scrollToBottom}>
66
77
  <NewMessageIndicator scrollToBottom={scrollToBottom} listRef={listRef} />
67
78
  </ChatFooter>
68
79
  ) : null}
69
- {(isMobileHLSStream || isLandscapeStream) && (
80
+ {streaming && (
70
81
  <Box
71
82
  css={{
72
83
  position: 'absolute',
73
- ...match({ isLandscapeStream, isMobileHLSStream, isChatEnabled })
84
+ ...match({ isLandscapeStream, isMobileHLSStream, isChatEnabled, isLocalPeerBlacklisted })
74
85
  .with(
75
86
  {
76
87
  isLandscapeStream: true,
@@ -96,6 +107,7 @@ export const Chat = () => {
96
107
  {
97
108
  isMobileHLSStream: true,
98
109
  isChatEnabled: true,
110
+ isLocalPeerBlacklisted: false,
99
111
  },
100
112
  () => ({ bottom: '$17', right: '$8' }),
101
113
  )
@@ -103,6 +115,14 @@ export const Chat = () => {
103
115
  {
104
116
  isLandscapeStream: false,
105
117
  isChatEnabled: true,
118
+ isLocalPeerBlacklisted: true,
119
+ },
120
+ () => ({ bottom: '$18', right: '$8' }),
121
+ )
122
+ .with(
123
+ {
124
+ isMobileHLSStream: true,
125
+ isLocalPeerBlacklisted: true,
106
126
  },
107
127
  () => ({ bottom: '$20', right: '$8' }),
108
128
  )
@@ -102,6 +102,19 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
102
102
  }
103
103
  }
104
104
  }, [defaultSelection, selectedPeer, selectedRole, setRoleSelector, isMobile, isLandscapeHLSStream, elements?.chat]);
105
+
106
+ const resetInputHeight = useCallback(() => {
107
+ if (inputRef.current) {
108
+ inputRef.current.style.height = `${Math.max(32, inputRef.current.value ? inputRef.current.scrollHeight : 0)}px`;
109
+ }
110
+ }, []);
111
+
112
+ const updateInputHeight = useCallback(() => {
113
+ if (inputRef.current) {
114
+ inputRef.current.style.height = `${Math.max(32, Math.min(inputRef.current.scrollHeight, 24 * 4))}px`;
115
+ }
116
+ }, []);
117
+
105
118
  const sendMessage = useCallback(async () => {
106
119
  const message = inputRef?.current?.value;
107
120
  if (!message || !message.trim().length) {
@@ -116,6 +129,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
116
129
  await hmsActions.sendBroadcastMessage(message);
117
130
  }
118
131
  inputRef.current.value = '';
132
+ resetInputHeight();
119
133
  setTimeout(() => {
120
134
  onSend(1);
121
135
  }, 0);
@@ -131,6 +145,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
131
145
  const messageElement = inputRef.current;
132
146
  if (messageElement) {
133
147
  messageElement.value = draftMessage;
148
+ updateInputHeight();
134
149
  }
135
150
  }, [draftMessage]);
136
151
 
@@ -197,11 +212,10 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
197
212
  {selection && (
198
213
  <Flex align="center" css={{ gap: '$4', w: '100%' }}>
199
214
  <Flex
200
- align="center"
215
+ align="end"
201
216
  css={{
202
217
  bg: isOverlayChat && isMobile ? '$surface_dim' : '$surface_default',
203
218
  minHeight: '$16',
204
- maxHeight: '$24',
205
219
  position: 'relative',
206
220
  py: '$6',
207
221
  pl: '$8',
@@ -238,6 +252,8 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
238
252
  }}
239
253
  autoComplete="off"
240
254
  aria-autocomplete="none"
255
+ onChange={updateInputHeight}
256
+ onBlur={resetInputHeight}
241
257
  onPaste={e => e.stopPropagation()}
242
258
  onCut={e => e.stopPropagation()}
243
259
  onCopy={e => e.stopPropagation()}
@@ -30,7 +30,7 @@ export const ChatPaused = () => {
30
30
  <Flex
31
31
  align="center"
32
32
  justify="between"
33
- css={{ borderRadius: '$1', bg: '$surface_default', p: '$4 $4 $4 $8', w: '100%' }}
33
+ css={{ borderRadius: '$1', bg: '$surface_default', p: '$2 $4 $2 $8', w: '100%' }}
34
34
  >
35
35
  <Box>
36
36
  <Text variant="sm" css={{ fontWeight: '$semiBold', color: '$on_surface_high' }}>
@@ -21,7 +21,11 @@ export const ChatToggle = ({ onClick }: { onClick?: () => void }) => {
21
21
  }}
22
22
  >
23
23
  <Tooltip key="chat" title={`${isChatOpen ? 'Close' : 'Open'} chat`}>
24
- <IconButton onClick={() => (onClick ? onClick() : toggleChat())} active={!isChatOpen} data-testid="chat_btn">
24
+ <IconButton
25
+ onClick={() => (onClick ? onClick() : toggleChat())}
26
+ css={{ bg: isChatOpen ? '$surface_brighter' : '' }}
27
+ data-testid="chat_btn"
28
+ >
25
29
  <ChatIcon />
26
30
  </IconButton>
27
31
  </Tooltip>
@@ -86,6 +86,7 @@ export const ParticipantList = ({
86
86
  return { ...filterValue };
87
87
  });
88
88
  }, []);
89
+
89
90
  if (peerCount === 0) {
90
91
  return null;
91
92
  }
@@ -128,7 +129,7 @@ export const ParticipantList = ({
128
129
  export const ParticipantCount = () => {
129
130
  const peerCount = useHMSStore(selectPeerCount);
130
131
  const toggleSidepane = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
131
- const isParticipantsOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.PARTICIPANTS);
132
+ const isPeerListOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.PARTICIPANTS);
132
133
 
133
134
  if (peerCount === 0) {
134
135
  return null;
@@ -139,13 +140,13 @@ export const ParticipantCount = () => {
139
140
  w: 'auto',
140
141
  p: '$4',
141
142
  h: 'auto',
143
+ bg: isPeerListOpen ? '$surface_brighter' : '',
142
144
  }}
143
145
  onClick={() => {
144
146
  if (peerCount > 0) {
145
147
  toggleSidepane();
146
148
  }
147
149
  }}
148
- active={!isParticipantsOpen}
149
150
  data-testid="participant_list"
150
151
  >
151
152
  <PeopleIcon />
@@ -447,6 +448,7 @@ export const ParticipantSearch = ({
447
448
  300,
448
449
  [value, onSearch],
449
450
  );
451
+
450
452
  return (
451
453
  <Flex
452
454
  align="center"
@@ -27,7 +27,7 @@ export const PollsToggle = () => {
27
27
  togglePollView();
28
28
  setUnreadPollQuiz(false);
29
29
  }}
30
- active={!isPollsOpen}
30
+ css={{ bg: isPollsOpen ? '$surface_brighter' : '' }}
31
31
  data-testid="polls_btn"
32
32
  >
33
33
  {unreadPollQuiz ? <QuizActiveIcon /> : <QuizIcon />}
@@ -152,18 +152,6 @@ const AddMenu = () => {
152
152
  Hide Vote Count
153
153
  </Text>
154
154
  </Flex>
155
- {/* <Flex align="center" css={{ mt: '$10' }}>
156
- <Switch onCheckedChange={value => setAnonymous(value)} css={{ mr: '$6' }} />
157
- <Text variant="body2" css={{ c: '$on_surface_medium' }}>
158
- Make Results Anonymous
159
- </Text>
160
- </Flex> */}
161
- {/* <Timer
162
- timer={timer}
163
- setTimer={setTimer}
164
- showTimerDropDown={showTimerDropDown}
165
- setShowTimerDropDown={setShowTimerDropDown}
166
- /> */}
167
155
 
168
156
  <Button
169
157
  variant="primary"
@@ -198,8 +186,8 @@ const PrevMenu = () => {
198
186
  const sortedPolls = useMemo(
199
187
  () =>
200
188
  polls
201
- ?.sort((a, b) => (b.createdAt?.getTime() || 0) - (a.createdAt?.getTime() || 0))
202
- ?.sort((a, b) => (b.state === 'started' ? 1 : 0) - (a.state === 'started' ? 1 : 0)),
189
+ ?.sort((a, b) => (b?.createdAt?.getTime?.() || 0) - (a?.createdAt?.getTime?.() || 0))
190
+ ?.sort((a, b) => (b?.state === 'started' ? 1 : 0) - (a?.state === 'started' ? 1 : 0)),
203
191
  [polls],
204
192
  );
205
193
  const permissions = useHMSStore(selectPermissions);
@@ -208,7 +196,6 @@ const PrevMenu = () => {
208
196
  const updatePolls = async () => {
209
197
  await hmsActions.interactivityCenter.getPolls();
210
198
  };
211
-
212
199
  updatePolls();
213
200
  }, [hmsActions.interactivityCenter]);
214
201
 
@@ -4,6 +4,8 @@ import { ChevronLeftIcon, ChevronRightIcon, CrossIcon } from '@100mslive/react-i
4
4
  import { Box, Flex } from '../../../../Layout';
5
5
  import { Loading } from '../../../../Loading';
6
6
  import { Text } from '../../../../Text';
7
+ // @ts-ignore
8
+ import { Container } from '../../Streaming/Common';
7
9
  import { LeaderboardEntry } from './LeaderboardEntry';
8
10
  import { PeerParticipationSummary } from './PeerParticipationSummary';
9
11
  // @ts-ignore
@@ -32,80 +34,83 @@ export const LeaderboardSummary = ({ pollID }: { pollID: string }) => {
32
34
  const questionCount = quiz.questions?.length || 0;
33
35
 
34
36
  return (
35
- <Flex direction="column" css={{ size: '100%' }}>
36
- <Flex justify="between" align="center" css={{ pb: '$6', borderBottom: '1px solid $border_bright', mb: '$8' }}>
37
- <Flex align="center" css={{ gap: '$4' }}>
37
+ <Container rounded>
38
+ <Flex direction="column" css={{ size: '100%', p: '$8' }}>
39
+ <Flex justify="between" align="center" css={{ pb: '$6', borderBottom: '1px solid $border_bright', mb: '$8' }}>
40
+ <Flex align="center" css={{ gap: '$4' }}>
41
+ <Flex
42
+ css={{ color: '$on_surface_medium', '&:hover': { color: '$on_surface_high', cursor: 'pointer' } }}
43
+ onClick={() => setPollView(POLL_VIEWS.VOTE)}
44
+ >
45
+ <ChevronLeftIcon />
46
+ </Flex>
47
+ <Text variant="lg" css={{ fontWeight: '$semiBold' }}>
48
+ {quiz.title}
49
+ </Text>
50
+ <StatusIndicator status={quiz.state} />
51
+ </Flex>
38
52
  <Flex
39
53
  css={{ color: '$on_surface_medium', '&:hover': { color: '$on_surface_high', cursor: 'pointer' } }}
40
- onClick={() => setPollView(POLL_VIEWS.VOTE)}
54
+ onClick={toggleSidepane}
41
55
  >
42
- <ChevronLeftIcon />
56
+ <CrossIcon />
43
57
  </Flex>
44
- <Text variant="lg" css={{ fontWeight: '$semiBold' }}>
45
- {quiz.title}
46
- </Text>
47
- <StatusIndicator status={quiz.state} />
48
58
  </Flex>
49
- <Flex
50
- css={{ color: '$on_surface_medium', '&:hover': { color: '$on_surface_high', cursor: 'pointer' } }}
51
- onClick={toggleSidepane}
52
- >
53
- <CrossIcon />
54
- </Flex>
55
- </Flex>
56
-
57
- {!viewAllEntries ? <PeerParticipationSummary quiz={quiz} /> : null}
59
+ <Box css={{ overflowY: 'auto', mr: '-$4', pr: '$4' }}>
60
+ {!viewAllEntries ? <PeerParticipationSummary quiz={quiz} /> : null}
58
61
 
59
- <Text variant="sm" css={{ fontWeight: '$semiBold', mt: '$4' }}>
60
- Leaderboard
61
- </Text>
62
- <Text variant="xs" css={{ color: '$on_surface_medium' }}>
63
- Based on score and time taken to cast the correct answer
64
- </Text>
65
- <Box
66
- css={{
67
- mt: '$8',
68
- overflowY: 'auto',
69
- flex: viewAllEntries ? '1 1 0' : 'unset',
70
- mr: viewAllEntries ? '-$6' : 'unset',
71
- px: viewAllEntries ? '0' : '$4',
72
- pr: viewAllEntries ? '$6' : '$4',
73
- backgroundColor: viewAllEntries ? '' : '$surface_default',
74
- borderRadius: '$1',
75
- }}
76
- >
77
- {quizLeaderboard?.entries &&
78
- quizLeaderboard.entries
79
- .slice(0, viewAllEntries ? undefined : 5)
80
- .map(question => (
81
- <LeaderboardEntry
82
- key={question.position}
83
- position={question.position}
84
- score={question.score}
85
- questionCount={questionCount}
86
- correctResponses={question.correctResponses}
87
- userName={question.peer.username || ''}
88
- maxPossibleScore={maxPossibleScore}
89
- duration={question.duration}
90
- />
91
- ))}
92
- {quizLeaderboard?.entries?.length > 5 && !viewAllEntries ? (
93
- <Flex
94
- align="center"
95
- justify="end"
62
+ <Text variant="sm" css={{ fontWeight: '$semiBold', mt: '$4' }}>
63
+ Leaderboard
64
+ </Text>
65
+ <Text variant="xs" css={{ color: '$on_surface_medium' }}>
66
+ Based on score and time taken to cast the correct answer
67
+ </Text>
68
+ <Box
96
69
  css={{
97
- w: '100%',
98
- borderTop: '1px solid $border_bright',
99
- cursor: 'pointer',
100
- color: '$on_surface_high',
101
- p: '$6 $2',
70
+ mt: '$8',
71
+ overflowY: 'auto',
72
+ flex: viewAllEntries ? '1 1 0' : 'unset',
73
+ mr: viewAllEntries ? '-$6' : 'unset',
74
+ px: viewAllEntries ? '0' : '$4',
75
+ pr: viewAllEntries ? '$6' : '$4',
76
+ backgroundColor: viewAllEntries ? '' : '$surface_default',
77
+ borderRadius: '$1',
102
78
  }}
103
- onClick={() => setViewAllEntries(true)}
104
79
  >
105
- <Text variant="sm">View All</Text> <ChevronRightIcon />
106
- </Flex>
107
- ) : null}
108
- </Box>
109
- </Flex>
80
+ {quizLeaderboard?.entries &&
81
+ quizLeaderboard.entries
82
+ .slice(0, viewAllEntries ? undefined : 5)
83
+ .map(question => (
84
+ <LeaderboardEntry
85
+ key={question.position}
86
+ position={question.position}
87
+ score={question.score}
88
+ questionCount={questionCount}
89
+ correctResponses={question.correctResponses}
90
+ userName={question.peer.username || ''}
91
+ maxPossibleScore={maxPossibleScore}
92
+ duration={question.duration}
93
+ />
94
+ ))}
95
+ {quizLeaderboard?.entries?.length > 5 && !viewAllEntries ? (
96
+ <Flex
97
+ align="center"
98
+ justify="end"
99
+ css={{
100
+ w: '100%',
101
+ borderTop: '1px solid $border_bright',
102
+ cursor: 'pointer',
103
+ color: '$on_surface_high',
104
+ p: '$6 $2',
105
+ }}
106
+ onClick={() => setViewAllEntries(true)}
107
+ >
108
+ <Text variant="sm">View All</Text> <ChevronRightIcon />
109
+ </Flex>
110
+ ) : null}
111
+ </Box>
112
+ </Box>
113
+ </Flex>
114
+ </Container>
110
115
  );
111
116
  };