@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.
- package/README.md +1 -1
- package/lib/commonjs/HMSRoomSetup.js +15 -5
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Check/assets/check-in-circle.png +0 -0
- package/lib/commonjs/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/lib/commonjs/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/lib/commonjs/Icons/Check/index.js +2 -1
- package/lib/commonjs/Icons/Check/index.js.map +1 -1
- package/lib/commonjs/Icons/CheckBox/index.js +8 -1
- package/lib/commonjs/Icons/CheckBox/index.js.map +1 -1
- package/lib/commonjs/Icons/Clock/assets/clock-vector.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock-vector@2x.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock-vector@3x.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock@2x.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock@3x.png +0 -0
- package/lib/commonjs/Icons/Clock/index.js +7 -2
- package/lib/commonjs/Icons/Clock/index.js.map +1 -1
- package/lib/commonjs/components/CreatePoll.js +100 -53
- package/lib/commonjs/components/CreatePoll.js.map +1 -1
- package/lib/commonjs/components/GridView.js +4 -8
- package/lib/commonjs/components/GridView.js.map +1 -1
- package/lib/commonjs/components/HLSView.js +15 -1
- package/lib/commonjs/components/HLSView.js.map +1 -1
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js +2 -2
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/commonjs/components/LeaderboardEntry.js +135 -0
- package/lib/commonjs/components/LeaderboardEntry.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js +80 -32
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -1
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizSheetScreen.js +69 -0
- package/lib/commonjs/components/PollAndQuizSheetScreen.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizVoting.js +145 -17
- package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
- package/lib/commonjs/components/PollQuestion.js +70 -14
- package/lib/commonjs/components/PollQuestion.js.map +1 -1
- package/lib/commonjs/components/PollQuestions.js +126 -12
- package/lib/commonjs/components/PollQuestions.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizBottomSheet.js +9 -11
- package/lib/commonjs/components/PollsAndQuizBottomSheet.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizzesCard.js +1 -1
- package/lib/commonjs/components/PollsAndQuizzesCard.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js +26 -120
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/commonjs/components/PollsConfigAndList.js +81 -4
- package/lib/commonjs/components/PollsConfigAndList.js.map +1 -1
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +7 -15
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
- package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
- package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js +284 -0
- package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js.map +1 -0
- package/lib/commonjs/components/QuizLeaderboardScreen.js +279 -0
- package/lib/commonjs/components/QuizLeaderboardScreen.js.map +1 -0
- package/lib/commonjs/components/QuizLeaderboardSummary.js +195 -0
- package/lib/commonjs/components/QuizLeaderboardSummary.js.map +1 -0
- package/lib/commonjs/components/RadioInput.js +9 -2
- package/lib/commonjs/components/RadioInput.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/TilesContainer.js +3 -4
- package/lib/commonjs/components/TilesContainer.js.map +1 -1
- package/lib/commonjs/components/VoterParticipationSummary.js +46 -0
- package/lib/commonjs/components/VoterParticipationSummary.js.map +1 -0
- package/lib/commonjs/hooks-util.js +1 -1
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +9 -1
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +38 -5
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/polls.js +95 -8
- package/lib/commonjs/redux/reducers/polls.js.map +1 -1
- package/lib/commonjs/utils/functions.js +48 -3
- package/lib/commonjs/utils/functions.js.map +1 -1
- package/lib/commonjs/utils/hooks.js +107 -2
- package/lib/commonjs/utils/hooks.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +16 -6
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Check/assets/check-in-circle.png +0 -0
- package/lib/module/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/lib/module/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/lib/module/Icons/Check/index.js +2 -1
- package/lib/module/Icons/Check/index.js.map +1 -1
- package/lib/module/Icons/CheckBox/index.js +9 -2
- package/lib/module/Icons/CheckBox/index.js.map +1 -1
- package/lib/module/Icons/Clock/assets/clock-vector.png +0 -0
- package/lib/module/Icons/Clock/assets/clock-vector@2x.png +0 -0
- package/lib/module/Icons/Clock/assets/clock-vector@3x.png +0 -0
- package/lib/module/Icons/Clock/assets/clock.png +0 -0
- package/lib/module/Icons/Clock/assets/clock@2x.png +0 -0
- package/lib/module/Icons/Clock/assets/clock@3x.png +0 -0
- package/lib/module/Icons/Clock/index.js +7 -2
- package/lib/module/Icons/Clock/index.js.map +1 -1
- package/lib/module/components/CreatePoll.js +102 -56
- package/lib/module/components/CreatePoll.js.map +1 -1
- package/lib/module/components/GridView.js +5 -9
- package/lib/module/components/GridView.js.map +1 -1
- package/lib/module/components/HLSView.js +17 -3
- package/lib/module/components/HLSView.js.map +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js +3 -3
- package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/module/components/LeaderboardEntry.js +126 -0
- package/lib/module/components/LeaderboardEntry.js.map +1 -0
- package/lib/module/components/PollAndQuizQuestionResponseCard.js +81 -33
- package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -1
- package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
- package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/module/components/PollAndQuizSheetScreen.js +60 -0
- package/lib/module/components/PollAndQuizSheetScreen.js.map +1 -0
- package/lib/module/components/PollAndQuizVoting.js +148 -20
- package/lib/module/components/PollAndQuizVoting.js.map +1 -1
- package/lib/module/components/PollQuestion.js +73 -17
- package/lib/module/components/PollQuestion.js.map +1 -1
- package/lib/module/components/PollQuestions.js +129 -15
- package/lib/module/components/PollQuestions.js.map +1 -1
- package/lib/module/components/PollsAndQuizBottomSheet.js +11 -13
- package/lib/module/components/PollsAndQuizBottomSheet.js.map +1 -1
- package/lib/module/components/PollsAndQuizzesCard.js +2 -2
- package/lib/module/components/PollsAndQuizzesCard.js.map +1 -1
- package/lib/module/components/PollsAndQuizzesModalContent.js +28 -122
- package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/module/components/PollsConfigAndList.js +82 -5
- package/lib/module/components/PollsConfigAndList.js.map +1 -1
- package/lib/module/components/PreviousPollsAndQuizzesList.js +7 -15
- package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/module/components/QuizEndOptionsView.js +54 -0
- package/lib/module/components/QuizEndOptionsView.js.map +1 -0
- package/lib/module/components/QuizLeaderboardEntriesScreen.js +275 -0
- package/lib/module/components/QuizLeaderboardEntriesScreen.js.map +1 -0
- package/lib/module/components/QuizLeaderboardScreen.js +270 -0
- package/lib/module/components/QuizLeaderboardScreen.js.map +1 -0
- package/lib/module/components/QuizLeaderboardSummary.js +186 -0
- package/lib/module/components/QuizLeaderboardSummary.js.map +1 -0
- package/lib/module/components/RadioInput.js +10 -3
- package/lib/module/components/RadioInput.js.map +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +1 -1
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/TilesContainer.js +5 -6
- package/lib/module/components/TilesContainer.js.map +1 -1
- package/lib/module/components/VoterParticipationSummary.js +37 -0
- package/lib/module/components/VoterParticipationSummary.js.map +1 -0
- package/lib/module/hooks-util.js +2 -4
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/redux/actionTypes.js +9 -1
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +29 -3
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/polls.js +96 -9
- package/lib/module/redux/reducers/polls.js.map +1 -1
- package/lib/module/utils/functions.js +43 -3
- package/lib/module/utils/functions.js.map +1 -1
- package/lib/module/utils/hooks.js +105 -2
- package/lib/module/utils/hooks.js.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Check/index.d.ts +1 -0
- package/lib/typescript/Icons/Check/index.d.ts.map +1 -1
- package/lib/typescript/Icons/CheckBox/index.d.ts +1 -0
- package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -1
- package/lib/typescript/Icons/Clock/index.d.ts +1 -0
- package/lib/typescript/Icons/Clock/index.d.ts.map +1 -1
- package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
- package/lib/typescript/components/GridView.d.ts.map +1 -1
- package/lib/typescript/components/HLSView.d.ts.map +1 -1
- package/lib/typescript/components/LeaderboardEntry.d.ts +11 -0
- package/lib/typescript/components/LeaderboardEntry.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -1
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizSheetScreen.d.ts +8 -0
- package/lib/typescript/components/PollAndQuizSheetScreen.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts +2 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestion.d.ts +1 -0
- package/lib/typescript/components/PollQuestion.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestions.d.ts +2 -0
- package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
- package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts +0 -1
- package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts.map +1 -1
- package/lib/typescript/components/PollsConfigAndList.d.ts +1 -0
- package/lib/typescript/components/PollsConfigAndList.d.ts.map +1 -1
- package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts.map +1 -1
- package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
- package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
- package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts +8 -0
- package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts.map +1 -0
- package/lib/typescript/components/QuizLeaderboardScreen.d.ts +8 -0
- package/lib/typescript/components/QuizLeaderboardScreen.d.ts.map +1 -0
- package/lib/typescript/components/QuizLeaderboardSummary.d.ts +9 -0
- package/lib/typescript/components/QuizLeaderboardSummary.d.ts.map +1 -0
- package/lib/typescript/components/RadioInput.d.ts +1 -0
- package/lib/typescript/components/RadioInput.d.ts.map +1 -1
- package/lib/typescript/components/VoterParticipationSummary.d.ts +7 -0
- package/lib/typescript/components/VoterParticipationSummary.d.ts.map +1 -0
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +45 -9
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +8 -2
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +2 -1
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +2 -1
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/polls.d.ts +3 -2
- package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
- package/lib/typescript/utils/functions.d.ts +6 -2
- package/lib/typescript/utils/functions.d.ts.map +1 -1
- package/lib/typescript/utils/hooks.d.ts +6 -0
- package/lib/typescript/utils/hooks.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/HMSRoomSetup.tsx +25 -6
- package/src/Icons/Check/assets/check-in-circle.png +0 -0
- package/src/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/src/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/src/Icons/Check/index.tsx +9 -2
- package/src/Icons/CheckBox/index.tsx +16 -2
- package/src/Icons/Clock/assets/clock-vector.png +0 -0
- package/src/Icons/Clock/assets/clock-vector@2x.png +0 -0
- package/src/Icons/Clock/assets/clock-vector@3x.png +0 -0
- package/src/Icons/Clock/assets/clock.png +0 -0
- package/src/Icons/Clock/assets/clock@2x.png +0 -0
- package/src/Icons/Clock/assets/clock@3x.png +0 -0
- package/src/Icons/Clock/index.tsx +16 -3
- package/src/components/CreatePoll.tsx +150 -72
- package/src/components/GridView.tsx +4 -14
- package/src/components/HLSView.tsx +27 -1
- package/src/components/HMSPollsQuizzesNotification.tsx +3 -3
- package/src/components/LeaderboardEntry.tsx +172 -0
- package/src/components/PollAndQuizQuestionResponseCard.tsx +151 -48
- package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
- package/src/components/PollAndQuizSheetScreen.tsx +85 -0
- package/src/components/PollAndQuizVoting.tsx +206 -28
- package/src/components/PollQuestion.tsx +140 -25
- package/src/components/PollQuestions.tsx +214 -74
- package/src/components/PollsAndQuizBottomSheet.tsx +20 -42
- package/src/components/PollsAndQuizzesCard.tsx +2 -2
- package/src/components/PollsAndQuizzesModalContent.tsx +40 -163
- package/src/components/PollsConfigAndList.tsx +107 -11
- package/src/components/PreviousPollsAndQuizzesList.tsx +33 -40
- package/src/components/QuizEndOptionsView.tsx +71 -0
- package/src/components/QuizLeaderboardEntriesScreen.tsx +323 -0
- package/src/components/QuizLeaderboardScreen.tsx +342 -0
- package/src/components/QuizLeaderboardSummary.tsx +207 -0
- package/src/components/RadioInput.tsx +14 -2
- package/src/components/RoomSettingsModalContent.tsx +1 -1
- package/src/components/TilesContainer.tsx +4 -4
- package/src/components/VoterParticipationSummary.tsx +67 -0
- package/src/hooks-util.ts +1 -3
- package/src/redux/actionTypes.ts +56 -6
- package/src/redux/actions/index.ts +56 -6
- package/src/redux/reducers/polls.ts +139 -11
- package/src/utils/functions.ts +90 -6
- package/src/utils/hooks.ts +190 -3
|
@@ -1,62 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
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 {
|
|
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
|
-
> = ({
|
|
32
|
-
const
|
|
33
|
-
|
|
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={
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
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 {
|
|
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 {
|
|
7
|
-
import
|
|
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
|
-
<
|
|
23
|
-
{
|
|
24
|
-
{
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</Text>
|
|
65
|
-
)}
|
|
40
|
+
<Text style={[styles.title, hmsRoomStyles.surfaceHighSemiBoldText]}>
|
|
41
|
+
Previous Polls And Quizzes
|
|
42
|
+
</Text>
|
|
66
43
|
|
|
67
|
-
{pollsList
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
+
});
|