@100mslive/roomkit-react 0.1.9-alpha.0 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,7 +146,7 @@ export function Notifications() {
146
146
 
147
147
  case HMSNotificationTypes.POLL_STARTED:
148
148
  if (notification.data.startedBy !== localPeerID) {
149
- const pollStartedBy = vanillaStore.getState(selectPeerNameByID(notification.data.startedBy));
149
+ const pollStartedBy = vanillaStore.getState(selectPeerNameByID(notification.data.startedBy)) || 'Participant';
150
150
  ToastManager.addToast({
151
151
  title: `${pollStartedBy} started a ${notification.data.type}: ${notification.data.title}`,
152
152
  action: (
@@ -172,7 +172,11 @@ const AddMenu = () => {
172
172
  };
173
173
 
174
174
  const PrevMenu = () => {
175
- const polls = useHMSStore(selectPolls)?.filter(poll => poll.state === 'started' || poll.state === 'stopped');
175
+ // filter polls that have been started or stopped sorted by when they were created and their live state
176
+ const polls = useHMSStore(selectPolls)
177
+ ?.filter(poll => poll.state === 'started' || poll.state === 'stopped')
178
+ .sort((a, b) => (b.createdAt?.getTime() || 0) - (a.createdAt?.getTime() || 0))
179
+ .sort((a, b) => (b.state === 'started' ? 1 : 0) - (a.state === 'started' ? 1 : 0));
176
180
  return polls?.length ? (
177
181
  <Flex
178
182
  css={{
@@ -204,7 +204,11 @@ export const QuestionForm = ({ question, index, length, onSave, removeQuestion,
204
204
  </Box>
205
205
  <Tooltip
206
206
  disabled={isValid}
207
- title={`Please fill all the fields ${isQuiz ? 'and mark the correct answer(s)' : ''} to continue`}
207
+ title={
208
+ options.length === 0
209
+ ? 'At least one option is required for a question'
210
+ : `Please fill all the fields ${isQuiz ? 'and mark the correct answer(s)' : ''} to continue`
211
+ }
208
212
  boxCss={{ maxWidth: '$40' }}
209
213
  >
210
214
  <Button
@@ -240,7 +244,7 @@ export const isValidQuestion = ({ text, type, options, isQuiz = false }) => {
240
244
  return true;
241
245
  }
242
246
 
243
- const everyOptionHasText = options.every(option => option && isValidTextInput(option.text, 1));
247
+ const everyOptionHasText = options.length > 0 && options.every(option => option && isValidTextInput(option.text, 1));
244
248
  const hasCorrectAnswer = options.some(option => option.isCorrectAnswer);
245
249
 
246
250
  if (!isQuiz) {
@@ -65,7 +65,7 @@ export const Voting = ({ id, toggleVoting }) => {
65
65
  </Box>
66
66
  </Flex>
67
67
 
68
- <Flex direction="column" css={{ p: '$8 $10' }}>
68
+ <Flex direction="column" css={{ p: '$8 $10', overflowY: 'auto' }}>
69
69
  <Flex align="center">
70
70
  <Box css={{ flex: 'auto' }}>
71
71
  <Text css={{ color: '$on_surface_medium', fontWeight: '$semiBold' }}>
@@ -10,14 +10,11 @@ export const useRedirectToLeave = () => {
10
10
 
11
11
  const redirect = useCallback(
12
12
  (timeout = 0) => {
13
- return new Promise<void>(resolve => {
14
- setTimeout(() => {
15
- PictureInPicture.stop().catch(() => console.error('stopping pip'));
16
- ToastManager.clearAllToast();
17
- onLeave?.();
18
- resolve();
19
- }, timeout);
20
- });
13
+ setTimeout(() => {
14
+ PictureInPicture.stop().catch(() => console.error('stopping pip'));
15
+ ToastManager.clearAllToast();
16
+ onLeave?.();
17
+ }, timeout);
21
18
  },
22
19
  [onLeave],
23
20
  );