@100mslive/react-native-room-kit 1.1.1 → 1.1.3

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 (255) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/HMSRoomSetup.js +15 -5
  3. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  4. package/lib/commonjs/Icons/Check/assets/check-in-circle.png +0 -0
  5. package/lib/commonjs/Icons/Check/assets/check-in-circle@2x.png +0 -0
  6. package/lib/commonjs/Icons/Check/assets/check-in-circle@3x.png +0 -0
  7. package/lib/commonjs/Icons/Check/index.js +2 -1
  8. package/lib/commonjs/Icons/Check/index.js.map +1 -1
  9. package/lib/commonjs/Icons/CheckBox/index.js +8 -1
  10. package/lib/commonjs/Icons/CheckBox/index.js.map +1 -1
  11. package/lib/commonjs/Icons/Clock/assets/clock-vector.png +0 -0
  12. package/lib/commonjs/Icons/Clock/assets/clock-vector@2x.png +0 -0
  13. package/lib/commonjs/Icons/Clock/assets/clock-vector@3x.png +0 -0
  14. package/lib/commonjs/Icons/Clock/assets/clock.png +0 -0
  15. package/lib/commonjs/Icons/Clock/assets/clock@2x.png +0 -0
  16. package/lib/commonjs/Icons/Clock/assets/clock@3x.png +0 -0
  17. package/lib/commonjs/Icons/Clock/index.js +7 -2
  18. package/lib/commonjs/Icons/Clock/index.js.map +1 -1
  19. package/lib/commonjs/components/CreatePoll.js +100 -53
  20. package/lib/commonjs/components/CreatePoll.js.map +1 -1
  21. package/lib/commonjs/components/GridView.js +4 -8
  22. package/lib/commonjs/components/GridView.js.map +1 -1
  23. package/lib/commonjs/components/HLSView.js +15 -1
  24. package/lib/commonjs/components/HLSView.js.map +1 -1
  25. package/lib/commonjs/components/HMSPollsQuizzesNotification.js +2 -2
  26. package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
  27. package/lib/commonjs/components/LeaderboardEntry.js +135 -0
  28. package/lib/commonjs/components/LeaderboardEntry.js.map +1 -0
  29. package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js +80 -32
  30. package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -1
  31. package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
  32. package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
  33. package/lib/commonjs/components/PollAndQuizSheetScreen.js +69 -0
  34. package/lib/commonjs/components/PollAndQuizSheetScreen.js.map +1 -0
  35. package/lib/commonjs/components/PollAndQuizVoting.js +145 -17
  36. package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
  37. package/lib/commonjs/components/PollQuestion.js +70 -14
  38. package/lib/commonjs/components/PollQuestion.js.map +1 -1
  39. package/lib/commonjs/components/PollQuestions.js +126 -12
  40. package/lib/commonjs/components/PollQuestions.js.map +1 -1
  41. package/lib/commonjs/components/PollsAndQuizBottomSheet.js +9 -11
  42. package/lib/commonjs/components/PollsAndQuizBottomSheet.js.map +1 -1
  43. package/lib/commonjs/components/PollsAndQuizzesCard.js +1 -1
  44. package/lib/commonjs/components/PollsAndQuizzesCard.js.map +1 -1
  45. package/lib/commonjs/components/PollsAndQuizzesModalContent.js +26 -120
  46. package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
  47. package/lib/commonjs/components/PollsConfigAndList.js +81 -4
  48. package/lib/commonjs/components/PollsConfigAndList.js.map +1 -1
  49. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +7 -15
  50. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
  51. package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
  52. package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
  53. package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js +284 -0
  54. package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js.map +1 -0
  55. package/lib/commonjs/components/QuizLeaderboardScreen.js +279 -0
  56. package/lib/commonjs/components/QuizLeaderboardScreen.js.map +1 -0
  57. package/lib/commonjs/components/QuizLeaderboardSummary.js +195 -0
  58. package/lib/commonjs/components/QuizLeaderboardSummary.js.map +1 -0
  59. package/lib/commonjs/components/RadioInput.js +9 -2
  60. package/lib/commonjs/components/RadioInput.js.map +1 -1
  61. package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
  62. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  63. package/lib/commonjs/components/TilesContainer.js +3 -4
  64. package/lib/commonjs/components/TilesContainer.js.map +1 -1
  65. package/lib/commonjs/components/VoterParticipationSummary.js +46 -0
  66. package/lib/commonjs/components/VoterParticipationSummary.js.map +1 -0
  67. package/lib/commonjs/hooks-util.js +1 -1
  68. package/lib/commonjs/hooks-util.js.map +1 -1
  69. package/lib/commonjs/redux/actionTypes.js +9 -1
  70. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  71. package/lib/commonjs/redux/actions/index.js +38 -5
  72. package/lib/commonjs/redux/actions/index.js.map +1 -1
  73. package/lib/commonjs/redux/reducers/polls.js +95 -8
  74. package/lib/commonjs/redux/reducers/polls.js.map +1 -1
  75. package/lib/commonjs/utils/functions.js +48 -3
  76. package/lib/commonjs/utils/functions.js.map +1 -1
  77. package/lib/commonjs/utils/hooks.js +107 -2
  78. package/lib/commonjs/utils/hooks.js.map +1 -1
  79. package/lib/module/HMSRoomSetup.js +16 -6
  80. package/lib/module/HMSRoomSetup.js.map +1 -1
  81. package/lib/module/Icons/Check/assets/check-in-circle.png +0 -0
  82. package/lib/module/Icons/Check/assets/check-in-circle@2x.png +0 -0
  83. package/lib/module/Icons/Check/assets/check-in-circle@3x.png +0 -0
  84. package/lib/module/Icons/Check/index.js +2 -1
  85. package/lib/module/Icons/Check/index.js.map +1 -1
  86. package/lib/module/Icons/CheckBox/index.js +9 -2
  87. package/lib/module/Icons/CheckBox/index.js.map +1 -1
  88. package/lib/module/Icons/Clock/assets/clock-vector.png +0 -0
  89. package/lib/module/Icons/Clock/assets/clock-vector@2x.png +0 -0
  90. package/lib/module/Icons/Clock/assets/clock-vector@3x.png +0 -0
  91. package/lib/module/Icons/Clock/assets/clock.png +0 -0
  92. package/lib/module/Icons/Clock/assets/clock@2x.png +0 -0
  93. package/lib/module/Icons/Clock/assets/clock@3x.png +0 -0
  94. package/lib/module/Icons/Clock/index.js +7 -2
  95. package/lib/module/Icons/Clock/index.js.map +1 -1
  96. package/lib/module/components/CreatePoll.js +102 -56
  97. package/lib/module/components/CreatePoll.js.map +1 -1
  98. package/lib/module/components/GridView.js +5 -9
  99. package/lib/module/components/GridView.js.map +1 -1
  100. package/lib/module/components/HLSView.js +17 -3
  101. package/lib/module/components/HLSView.js.map +1 -1
  102. package/lib/module/components/HMSPollsQuizzesNotification.js +3 -3
  103. package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
  104. package/lib/module/components/LeaderboardEntry.js +126 -0
  105. package/lib/module/components/LeaderboardEntry.js.map +1 -0
  106. package/lib/module/components/PollAndQuizQuestionResponseCard.js +81 -33
  107. package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -1
  108. package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
  109. package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
  110. package/lib/module/components/PollAndQuizSheetScreen.js +60 -0
  111. package/lib/module/components/PollAndQuizSheetScreen.js.map +1 -0
  112. package/lib/module/components/PollAndQuizVoting.js +148 -20
  113. package/lib/module/components/PollAndQuizVoting.js.map +1 -1
  114. package/lib/module/components/PollQuestion.js +73 -17
  115. package/lib/module/components/PollQuestion.js.map +1 -1
  116. package/lib/module/components/PollQuestions.js +129 -15
  117. package/lib/module/components/PollQuestions.js.map +1 -1
  118. package/lib/module/components/PollsAndQuizBottomSheet.js +11 -13
  119. package/lib/module/components/PollsAndQuizBottomSheet.js.map +1 -1
  120. package/lib/module/components/PollsAndQuizzesCard.js +2 -2
  121. package/lib/module/components/PollsAndQuizzesCard.js.map +1 -1
  122. package/lib/module/components/PollsAndQuizzesModalContent.js +28 -122
  123. package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
  124. package/lib/module/components/PollsConfigAndList.js +82 -5
  125. package/lib/module/components/PollsConfigAndList.js.map +1 -1
  126. package/lib/module/components/PreviousPollsAndQuizzesList.js +7 -15
  127. package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
  128. package/lib/module/components/QuizEndOptionsView.js +54 -0
  129. package/lib/module/components/QuizEndOptionsView.js.map +1 -0
  130. package/lib/module/components/QuizLeaderboardEntriesScreen.js +275 -0
  131. package/lib/module/components/QuizLeaderboardEntriesScreen.js.map +1 -0
  132. package/lib/module/components/QuizLeaderboardScreen.js +270 -0
  133. package/lib/module/components/QuizLeaderboardScreen.js.map +1 -0
  134. package/lib/module/components/QuizLeaderboardSummary.js +186 -0
  135. package/lib/module/components/QuizLeaderboardSummary.js.map +1 -0
  136. package/lib/module/components/RadioInput.js +10 -3
  137. package/lib/module/components/RadioInput.js.map +1 -1
  138. package/lib/module/components/RoomSettingsModalContent.js +1 -1
  139. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  140. package/lib/module/components/TilesContainer.js +5 -6
  141. package/lib/module/components/TilesContainer.js.map +1 -1
  142. package/lib/module/components/VoterParticipationSummary.js +37 -0
  143. package/lib/module/components/VoterParticipationSummary.js.map +1 -0
  144. package/lib/module/hooks-util.js +2 -4
  145. package/lib/module/hooks-util.js.map +1 -1
  146. package/lib/module/redux/actionTypes.js +9 -1
  147. package/lib/module/redux/actionTypes.js.map +1 -1
  148. package/lib/module/redux/actions/index.js +29 -3
  149. package/lib/module/redux/actions/index.js.map +1 -1
  150. package/lib/module/redux/reducers/polls.js +96 -9
  151. package/lib/module/redux/reducers/polls.js.map +1 -1
  152. package/lib/module/utils/functions.js +43 -3
  153. package/lib/module/utils/functions.js.map +1 -1
  154. package/lib/module/utils/hooks.js +105 -2
  155. package/lib/module/utils/hooks.js.map +1 -1
  156. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  157. package/lib/typescript/Icons/Check/index.d.ts +1 -0
  158. package/lib/typescript/Icons/Check/index.d.ts.map +1 -1
  159. package/lib/typescript/Icons/CheckBox/index.d.ts +1 -0
  160. package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -1
  161. package/lib/typescript/Icons/Clock/index.d.ts +1 -0
  162. package/lib/typescript/Icons/Clock/index.d.ts.map +1 -1
  163. package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
  164. package/lib/typescript/components/GridView.d.ts.map +1 -1
  165. package/lib/typescript/components/HLSView.d.ts.map +1 -1
  166. package/lib/typescript/components/LeaderboardEntry.d.ts +11 -0
  167. package/lib/typescript/components/LeaderboardEntry.d.ts.map +1 -0
  168. package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -1
  169. package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
  170. package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
  171. package/lib/typescript/components/PollAndQuizSheetScreen.d.ts +8 -0
  172. package/lib/typescript/components/PollAndQuizSheetScreen.d.ts.map +1 -0
  173. package/lib/typescript/components/PollAndQuizVoting.d.ts +2 -0
  174. package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
  175. package/lib/typescript/components/PollQuestion.d.ts +1 -0
  176. package/lib/typescript/components/PollQuestion.d.ts.map +1 -1
  177. package/lib/typescript/components/PollQuestions.d.ts +2 -0
  178. package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
  179. package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts.map +1 -1
  180. package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts +0 -1
  181. package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts.map +1 -1
  182. package/lib/typescript/components/PollsConfigAndList.d.ts +1 -0
  183. package/lib/typescript/components/PollsConfigAndList.d.ts.map +1 -1
  184. package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts.map +1 -1
  185. package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
  186. package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
  187. package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts +8 -0
  188. package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts.map +1 -0
  189. package/lib/typescript/components/QuizLeaderboardScreen.d.ts +8 -0
  190. package/lib/typescript/components/QuizLeaderboardScreen.d.ts.map +1 -0
  191. package/lib/typescript/components/QuizLeaderboardSummary.d.ts +9 -0
  192. package/lib/typescript/components/QuizLeaderboardSummary.d.ts.map +1 -0
  193. package/lib/typescript/components/RadioInput.d.ts +1 -0
  194. package/lib/typescript/components/RadioInput.d.ts.map +1 -1
  195. package/lib/typescript/components/VoterParticipationSummary.d.ts +7 -0
  196. package/lib/typescript/components/VoterParticipationSummary.d.ts.map +1 -0
  197. package/lib/typescript/hooks-util.d.ts.map +1 -1
  198. package/lib/typescript/redux/actionTypes.d.ts +45 -9
  199. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  200. package/lib/typescript/redux/actions/index.d.ts +8 -2
  201. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  202. package/lib/typescript/redux/index.d.ts +2 -1
  203. package/lib/typescript/redux/index.d.ts.map +1 -1
  204. package/lib/typescript/redux/reducers/index.d.ts +2 -1
  205. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  206. package/lib/typescript/redux/reducers/polls.d.ts +3 -2
  207. package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
  208. package/lib/typescript/utils/functions.d.ts +6 -2
  209. package/lib/typescript/utils/functions.d.ts.map +1 -1
  210. package/lib/typescript/utils/hooks.d.ts +6 -0
  211. package/lib/typescript/utils/hooks.d.ts.map +1 -1
  212. package/package.json +3 -3
  213. package/src/HMSRoomSetup.tsx +25 -6
  214. package/src/Icons/Check/assets/check-in-circle.png +0 -0
  215. package/src/Icons/Check/assets/check-in-circle@2x.png +0 -0
  216. package/src/Icons/Check/assets/check-in-circle@3x.png +0 -0
  217. package/src/Icons/Check/index.tsx +9 -2
  218. package/src/Icons/CheckBox/index.tsx +16 -2
  219. package/src/Icons/Clock/assets/clock-vector.png +0 -0
  220. package/src/Icons/Clock/assets/clock-vector@2x.png +0 -0
  221. package/src/Icons/Clock/assets/clock-vector@3x.png +0 -0
  222. package/src/Icons/Clock/assets/clock.png +0 -0
  223. package/src/Icons/Clock/assets/clock@2x.png +0 -0
  224. package/src/Icons/Clock/assets/clock@3x.png +0 -0
  225. package/src/Icons/Clock/index.tsx +16 -3
  226. package/src/components/CreatePoll.tsx +150 -72
  227. package/src/components/GridView.tsx +4 -14
  228. package/src/components/HLSView.tsx +27 -1
  229. package/src/components/HMSPollsQuizzesNotification.tsx +3 -3
  230. package/src/components/LeaderboardEntry.tsx +172 -0
  231. package/src/components/PollAndQuizQuestionResponseCard.tsx +151 -48
  232. package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
  233. package/src/components/PollAndQuizSheetScreen.tsx +85 -0
  234. package/src/components/PollAndQuizVoting.tsx +206 -28
  235. package/src/components/PollQuestion.tsx +140 -25
  236. package/src/components/PollQuestions.tsx +214 -74
  237. package/src/components/PollsAndQuizBottomSheet.tsx +20 -42
  238. package/src/components/PollsAndQuizzesCard.tsx +2 -2
  239. package/src/components/PollsAndQuizzesModalContent.tsx +40 -163
  240. package/src/components/PollsConfigAndList.tsx +107 -11
  241. package/src/components/PreviousPollsAndQuizzesList.tsx +33 -40
  242. package/src/components/QuizEndOptionsView.tsx +71 -0
  243. package/src/components/QuizLeaderboardEntriesScreen.tsx +323 -0
  244. package/src/components/QuizLeaderboardScreen.tsx +342 -0
  245. package/src/components/QuizLeaderboardSummary.tsx +207 -0
  246. package/src/components/RadioInput.tsx +14 -2
  247. package/src/components/RoomSettingsModalContent.tsx +1 -1
  248. package/src/components/TilesContainer.tsx +4 -4
  249. package/src/components/VoterParticipationSummary.tsx +67 -0
  250. package/src/hooks-util.ts +1 -3
  251. package/src/redux/actionTypes.ts +56 -6
  252. package/src/redux/actions/index.ts +56 -6
  253. package/src/redux/reducers/polls.ts +139 -11
  254. package/src/utils/functions.ts +90 -6
  255. package/src/utils/hooks.ts +190 -3
