@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
@@ -0,0 +1,207 @@
1
+ import * as React from 'react';
2
+ import { Text, StyleSheet, View } from 'react-native';
3
+
4
+ import { useHMSRoomStyleSheet } from '../hooks-util';
5
+
6
+ export interface QuizLeaderboardSummaryProps {
7
+ data: { label: string; value: any }[][];
8
+ }
9
+
10
+ export const QuizLeaderboardSummary: React.FC<QuizLeaderboardSummaryProps> = ({
11
+ data,
12
+ }) => {
13
+ const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
14
+ regularHighText: {
15
+ color: theme.palette.on_surface_high,
16
+ fontFamily: `${typography.font_family}-Regular`,
17
+ },
18
+ regularMediumText: {
19
+ color: theme.palette.on_surface_medium,
20
+ fontFamily: `${typography.font_family}-Regular`,
21
+ },
22
+ semiBoldMediumText: {
23
+ color: theme.palette.on_surface_medium,
24
+ fontFamily: `${typography.font_family}-SemiBold`,
25
+ },
26
+ semiBoldHighText: {
27
+ color: theme.palette.on_surface_high,
28
+ fontFamily: `${typography.font_family}-SemiBold`,
29
+ },
30
+ headerText: {
31
+ color: theme.palette.on_surface_high,
32
+ fontFamily: `${typography.font_family}-SemiBold`,
33
+ },
34
+ container: {
35
+ backgroundColor: theme.palette.surface_dim,
36
+ },
37
+ summaryContainer: {
38
+ backgroundColor: theme.palette.surface_default,
39
+ },
40
+ entriesCard: {
41
+ backgroundColor: theme.palette.surface_default,
42
+ },
43
+ divider: {
44
+ backgroundColor: theme.palette.border_bright,
45
+ },
46
+ }));
47
+
48
+ return (
49
+ <View style={{}}>
50
+ <Text
51
+ style={[
52
+ styles.normalText,
53
+ styles.marginBottom16,
54
+ hmsRoomStyles.semiBoldHighText,
55
+ ]}
56
+ >
57
+ Participation Summary
58
+ </Text>
59
+
60
+ <View style={styles.marginBottom16}>
61
+ {data.map((summaryMap, index) => (
62
+ <View key={index} style={{ marginBottom: 8, flexDirection: 'row' }}>
63
+ {summaryMap.map((summary, index) => (
64
+ <React.Fragment key={summary.label}>
65
+ {index > 0 ? <View style={{ width: 8 }} /> : null}
66
+
67
+ <View
68
+ style={[
69
+ styles.summaryWrapper,
70
+ hmsRoomStyles.summaryContainer,
71
+ ]}
72
+ >
73
+ <Text
74
+ style={[
75
+ styles.tinyText,
76
+ styles.marginBottom8,
77
+ hmsRoomStyles.semiBoldMediumText,
78
+ ]}
79
+ >
80
+ {summary.label}
81
+ </Text>
82
+
83
+ <Text
84
+ style={[styles.normalText, hmsRoomStyles.semiBoldHighText]}
85
+ >
86
+ {summary.value}
87
+ </Text>
88
+ </View>
89
+ </React.Fragment>
90
+ ))}
91
+ </View>
92
+ ))}
93
+ </View>
94
+ </View>
95
+ );
96
+ };
97
+
98
+ const styles = StyleSheet.create({
99
+ tinyText: {
100
+ fontSize: 10,
101
+ lineHeight: 16,
102
+ letterSpacing: 1.5,
103
+ },
104
+ smallerText: {
105
+ fontSize: 12,
106
+ lineHeight: 16,
107
+ },
108
+ smallText: {
109
+ fontSize: 14,
110
+ lineHeight: 20,
111
+ },
112
+ normalText: {
113
+ fontSize: 16,
114
+ lineHeight: 24,
115
+ },
116
+ marginBottom8: {
117
+ marginBottom: 8,
118
+ },
119
+ marginBottom16: {
120
+ marginBottom: 16,
121
+ },
122
+ contentContainer: {
123
+ paddingHorizontal: 24,
124
+ },
125
+ scrollViewContentContainer: {
126
+ flexGrow: 1,
127
+ paddingVertical: 24,
128
+ },
129
+ summaryWrapper: {
130
+ flexBasis: '50%',
131
+ flexGrow: 1,
132
+ flexShrink: 1,
133
+ padding: 16,
134
+ borderRadius: 12,
135
+ },
136
+ position: {
137
+ width: 24,
138
+ height: 24,
139
+ borderRadius: 12,
140
+ textAlign: 'center',
141
+ textAlignVertical: 'center',
142
+ marginRight: 12,
143
+ },
144
+ firstPosition: {
145
+ backgroundColor: '#D69516', // '#FFD700'
146
+ },
147
+ secondPosition: {
148
+ backgroundColor: '#3E3E3E', // '#C0C0C0'
149
+ },
150
+ thirdPosition: {
151
+ backgroundColor: '#583B0F', // '#CD7F32'
152
+ },
153
+ iconWrapper: {
154
+ flexDirection: 'row',
155
+ alignItems: 'center',
156
+ marginLeft: 12,
157
+ },
158
+ // Utilities
159
+ fullView: {
160
+ flex: 1,
161
+ },
162
+ // Header
163
+ header: {
164
+ flexDirection: 'row',
165
+ alignItems: 'center',
166
+ justifyContent: 'space-between',
167
+ marginTop: 24,
168
+ marginHorizontal: 24,
169
+ },
170
+ headerControls: {
171
+ flexDirection: 'row',
172
+ alignItems: 'center',
173
+ flexShrink: 1,
174
+ },
175
+ headerText: {
176
+ fontSize: 20,
177
+ lineHeight: 24,
178
+ letterSpacing: 0.15,
179
+ marginRight: 12,
180
+ },
181
+ closeIconHitSlop: {
182
+ bottom: 16,
183
+ left: 16,
184
+ right: 16,
185
+ top: 16,
186
+ },
187
+ backIcon: {
188
+ marginRight: 8,
189
+ },
190
+ // Divider
191
+ halfDivider: {
192
+ marginHorizontal: 24,
193
+ marginVertical: 0,
194
+ marginTop: 24,
195
+ width: undefined,
196
+ },
197
+ divider: { height: 1, width: '100%' },
198
+ viewAllBtn: {
199
+ flexDirection: 'row',
200
+ alignItems: 'center',
201
+ justifyContent: 'flex-end',
202
+ paddingVertical: 12,
203
+ paddingHorizontal: 16,
204
+ },
205
+ leaderboardEntry: { marginBottom: 16, marginHorizontal: 16 },
206
+ entriesCard: { paddingTop: 12, borderRadius: 8 },
207
+ });
@@ -1,17 +1,19 @@
1
1
  import React from 'react';
