@100mslive/react-native-room-kit 1.1.2 → 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 (168) hide show
  1. package/lib/commonjs/HMSRoomSetup.js +13 -1
  2. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  3. package/lib/commonjs/Icons/Clock/assets/clock-vector.png +0 -0
  4. package/lib/commonjs/Icons/Clock/assets/clock-vector@2x.png +0 -0
  5. package/lib/commonjs/Icons/Clock/assets/clock-vector@3x.png +0 -0
  6. package/lib/commonjs/Icons/Clock/assets/clock.png +0 -0
  7. package/lib/commonjs/Icons/Clock/assets/clock@2x.png +0 -0
  8. package/lib/commonjs/Icons/Clock/assets/clock@3x.png +0 -0
  9. package/lib/commonjs/Icons/Clock/index.js +7 -2
  10. package/lib/commonjs/Icons/Clock/index.js.map +1 -1
  11. package/lib/commonjs/components/CreatePoll.js +3 -2
  12. package/lib/commonjs/components/CreatePoll.js.map +1 -1
  13. package/lib/commonjs/components/HLSView.js +15 -1
  14. package/lib/commonjs/components/HLSView.js.map +1 -1
  15. package/lib/commonjs/components/HMSPollsQuizzesNotification.js +1 -1
  16. package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
  17. package/lib/commonjs/components/LeaderboardEntry.js +135 -0
  18. package/lib/commonjs/components/LeaderboardEntry.js.map +1 -0
  19. package/lib/commonjs/components/PollAndQuizSheetScreen.js +69 -0
  20. package/lib/commonjs/components/PollAndQuizSheetScreen.js.map +1 -0
  21. package/lib/commonjs/components/PollAndQuizVoting.js +133 -4
  22. package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
  23. package/lib/commonjs/components/PollQuestions.js +104 -4
  24. package/lib/commonjs/components/PollQuestions.js.map +1 -1
  25. package/lib/commonjs/components/PollsAndQuizBottomSheet.js +9 -11
  26. package/lib/commonjs/components/PollsAndQuizBottomSheet.js.map +1 -1
  27. package/lib/commonjs/components/PollsAndQuizzesCard.js +1 -1
  28. package/lib/commonjs/components/PollsAndQuizzesCard.js.map +1 -1
  29. package/lib/commonjs/components/PollsAndQuizzesModalContent.js +26 -120
  30. package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
  31. package/lib/commonjs/components/PollsConfigAndList.js +81 -4
  32. package/lib/commonjs/components/PollsConfigAndList.js.map +1 -1
  33. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +7 -15
  34. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
  35. package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js +284 -0
  36. package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js.map +1 -0
  37. package/lib/commonjs/components/QuizLeaderboardScreen.js +279 -0
  38. package/lib/commonjs/components/QuizLeaderboardScreen.js.map +1 -0
  39. package/lib/commonjs/components/QuizLeaderboardSummary.js +195 -0
  40. package/lib/commonjs/components/QuizLeaderboardSummary.js.map +1 -0
  41. package/lib/commonjs/components/VoterParticipationSummary.js +46 -0
  42. package/lib/commonjs/components/VoterParticipationSummary.js.map +1 -0
  43. package/lib/commonjs/redux/actionTypes.js +7 -1
  44. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  45. package/lib/commonjs/redux/actions/index.js +25 -5
  46. package/lib/commonjs/redux/actions/index.js.map +1 -1
  47. package/lib/commonjs/redux/reducers/polls.js +65 -5
  48. package/lib/commonjs/redux/reducers/polls.js.map +1 -1
  49. package/lib/commonjs/utils/hooks.js +107 -2
  50. package/lib/commonjs/utils/hooks.js.map +1 -1
  51. package/lib/module/HMSRoomSetup.js +13 -1
  52. package/lib/module/HMSRoomSetup.js.map +1 -1
  53. package/lib/module/Icons/Clock/assets/clock-vector.png +0 -0
  54. package/lib/module/Icons/Clock/assets/clock-vector@2x.png +0 -0
  55. package/lib/module/Icons/Clock/assets/clock-vector@3x.png +0 -0
  56. package/lib/module/Icons/Clock/assets/clock.png +0 -0
  57. package/lib/module/Icons/Clock/assets/clock@2x.png +0 -0
  58. package/lib/module/Icons/Clock/assets/clock@3x.png +0 -0
  59. package/lib/module/Icons/Clock/index.js +7 -2
  60. package/lib/module/Icons/Clock/index.js.map +1 -1
  61. package/lib/module/components/CreatePoll.js +4 -3
  62. package/lib/module/components/CreatePoll.js.map +1 -1
  63. package/lib/module/components/HLSView.js +17 -3
  64. package/lib/module/components/HLSView.js.map +1 -1
  65. package/lib/module/components/HMSPollsQuizzesNotification.js +2 -2
  66. package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
  67. package/lib/module/components/LeaderboardEntry.js +126 -0
  68. package/lib/module/components/LeaderboardEntry.js.map +1 -0
  69. package/lib/module/components/PollAndQuizSheetScreen.js +60 -0
  70. package/lib/module/components/PollAndQuizSheetScreen.js.map +1 -0
  71. package/lib/module/components/PollAndQuizVoting.js +135 -6
  72. package/lib/module/components/PollAndQuizVoting.js.map +1 -1
  73. package/lib/module/components/PollQuestions.js +107 -7
  74. package/lib/module/components/PollQuestions.js.map +1 -1
  75. package/lib/module/components/PollsAndQuizBottomSheet.js +11 -13
  76. package/lib/module/components/PollsAndQuizBottomSheet.js.map +1 -1
  77. package/lib/module/components/PollsAndQuizzesCard.js +2 -2
  78. package/lib/module/components/PollsAndQuizzesCard.js.map +1 -1
  79. package/lib/module/components/PollsAndQuizzesModalContent.js +28 -122
  80. package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
  81. package/lib/module/components/PollsConfigAndList.js +82 -5
  82. package/lib/module/components/PollsConfigAndList.js.map +1 -1
  83. package/lib/module/components/PreviousPollsAndQuizzesList.js +7 -15
  84. package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
  85. package/lib/module/components/QuizLeaderboardEntriesScreen.js +275 -0
  86. package/lib/module/components/QuizLeaderboardEntriesScreen.js.map +1 -0
  87. package/lib/module/components/QuizLeaderboardScreen.js +270 -0
  88. package/lib/module/components/QuizLeaderboardScreen.js.map +1 -0
  89. package/lib/module/components/QuizLeaderboardSummary.js +186 -0
  90. package/lib/module/components/QuizLeaderboardSummary.js.map +1 -0
  91. package/lib/module/components/VoterParticipationSummary.js +37 -0
  92. package/lib/module/components/VoterParticipationSummary.js.map +1 -0
  93. package/lib/module/redux/actionTypes.js +7 -1
  94. package/lib/module/redux/actionTypes.js.map +1 -1
  95. package/lib/module/redux/actions/index.js +18 -3
  96. package/lib/module/redux/actions/index.js.map +1 -1
  97. package/lib/module/redux/reducers/polls.js +65 -5
  98. package/lib/module/redux/reducers/polls.js.map +1 -1
  99. package/lib/module/utils/hooks.js +105 -2
  100. package/lib/module/utils/hooks.js.map +1 -1
  101. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  102. package/lib/typescript/Icons/Clock/index.d.ts +1 -0
  103. package/lib/typescript/Icons/Clock/index.d.ts.map +1 -1
  104. package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
  105. package/lib/typescript/components/HLSView.d.ts.map +1 -1
  106. package/lib/typescript/components/LeaderboardEntry.d.ts +11 -0
  107. package/lib/typescript/components/LeaderboardEntry.d.ts.map +1 -0
  108. package/lib/typescript/components/PollAndQuizSheetScreen.d.ts +8 -0
  109. package/lib/typescript/components/PollAndQuizSheetScreen.d.ts.map +1 -0
  110. package/lib/typescript/components/PollAndQuizVoting.d.ts +2 -0
  111. package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
  112. package/lib/typescript/components/PollQuestions.d.ts +2 -0
  113. package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
  114. package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts.map +1 -1
  115. package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts +0 -1
  116. package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts.map +1 -1
  117. package/lib/typescript/components/PollsConfigAndList.d.ts +1 -0
  118. package/lib/typescript/components/PollsConfigAndList.d.ts.map +1 -1
  119. package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts.map +1 -1
  120. package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts +8 -0
  121. package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts.map +1 -0
  122. package/lib/typescript/components/QuizLeaderboardScreen.d.ts +8 -0
  123. package/lib/typescript/components/QuizLeaderboardScreen.d.ts.map +1 -0
  124. package/lib/typescript/components/QuizLeaderboardSummary.d.ts +9 -0
  125. package/lib/typescript/components/QuizLeaderboardSummary.d.ts.map +1 -0
  126. package/lib/typescript/components/VoterParticipationSummary.d.ts +7 -0
  127. package/lib/typescript/components/VoterParticipationSummary.d.ts.map +1 -0
  128. package/lib/typescript/redux/actionTypes.d.ts +29 -8
  129. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  130. package/lib/typescript/redux/actions/index.d.ts +6 -2
  131. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  132. package/lib/typescript/redux/index.d.ts +2 -1
  133. package/lib/typescript/redux/index.d.ts.map +1 -1
  134. package/lib/typescript/redux/reducers/index.d.ts +2 -1
  135. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  136. package/lib/typescript/redux/reducers/polls.d.ts +3 -2
  137. package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
  138. package/lib/typescript/utils/hooks.d.ts +6 -0
  139. package/lib/typescript/utils/hooks.d.ts.map +1 -1
  140. package/package.json +3 -3
  141. package/src/HMSRoomSetup.tsx +19 -1
  142. package/src/Icons/Clock/assets/clock-vector.png +0 -0
  143. package/src/Icons/Clock/assets/clock-vector@2x.png +0 -0
  144. package/src/Icons/Clock/assets/clock-vector@3x.png +0 -0
  145. package/src/Icons/Clock/assets/clock.png +0 -0
  146. package/src/Icons/Clock/assets/clock@2x.png +0 -0
  147. package/src/Icons/Clock/assets/clock@3x.png +0 -0
  148. package/src/Icons/Clock/index.tsx +16 -3
  149. package/src/components/CreatePoll.tsx +7 -2
  150. package/src/components/HLSView.tsx +27 -1
  151. package/src/components/HMSPollsQuizzesNotification.tsx +2 -2
  152. package/src/components/LeaderboardEntry.tsx +172 -0
  153. package/src/components/PollAndQuizSheetScreen.tsx +85 -0
  154. package/src/components/PollAndQuizVoting.tsx +181 -7
  155. package/src/components/PollQuestions.tsx +171 -49
  156. package/src/components/PollsAndQuizBottomSheet.tsx +20 -42
  157. package/src/components/PollsAndQuizzesCard.tsx +2 -2
  158. package/src/components/PollsAndQuizzesModalContent.tsx +40 -163
  159. package/src/components/PollsConfigAndList.tsx +107 -11
  160. package/src/components/PreviousPollsAndQuizzesList.tsx +33 -40
  161. package/src/components/QuizLeaderboardEntriesScreen.tsx +323 -0
  162. package/src/components/QuizLeaderboardScreen.tsx +342 -0
  163. package/src/components/QuizLeaderboardSummary.tsx +207 -0
  164. package/src/components/VoterParticipationSummary.tsx +67 -0
  165. package/src/redux/actionTypes.ts +35 -5
  166. package/src/redux/actions/index.ts +34 -6
  167. package/src/redux/reducers/polls.ts +84 -6
  168. 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 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 or Quizzes 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 And Quizzes
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
  };