@@ -1,62 +1,27 @@
1
1
  import * as React from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- TouchableOpacity,
7
- Keyboard,
8
- } from 'react-native';
9
- import { useDispatch, useSelector } from 'react-redux';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import { useSelector } from 'react-redux';
10
4
 
11
5
  import type { RootState } from '../redux';
12
- import { useHMSRoomStyleSheet } from '../hooks-util';
13
- import { BottomSheet } from './BottomSheet';
14
- import { ChevronIcon, CloseIcon } from '../Icons';
15
- import { TestIds } from '../utils/constants';
16
6
  import { PollQuestions } from './PollQuestions';
17
7
  import { CreatePollStages } from '../redux/actionTypes';
18
- import { setPollStage } from '../redux/actions';
19
- import { PollQDeleteConfirmationSheetView } from './PollQDeleteConfirmationSheetView';
20
8
  import { PollsConfigAndList } from './PollsConfigAndList';
21
9
  import { PollAndQuizVoting } from './PollAndQuizVoting';
22
- import { PollAndQuizzStateLabel } from './PollAndQuizzStateLabel';
10
+ import { PollAndQuizSheetScreen } from './PollAndQuizSheetScreen';
11
+ import { QuizLeaderboardScreen } from './QuizLeaderboardScreen';
12
+ import { QuizLeaderboardEntriesScreen } from './QuizLeaderboardEntriesScreen';
23
13
 