2
- import { View, StyleSheet } from 'react-native';
2
+ import { View, StyleSheet, TouchableOpacity } from 'react-native';
3
3
  import type { ColorValue } from 'react-native';
4
4
 
5
5
  export interface RadioInputProps {
6
6
  selected: boolean;
7
7
  size?: number;
8
8
  color?: ColorValue;
9
+ onChange?: (selected: boolean) => void;
9
10
  }
10
11
 
11
12
  export const RadioInput: React.FC<RadioInputProps> = ({
12
13
  selected,
13
14
  size = 24,
14
15
  color = 'white',
16
+ onChange,
15
17
  }) => {
16
18
  const outerCircleStyle = {
17
19
  width: size,
@@ -28,11 +30,21 @@ export const RadioInput: React.FC<RadioInputProps> = ({
28
30
  backgroundColor: color,
29
31
  };
30
32
 
31
- return (
33
+ const radio = (
32
34
  <View style={[styles.outerCircle, outerCircleStyle]}>
33
35
  {selected ? <View style={innerCircleStyle} /> : null}
34
36
  </View>
35
37
  );
38
+
39
+ if (typeof onChange !== 'function') {
40
+ return radio;
41
+ }
42
+
43
+ return (
44
+ <TouchableOpacity onPress={() => onChange(!selected)}>
45
+ {radio}
46
+ </TouchableOpacity>
47
+ );
36
48
  };
37
49
 
38
50
  const styles = StyleSheet.create({
@@ -316,7 +316,7 @@ export const RoomSettingsModalContent: React.FC<
316
316
  {
317
317
  id: 'polls-and-quizes',
318
318
  icon: <PollVoteIcon style={{ width: 20, height: 20 }} />,
319
- label: 'Polls',
319
+ label: 'Polls and Quizzes',
320
320
  pressHandler: openPollsQuizzesModal,
321
321
  isActive: false,
322
322
  hide: !canReadOrWritePoll,
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { View, Dimensions } from 'react-native';
2
+ import { View } from 'react-native';
3
3
  import { useSelector } from 'react-redux';
4
4
  import type { ViewStyle } from 'react-native';
5
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ import { useSafeAreaFrame } from 'react-native-safe-area-context';
6
6
  import type { HMSView } from '@100mslive/react-native-hms';
7
7
 
8
8
  import { Tile } from './Tile';
@@ -22,7 +22,7 @@ const _TilesContainer: React.FC<TilesContainerProps> = ({
22
22
  setHmsViewRefs,
23
23
  onPeerTileMorePress,
24
24
  }) => {
25
- const { left, right } = useSafeAreaInsets();
25
+ const { width: safeWidth } = useSafeAreaFrame();
26
26
  const isLandscapeOrientation = useIsLandscapeOrientation();
27
27
 
28
28
  const screenshareTilesAvailable = useSelector(
@@ -55,7 +55,7 @@ const _TilesContainer: React.FC<TilesContainerProps> = ({
55
55
  ? 'row'
56
56
  : 'column',
57
57
  },
58
- { width: Dimensions.get('window').width + left + right },
58
+ { width: safeWidth },
59
59
  ]}
60
60
  >
61
61
  {peerTrackNodes.length <= 3 ? (
@@ -0,0 +1,67 @@
1
+ import * as React from 'react';
2
+ import type { HMSPoll } from '@100mslive/react-native-hms';
3
+ import { useSelector } from 'react-redux';
4
+
5
+ import type { RootState } from '../redux';
6
+ import { QuizLeaderboardSummary } from './QuizLeaderboardSummary';
7
+ import { useFetchLeaderboardResponse } from '../utils/hooks';
8
+
9
+ export interface VoterParticipationSummaryProps {
10
+ pollId: HMSPoll['pollId'];
11
+ }
12
+
13
+ export const VoterParticipationSummary: React.FC<
14
+ VoterParticipationSummaryProps
15
+ > = ({ pollId }) => {
16
+ const localPeerUserId = useSelector(
17
+ (state: RootState) => state.hmsStates.localPeer?.customerUserID
18
+ );
19
+ const leaderboardData = useFetchLeaderboardResponse(pollId);
20
+ const totalQuestions = useSelector(
21
+ (state: RootState) => state.polls.polls[pollId]?.questions?.length
22
+ );
23
+
24
+ const localLeaderboardEntry =
25
+ localPeerUserId && leaderboardData && Array.isArray(leaderboardData.entries)
26
+ ? leaderboardData.entries.find(
27
+ (entry) => entry.peer?.customerUserId === localPeerUserId
28
+ )
29
+ : null;
30
+
31
+ const data = React.useMemo(() => {
32
+ return [
33
+ [
34
+ {
35
+ label: 'ANSWERED',
36
+ value:
37
+ localLeaderboardEntry &&
38
+ typeof localLeaderboardEntry.totalResponses === 'number' &&
39
+ typeof totalQuestions === 'number'
40
+ ? `${Math.round((localLeaderboardEntry.totalResponses / totalQuestions) * 100)}% (${localLeaderboardEntry.totalResponses}/${totalQuestions})`
41
+ : '-',
42
+ },
43
+ {
44
+ label: 'CORRECT ANSWERS',
45
+ value:
46
+ localLeaderboardEntry &&
47
+ typeof localLeaderboardEntry.correctResponses === 'number' &&
48
+ typeof totalQuestions === 'number'
49
+ ? `${Math.round((localLeaderboardEntry.correctResponses / totalQuestions) * 100)}% (${localLeaderboardEntry.correctResponses}/${totalQuestions})`
50
+ : '-',
51
+ },
52
+ ],
53
+ [
54
+ {
55
+ label: 'TIME TAKEN',
56
+ value:
57
+ localLeaderboardEntry &&
58
+ typeof localLeaderboardEntry.duration === 'number'
59
+ ? `${(localLeaderboardEntry.duration / 1000).toFixed(2)}s`
60
+ : '-',
61
+ },
62
+ ],
63
+ ];
64
+ }, [localLeaderboardEntry]);
65
+
66
+ return <QuizLeaderboardSummary data={data} />;
67
+ };
package/src/hooks-util.ts CHANGED
@@ -24,8 +24,6 @@ import {
24
24
  WindowController,
25
25
  useHMSHLSPlayerCue,
26
26
  HMSPollUpdateType,
27
- HMSPollType,
28
- // useHMSPeerUpdates,
29
27
  } from '@100mslive/react-native-hms';
30
28
  import type { Chat as ChatConfig } from '@100mslive/types-prebuilt/elements/chat';
31
29
  import { SoftInputModes } from '@100mslive/react-native-hms';
@@ -2572,7 +2570,7 @@ export const useHLSCuedPolls = () => {
2572
2570
  ? store.getState().polls.polls[pollId]
2573
2571
  : null;
2574
2572
 
2575
- if (poll && poll.type === HMSPollType.poll) {
2573
+ if (poll) {
2576
2574
  console.log('HLS Cued Poll ID: ', pollId);
2577
2575
  dispatch(addCuedPollId(poll.pollId));
2578
2576
  dispatch(
@@ -2,6 +2,8 @@ import type {
2
2
  HMSPoll,
3
3
  HMSPollQuestion,
4
4
  HMSPollQuestionType,
5
+ HMSPollType,
6
+ PollLeaderboardResponse,
5
7
  } from '@100mslive/react-native-hms';
6
8
 
7
9
  const createRequests = (base: String) => {
@@ -194,9 +196,12 @@ export enum CreatePollStages {
194
196
  POLL_CONFIG,
195
197
  POLL_QUESTION_CONFIG,
196
198
  POLL_VOTING,
199
+ QUIZ_LEADERBOARD,
200
+ QUIZ_LEADERBOARD_ENTRIES,
197
201
  }
198
202
 
199
203
  export type PollConfig = {
204
+ type: HMSPollType;
200
205
  voteCountHidden: boolean;
201
206
  resultsAnonymous: boolean;
202
207
  };
@@ -206,7 +211,8 @@ export type PollQuestionUI = {
206
211
  title: string;
207
212
  skippable: boolean;
208
213
  responseEditable: boolean;
209
- options?: string[];
214
+ pointWeightage: string;
215
+ options?: [boolean, string][];
210
216
  saved: boolean;
211
217
  };
212
218
 
@@ -214,15 +220,20 @@ export type PollsActionType =
214
220
  | SetDeleteConfirmationVisible
215
221
  | SetPollNameAction
216
222
  | SetPollConfigAction
217
- | SetPollStageAction
223
+ | PushToNavigationStackAction
224
+ | ResetNavigationStackAction
225
+ | PopFromNavigationStackAction
226
+ | ReplaceTopOfNavigationStackAction
218
227
  | AddPollQuestionAction
219
228
  | DeletePollQuestionAction
220
229
  | SetSelectedQuestionIndexAction
221
230
  | SetQuestionTypeAction
222
231
  | SetQuestionTitleAction
232
+ | SetQuestionPointWeightageAction
223
233
  | AddQuestionOptionAction
224
234
  | DeleteQuestionOptionAction
225
235
  | EditQuestionOptionAction
236
+ | SetQuestionCorrectOptionAction
226
237
  | SetQuestionSkippable
227
238
  | SetQuestionResponseEditable
228
239
  | SetQuestionSavedAction
@@ -236,6 +247,7 @@ export type PollsActionType =
236
247
  | AddPollQuestionResponseAction
237
248
  | RemovePollQuestionResponseAction
238
249
  | AddCuedPollIdAction
250
+ | AddLeaderboardAction
239
251
  | { type: HmsStateActionTypes.CLEAR_STATES };
240
252
 
241
253
  export type ClearPollFormStateAction = {
@@ -257,9 +269,22 @@ export type SetPollConfigAction = {
257
269
  pollConfig: Partial<PollConfig>;
258
270
  };
259
271
 
260
- export type SetPollStageAction = {
261
- type: PollsStateActionTypes.SET_POLL_STAGE;
262
- pollStage: CreatePollStages;
272
+ export type PushToNavigationStackAction = {
273
+ type: PollsStateActionTypes.PUSH_TO_NAVIGATION_STACK;
274
+ screen: CreatePollStages;
275
+ };
276
+
277
+ export type ResetNavigationStackAction = {
278
+ type: PollsStateActionTypes.RESET_NAVIGATION_STACK;
279
+ };
280
+
281
+ export type PopFromNavigationStackAction = {
282
+ type: PollsStateActionTypes.POP_FROM_NAVIGATION_STACK;
283
+ };
284
+
285
+ export type ReplaceTopOfNavigationStackAction = {
286
+ type: PollsStateActionTypes.REPLACE_TOP_OF_NAVIGATION_STACK;
287
+ screen: CreatePollStages;
263
288
  };
264
289
 
265
290
  export type AddPollQuestionAction = {
@@ -287,6 +312,12 @@ export type SetQuestionTitleAction = {
287
312
  title: string;
288
313
  };
289
314
 
315
+ export type SetQuestionPointWeightageAction = {
316
+ type: PollsStateActionTypes.SET_POINT_WEIGHTAGE;
317
+ questionIndex: number;
318
+ pointWeightage: string;
319
+ };
320
+
290
321
  export type AddQuestionOptionAction = {
291
322
  type: PollsStateActionTypes.ADD_QUESTION_OPTION;
292
323
  questionIndex: number;
@@ -305,6 +336,13 @@ export type EditQuestionOptionAction = {
305
336
  option: string;
306
337
  };
307
338
 
339
+ export type SetQuestionCorrectOptionAction = {
340
+ type: PollsStateActionTypes.SET_QUESTION_CORRECT_OPTION;
341
+ questionIndex: number;
342
+ optionIndex: number;
343
+ correctOption: boolean;
344
+ };
345
+
308
346
  export type SetQuestionSkippable = {
309
347
  type: PollsStateActionTypes.SET_QUESTION_SKIPPABLE;
310
348
  questionIndex: number;
@@ -373,20 +411,31 @@ export type AddCuedPollIdAction = {
373
411
  pollId: HMSPoll['pollId'];
374
412
  };
375
413
 
414
+ export type AddLeaderboardAction = {
415
+ type: PollsStateActionTypes.ADD_LEADERBOARD;
416
+ pollId: HMSPoll['pollId'];
417
+ leaderboard: PollLeaderboardResponse;
418
+ };
419
+
376
420
  export enum PollsStateActionTypes {
377
421
  CLEAR_POLL_FORM_STATE = 'CLEAR_POLL_FORM_STATE',
378
422
  SET_DELETE_CONFIRMATION_VISIBLE = 'SET_DELETE_CONFIRMATION_VISIBLE',
379
423
  SET_POLL_NAME = 'SET_POLL_NAME',
380
424
  SET_POLL_CONFIG = 'SET_POLL_CONFIG',
381
- SET_POLL_STAGE = 'SET_POLL_STAGE',
425
+ PUSH_TO_NAVIGATION_STACK = 'PUSH_TO_NAVIGATION_STACK',
426
+ RESET_NAVIGATION_STACK = 'RESET_NAVIGATION_STACK',
427
+ POP_FROM_NAVIGATION_STACK = 'POP_FROM_NAVIGATION_STACK',
428
+ REPLACE_TOP_OF_NAVIGATION_STACK = 'REPLACE_TOP_OF_NAVIGATION_STACK',
382
429
  ADD_POLL_QUESTION = 'ADD_POLL_QUESTION',
383
430
  DELETE_POLL_QUESTION = 'DELETE_POLL_QUESTION',
384
431
  SET_SELECTED_QUESTION_INDEX = 'SET_SELECTED_QUESTION_INDEX',
385
432
  SET_QUESTION_TYPE = 'SET_QUESTION_TYPE',
386
433
  SET_QUESTION_TITLE = 'SET_QUESTION_TITLE',
434
+ SET_POINT_WEIGHTAGE = 'SET_POINT_WEIGHTAGE',
387
435
  ADD_QUESTION_OPTION = 'ADD_QUESTION_OPTION',
388
436
  DELETE_QUESTION_OPTION = 'DELETE_QUESTION_OPTION',
389
437
  EDIT_QUESTION_OPTION = 'EDIT_QUESTION_OPTION',
438
+ SET_QUESTION_CORRECT_OPTION = 'SET_QUESTION_CORRECT_OPTION',
390
439
  SET_QUESTION_SKIPPABLE = 'SET_QUESTION_SKIPPABLE',
391
440
  SET_QUESTION_RES_EDITABLE = 'SET_QUESTION_RES_EDITABLE',
392
441
  SET_QUESTION_SAVED = 'SET_QUESTION_SAVED',
@@ -399,4 +448,5 @@ export enum PollsStateActionTypes {
399
448
  REMOVE_POLL_QUESTION_RESPONSE = 'REMOVE_POLL_QUESTION_RESPONSE',
400
449
  ADD_POLL_QUESTION_RESPONSE = 'ADD_POLL_QUESTION_RESPONSE',
401
450
  ADD_CUED_POLL_ID = 'ADD_CUED_POLL_ID',
451
+ ADD_LEADERBOARD = 'ADD_LEADERBOARD',
402
452
  }
@@ -32,7 +32,6 @@ import type {
32
32
  AddPollQuestionAction,
33
33
  SetPollConfigAction,
34
34
  SetPollNameAction,
35
- SetPollStageAction,
36
35
  DeletePollQuestionAction,
37
36
  SetDeleteConfirmationVisible,
38
37
  SetSelectedQuestionIndexAction,
@@ -52,6 +51,13 @@ import type {
52
51
  AddPollQuestionResponseAction,
53
52
  SetPollQuestionResponseAction,
54
53
  RemovePollQuestionResponseAction,
54
+ SetQuestionPointWeightageAction,
55
+ SetQuestionCorrectOptionAction,
56
+ PushToNavigationStackAction,
57
+ PopFromNavigationStackAction,
58
+ ReplaceTopOfNavigationStackAction,
59
+ AddLeaderboardAction,
60
+ ResetNavigationStackAction,
55
61
  } from '../actionTypes';
56
62
  import { MeetingState } from '../../types';
57
63
  import type { ChatState, Notification, PinnedMessage } from '../../types';
@@ -489,11 +495,26 @@ export const setPollConfig = (
489
495
  pollConfig,
490
496
  });
491
497
 
492
- export const setPollStage = (
493
- pollStage: SetPollStageAction['pollStage']
494
- ): SetPollStageAction => ({
495
- type: PollsStateActionTypes.SET_POLL_STAGE,
496
- pollStage,
498
+ export const pushToNavigationStack = (
499
+ screen: PushToNavigationStackAction['screen']
500
+ ): PushToNavigationStackAction => ({
501
+ type: PollsStateActionTypes.PUSH_TO_NAVIGATION_STACK,
502
+ screen,
503
+ });
504
+
505
+ export const resetNavigationStack = (): ResetNavigationStackAction => ({
506
+ type: PollsStateActionTypes.RESET_NAVIGATION_STACK,
507
+ });
508
+
509
+ export const popFromNavigationStack = (): PopFromNavigationStackAction => ({
510
+ type: PollsStateActionTypes.POP_FROM_NAVIGATION_STACK,
511
+ });
512
+
513
+ export const replaceTopOfNavigationStack = (
514
+ screen: ReplaceTopOfNavigationStackAction['screen']
515
+ ): ReplaceTopOfNavigationStackAction => ({
516
+ type: PollsStateActionTypes.REPLACE_TOP_OF_NAVIGATION_STACK,
517
+ screen,
497
518
  });
498
519
 
499
520
  export const addPollQuestion = (): AddPollQuestionAction => ({
@@ -529,6 +550,15 @@ export const setPollQuestionTitle = (
529
550
  title,
530
551
  });
531
552
 
553
+ export const setPollQuestionPointWeightage = (
554
+ questionIndex: SetQuestionPointWeightageAction['questionIndex'],
555
+ pointWeightage: SetQuestionPointWeightageAction['pointWeightage']
556
+ ): SetQuestionPointWeightageAction => ({
557
+ type: PollsStateActionTypes.SET_POINT_WEIGHTAGE,
558
+ questionIndex,
559
+ pointWeightage,
560
+ });
561
+
532
562
  export const addPollQuestionOption = (
533
563
  questionIndex: AddQuestionOptionAction['questionIndex']
534
564
  ): AddQuestionOptionAction => ({
@@ -556,6 +586,17 @@ export const editPollQuestionOption = (
556
586
  option,
557
587
  });
558
588
 
589
+ export const setPollQuestionCorrectOption = (
590
+ questionIndex: SetQuestionCorrectOptionAction['questionIndex'],
591
+ optionIndex: SetQuestionCorrectOptionAction['optionIndex'],
592
+ correctOption: SetQuestionCorrectOptionAction['correctOption']
593
+ ): SetQuestionCorrectOptionAction => ({
594
+ type: PollsStateActionTypes.SET_QUESTION_CORRECT_OPTION,
595
+ questionIndex,
596
+ optionIndex,
597
+ correctOption,
598
+ });
599
+
559
600
  export const setPollQuestionSkippable = (
560
601
  questionIndex: SetQuestionSkippable['questionIndex'],
561
602
  skippable: boolean
@@ -650,3 +691,12 @@ export const addCuedPollId = (pollId: string) => ({
650
691
  type: PollsStateActionTypes.ADD_CUED_POLL_ID,
651
692
  pollId,
652
693
  });
694
+
695
+ export const addLeaderboard = (
696
+ pollId: AddLeaderboardAction['pollId'],
697
+ leaderboard: AddLeaderboardAction['leaderboard']
698
+ ): AddLeaderboardAction => ({
699
+ type: PollsStateActionTypes.ADD_LEADERBOARD,
700
+ pollId,
701
+ leaderboard,
702
+ });