24
14
  export interface PollsAndQuizzesModalContentProps {
25
- fullHeight: boolean;
26
15
  dismissModal(): void;
27
16
  }
28
17
 
29
18
  export const PollsAndQuizzesModalContent: React.FC<
30
19
  PollsAndQuizzesModalContentProps
31
- > = ({ fullHeight, dismissModal }) => {
32
- const dispatch = useDispatch();
33
- const headerTitle = useSelector((state: RootState) => {
34
- const pollsData = state.polls;
35
- if (pollsData.stage === CreatePollStages.POLL_QUESTION_CONFIG) {
36
- return pollsData.pollName;
37
- }
38
- if (
39
- pollsData.stage === CreatePollStages.POLL_VOTING &&
40
- pollsData.selectedPollId !== null
41
- ) {
42
- return pollsData.polls[pollsData.selectedPollId]?.title || null;
43
- }
44
- return null;
45
- });
46
- const selectedPoll = useSelector((state: RootState) => {
47
- const pollsData = state.polls;
48
- if (
49
- pollsData.stage === CreatePollStages.POLL_VOTING &&
50
- pollsData.selectedPollId !== null
51
- ) {
52
- return pollsData.polls[pollsData.selectedPollId] || null;
53
- }
54
- return null;
55
- });
56
- const pollsStage = useSelector((state: RootState) => state.polls.stage);
57
- const launchingPoll = useSelector(
58
- (state: RootState) => state.polls.launchingPoll
20
+ > = ({ dismissModal }) => {
21
+ const pollsNavigationStack = useSelector(
22
+ (state: RootState) => state.polls.navigationStack
59
23
  );
24
+
60
25
  const canCreateOrEndPoll = useSelector((state: RootState) => {
61
26
  const permissions = state.hmsStates.localPeer?.role?.permissions;
62
27
  return permissions?.pollWrite;
@@ -66,133 +31,45 @@ export const PollsAndQuizzesModalContent: React.FC<
66
31
  return permissions?.pollRead;
67
32
  });
68
33
 
69
- const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
70
- headerText: {
71
- color: theme.palette.on_surface_high,
72
- fontFamily: `${typography.font_family}-SemiBold`,
73
- },
74
- }));
75
-
76
- const handleBackPress = () => {
77
- Keyboard.dismiss();
78
- dispatch(setPollStage(CreatePollStages.POLL_CONFIG));
79
- };
80
-
81
- const handleClosePress = () => {
82
- Keyboard.dismiss();
83
- dismissModal();
84
- };
85
-
86
34
  return (
87
- <View style={fullHeight ? styles.fullView : null}>
88
- {/* Header */}
89
- <View style={styles.header}>
90
- <View style={styles.headerControls}>
91
- {headerTitle ? (
92
- <TouchableOpacity
93
- onPress={handleBackPress}
94
- disabled={launchingPoll}
95
- hitSlop={styles.closeIconHitSlop}
96
- style={[styles.backIcon, launchingPoll ? { opacity: 0.4 } : null]}
97
- >
98
- <ChevronIcon direction="left" />
99
- </TouchableOpacity>
100
- ) : null}
101
-
102
- <Text
103
- testID={TestIds.change_name_modal_heading}
104
- numberOfLines={2}
105
- style={[
106
- styles.headerText,
107
- { flexShrink: 1 },
108
- hmsRoomStyles.headerText,
109
- ]}
110
- >
111
- {headerTitle ?? ('Polls' || 'Polls and Quizzes')}
112
- </Text>
113
-
114
- {selectedPoll?.state ? (
115
- <PollAndQuizzStateLabel state={selectedPoll?.state} />
116
- ) : null}
117
- </View>
118
-
119
- <TouchableOpacity
120
- testID={TestIds.change_name_modal_close_btn}
121
- onPress={handleClosePress}
122
- hitSlop={styles.closeIconHitSlop}
123
- style={{ marginLeft: 16 }}
35
+ <View style={[styles.relative, styles.fullView]}>
36
+ {pollsNavigationStack.map((stage, index) => (
37
+ <PollAndQuizSheetScreen
38
+ key={stage}
39
+ zIndex={index}
40
+ disableAnimation={index === 0}
124
41
  >
125
- <CloseIcon />
126
- </TouchableOpacity>
127
- </View>
128
-
129
- {/* Divider */}
130
- <BottomSheet.Divider
131
- style={fullHeight ? styles.halfDivider : styles.divider}
132
- />
133
-
134
- {/* Content */}
135
- <View style={fullHeight ? styles.fullView : null}>
136
- {pollsStage === CreatePollStages.POLL_CONFIG ? (
137
- <PollsConfigAndList />
138
- ) : pollsStage === CreatePollStages.POLL_QUESTION_CONFIG &&
139
- canCreateOrEndPoll ? (
140
- <PollQuestions dismissModal={dismissModal} />
141
- ) : pollsStage === CreatePollStages.POLL_VOTING &&
142
- (canVoteOnPoll || canCreateOrEndPoll) ? (
143
- <PollAndQuizVoting dismissModal={dismissModal} />
144
- ) : null}
145
- </View>
146
-
147
- {/* Modal */}
148
- <PollQDeleteConfirmationSheetView />
42
+ {stage === CreatePollStages.POLL_CONFIG ? (
43
+ <PollsConfigAndList dismissModal={dismissModal} />
44
+ ) : stage === CreatePollStages.POLL_QUESTION_CONFIG &&
45
+ canCreateOrEndPoll ? (
46
+ <PollQuestions currentIdx={index} dismissModal={dismissModal} />
47
+ ) : stage === CreatePollStages.POLL_VOTING &&
48
+ (canVoteOnPoll || canCreateOrEndPoll) ? (
49
+ <PollAndQuizVoting currentIdx={index} dismissModal={dismissModal} />
50
+ ) : stage === CreatePollStages.QUIZ_LEADERBOARD ? (
51
+ <QuizLeaderboardScreen
52
+ currentIdx={index}
53
+ dismissModal={dismissModal}
54
+ />
55
+ ) : stage === CreatePollStages.QUIZ_LEADERBOARD_ENTRIES ? (
56
+ <QuizLeaderboardEntriesScreen
57
+ currentIdx={index}
58
+ dismissModal={dismissModal}
59
+ />
60
+ ) : null}
61
+ </PollAndQuizSheetScreen>
62
+ ))}
149
63
  </View>
150
64
  );
151
65
  };
152
66
 
153
67
  const styles = StyleSheet.create({
154
- // Utilities
68
+ relative: {
69
+ position: 'relative',
70
+ overflow: 'hidden',
71
+ },
155
72
  fullView: {
156
73
  flex: 1,
157
74
  },
158
- // Header
159
- header: {
160
- flexDirection: 'row',
161
- alignItems: 'center',
162
- justifyContent: 'space-between',
163
- marginTop: 24,
164
- marginHorizontal: 24,
165
- },
166
- headerControls: {
167
- flexDirection: 'row',
168
- alignItems: 'center',
169
- flexShrink: 1,
170
- },
171
- headerText: {
172
- fontSize: 20,
173
- lineHeight: 24,
174
- letterSpacing: 0.15,
175
- marginRight: 12,
176
- },
177
- closeIconHitSlop: {
178
- bottom: 16,
179
- left: 16,
180
- right: 16,
181
- top: 16,
182
- },
183
- backIcon: {
184
- marginRight: 8,
185
- },
186
- // Divider
187
- halfDivider: {
188
- marginHorizontal: 24,
189
- marginVertical: 0,
190
- marginTop: 24,
191
- width: undefined,
192
- },
193
- divider: {
194
- marginHorizontal: 24,
195
- marginVertical: 24,
196
- width: undefined,
197
- },
198
75
  });
@@ -1,14 +1,38 @@
1
1
  import * as React from 'react';
2
- import { ScrollView } from 'react-native';
2
+ import {
3
+ Keyboard,
4
+ ScrollView,
5
+ StyleSheet,
6
+ Text,
7
+ TouchableOpacity,
8
+ View,
9
+ } from 'react-native';
10
+ import { useSelector } from 'react-redux';
3
11
 
4
12
  import { CreatePoll } from './CreatePoll';
5
13
  import { PreviousPollsAndQuizzesList } from './PreviousPollsAndQuizzesList';
6
- import { useSelector } from 'react-redux';
7
- import type { RootState } from 'src/redux';
14
+ import type { RootState } from '../redux';
15
+ import { BottomSheet } from './BottomSheet';
16
+ import { CloseIcon } from '../Icons';
17
+ import { useHMSRoomStyleSheet } from '../hooks-util';
8
18
 
9
- export interface PollsConfigAndListProps {}
19
+ export interface PollsConfigAndListProps {
20
+ dismissModal(): void;
21
+ }
22
+
23
+ export const PollsConfigAndList: React.FC<PollsConfigAndListProps> = ({
24
+ dismissModal,
25
+ }) => {
26
+ const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
27
+ container: {
28
+ backgroundColor: theme.palette.surface_dim,
29
+ },
30
+ headerText: {
31
+ color: theme.palette.on_surface_high,
32
+ fontFamily: `${typography.font_family}-SemiBold`,
33
+ },
34
+ }));
10
35
 
11
- export const PollsConfigAndList: React.FC<PollsConfigAndListProps> = ({}) => {
12
36
  const canCreateOrEndPoll = useSelector((state: RootState) => {
13
37
  const permissions = state.hmsStates.localPeer?.role?.permissions;
14
38
  return permissions?.pollWrite;
@@ -18,12 +42,84 @@ export const PollsConfigAndList: React.FC<PollsConfigAndListProps> = ({}) => {
18
42
  return permissions?.pollRead;
19
43
  });
20
44
 
45
+ const handleClosePress = () => {
46
+ Keyboard.dismiss();
47
+ dismissModal();
48
+ };
49
+
21
50
  return (
22
- <ScrollView contentContainerStyle={{ paddingBottom: 24 }}>
23
- {canCreateOrEndPoll ? <CreatePoll /> : null}
24
- {canVoteOnPoll || canCreateOrEndPoll ? (
25
- <PreviousPollsAndQuizzesList />
26
- ) : null}
27
- </ScrollView>
51
+ <View style={hmsRoomStyles.container}>
52
+ {/* Header */}
53
+ <View style={styles.header}>
54
+ <Text style={[styles.headerText, hmsRoomStyles.headerText]}>
55
+ Polls and Quizzes
56
+ </Text>
57
+
58
+ <TouchableOpacity
59
+ onPress={handleClosePress}
60
+ hitSlop={styles.closeIconHitSlop}
61
+ style={{ marginLeft: 16 }}
62
+ >
63
+ <CloseIcon />
64
+ </TouchableOpacity>
65
+ </View>
66
+
67
+ {/* Divider */}
68
+ <BottomSheet.Divider style={styles.halfDivider} />
69
+
70
+ {/* Content */}
71
+ <ScrollView contentContainerStyle={{ paddingBottom: 24 }}>
72
+ {canCreateOrEndPoll ? <CreatePoll /> : null}
73
+ {canVoteOnPoll || canCreateOrEndPoll ? (
74
+ <PreviousPollsAndQuizzesList />
75
+ ) : null}
76
+ </ScrollView>
77
+ </View>
28
78
  );
29
79
  };
80
+
81
+ const styles = StyleSheet.create({
82
+ // Utilities
83
+ fullView: {
84
+ flex: 1,
85
+ },
86
+ // Header
87
+ header: {
88
+ flexDirection: 'row',
89
+ alignItems: 'center',
90
+ justifyContent: 'space-between',
91
+ marginTop: 24,
92
+ marginHorizontal: 24,
93
+ },
94
+ headerControls: {
95
+ flexDirection: 'row',
96
+ alignItems: 'center',
97
+ flexShrink: 1,
98
+ },
99
+ headerText: {
100
+ fontSize: 20,
101
+ lineHeight: 24,
102
+ letterSpacing: 0.15,
103
+ },
104
+ closeIconHitSlop: {
105
+ bottom: 16,
106
+ left: 16,
107
+ right: 16,
108
+ top: 16,
109
+ },
110
+ backIcon: {
111
+ marginRight: 8,
112
+ },
113
+ // Divider
114
+ halfDivider: {
115
+ marginHorizontal: 24,
116
+ // marginVertical: 0,
117
+ // marginTop: 24,
118
+ width: undefined,
119
+ },
120
+ divider: {
121
+ marginHorizontal: 24,
122
+ marginVertical: 24,
123
+ width: undefined,
124
+ },
125
+ });
@@ -18,11 +18,6 @@ export const PreviousPollsAndQuizzesList: React.FC<
18
18
  (state: RootState) => state.polls.cuedPollIds
19
19
  );
20
20
 
21
- const canCreateOrEndPoll = useSelector((state: RootState) => {
22
- const permissions = state.hmsStates.localPeer?.role?.permissions;
23
- return permissions?.pollWrite;
24
- });
25
-
26
21
  const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
27
22
  surfaceHighSemiBoldText: {
28
23
  color: theme.palette.on_surface_high,
@@ -40,44 +35,42 @@ export const PreviousPollsAndQuizzesList: React.FC<
40
35
  hlsCuedPollIds
41
36
  );
42
37
 
43
- if (pollsList.length === 0 && !canCreateOrEndPoll) {
44
- return (
45
- <View style={styles.contentContainer}>
46
- <Text
47
- style={[
48
- styles.subtitle,
49
- hmsRoomStyles.surfaceHighRegularText,
50
- styles.emptyList,
51
- ]}
52
- >
53
- No Polls to show
54
- </Text>
55
- </View>
56
- );
57
- }
58
-
59
38
  return (
60
39
  <View style={styles.contentContainer}>
61
- {pollsList.length > 0 && (
62
- <Text style={[styles.title, hmsRoomStyles.surfaceHighSemiBoldText]}>
63
- Previous Polls
64
- </Text>
65
- )}
40
+ <Text style={[styles.title, hmsRoomStyles.surfaceHighSemiBoldText]}>
41
+ Previous Polls And Quizzes
42
+ </Text>
66
43
 
67
- {pollsList
68
- .sort((a, b) => {
69
- return a.state === b.state // If polls have same state, then sort as per startedAt
70
- ? a.startedAt !== undefined && b.startedAt !== undefined
71
- ? b.startedAt.getTime() - a.startedAt.getTime()
72
- : 0
73
- : // If polls have different state, then sort as per state
74
- a.state !== undefined && b.state !== undefined
75
- ? a.state - b.state
76
- : 0;
77
- })
78
- .map((poll) => (
79
- <PollsAndQuizzesCard key={poll.pollId} poll={poll} />
80
- ))}
44
+ {pollsList.length <= 0 ? (
45
+ <View style={styles.contentContainer}>
46
+ <Text
47
+ style={[
48
+ styles.subtitle,
49
+ hmsRoomStyles.surfaceHighRegularText,
50
+ styles.emptyList,
51
+ ]}
52
+ >
53
+ No Polls or Quizzes to show
54
+ </Text>
55
+ </View>
56
+ ) : (
57
+ <>
58
+ {pollsList
59
+ .sort((a, b) => {
60
+ return a.state === b.state // If polls have same state, then sort as per startedAt
61
+ ? a.startedAt !== undefined && b.startedAt !== undefined
62
+ ? b.startedAt.getTime() - a.startedAt.getTime()
63
+ : 0
64
+ : // If polls have different state, then sort as per state
65
+ a.state !== undefined && b.state !== undefined
66
+ ? a.state - b.state
67
+ : 0;
68
+ })
69
+ .map((poll) => (
70
+ <PollsAndQuizzesCard key={poll.pollId} poll={poll} />
71
+ ))}
72
+ </>
73
+ )}
81
74
  </View>
82
75
  );
83
76
  };
@@ -0,0 +1,71 @@
1
+ import * as React from 'react';
2
+ import type { HMSPollQuestionOption } from '@100mslive/react-native-hms';
3
+ import { StyleSheet, Text, View } from 'react-native';
4
+
5
+ import { useHMSRoomStyleSheet } from '../hooks-util';
6
+ import { CheckIcon } from '../Icons';
7
+
8
+ interface QuizEndOptionsViewProps {
9
+ option: HMSPollQuestionOption;
10
+ isSelected: boolean;
11
+ isCorrect: boolean;
12
+ }
13
+
14
+ export const QuizEndOptionsView: React.FC<QuizEndOptionsViewProps> = ({
15
+ option,
16
+ isSelected,
17
+ isCorrect,
18
+ }) => {
19
+ const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
20
+ surfaceHighRegularText: {
21
+ color: theme.palette.on_surface_high,
22
+ fontFamily: `${typography.font_family}-Regular`,
23
+ },
24
+ surfaceMediumRegularText: {
25
+ color: theme.palette.on_surface_medium,
26
+ fontFamily: `${typography.font_family}-Regular`,
27
+ },
28
+ }));
29
+
30
+ return (
31
+ <View style={styles.container}>
32
+ <View style={styles.textWrapper}>
33
+ {isCorrect ? <CheckIcon style={styles.icon} type="in-circle" /> : null}
34
+
35
+ <Text style={[styles.smallText, hmsRoomStyles.surfaceHighRegularText]}>
36
+ {option.text}
37
+ </Text>
38
+ </View>
39
+
40
+ {isSelected ? (
41
+ <Text
42
+ style={[styles.smallText, hmsRoomStyles.surfaceMediumRegularText]}
43
+ >
44
+ Your Answer
45
+ </Text>
46
+ ) : null}
47
+ </View>
48
+ );
49
+ };
50
+
51
+ const styles = StyleSheet.create({
52
+ container: {
53
+ marginBottom: 16,
54
+ flexDirection: 'row',
55
+ alignItems: 'center',
56
+ justifyContent: 'space-between',
57
+ },
58
+ textWrapper: {
59
+ flexDirection: 'row',
60
+ alignItems: 'center',
61
+ },
62
+ icon: {
63
+ width: 20,
64
+ height: 20,
65
+ marginRight: 8,
66
+ },
67
+ smallText: {
68
+ fontSize: 14,
69
+ lineHeight: 20,
70
+ },
71
+ });