@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
|
@@ -5,14 +5,15 @@ import {
|
|
|
5
5
|
StyleSheet,
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
ScrollView,
|
|
8
|
+
Keyboard,
|
|
8
9
|
} from 'react-native';
|
|
9
10
|
import { HMSPollQuestionType, HMSPollType } from '@100mslive/react-native-hms';
|
|
11
|
+
import { batch, useDispatch, useSelector, useStore } from 'react-redux';
|
|
10
12
|
|
|
11
|
-
import { AddIcon } from '../Icons';
|
|
13
|
+
import { AddIcon, ChevronIcon, CloseIcon } from '../Icons';
|
|
12
14
|
import { useHMSInstance, useHMSRoomStyleSheet } from '../hooks-util';
|
|
13
15
|
import { HMSPrimaryButton } from './HMSPrimaryButton';
|
|
14
16
|
import { PollQuestion } from './PollQuestion';
|
|
15
|
-
import { batch, useDispatch, useSelector, useStore } from 'react-redux';
|
|
16
17
|
import type { RootState } from '../redux';
|
|
17
18
|
import {
|
|
18
19
|
addPollQuestion,
|
|
@@ -20,8 +21,11 @@ import {
|
|
|
20
21
|
cleaPollFormState,
|
|
21
22
|
deletePollQuestionOption,
|
|
22
23
|
editPollQuestionOption,
|
|
24
|
+
popFromNavigationStack,
|
|
23
25
|
setLaunchingPoll,
|
|
24
26
|
setPollQDeleteConfirmationVisible,
|
|
27
|
+
setPollQuestionCorrectOption,
|
|
28
|
+
setPollQuestionPointWeightage,
|
|
25
29
|
setPollQuestionResponseEditable,
|
|
26
30
|
setPollQuestionSaved,
|
|
27
31
|
setPollQuestionSkippable,
|
|
@@ -29,13 +33,21 @@ import {
|
|
|
29
33
|
setPollQuestionType,
|
|
30
34
|
setSelectedPollQuestionIndex,
|
|
31
35
|
} from '../redux/actions';
|
|
32
|
-
import type { PollQuestionUI } from '
|
|
36
|
+
import type { PollQuestionUI } from '../redux/actionTypes';
|
|
37
|
+
import { PollQDeleteConfirmationSheetView } from './PollQDeleteConfirmationSheetView';
|
|
38
|
+
import { BottomSheet } from './BottomSheet';
|
|
33
39
|
|
|
34
40
|
export interface PollQuestionsProps {
|
|
41
|
+
currentIdx: number;
|
|
35
42
|
dismissModal(): void;
|
|
43
|
+
unmountScreenWithAnimation?: (cb: Function) => void;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
export const PollQuestions: React.FC<PollQuestionsProps> = ({
|
|
46
|
+
export const PollQuestions: React.FC<PollQuestionsProps> = ({
|
|
47
|
+
currentIdx,
|
|
48
|
+
dismissModal,
|
|
49
|
+
unmountScreenWithAnimation,
|
|
50
|
+
}) => {
|
|
39
51
|
const dispatch = useDispatch();
|
|
40
52
|
const hmsInstance = useHMSInstance();
|
|
41
53
|
const reduxStore = useStore<RootState>();
|
|
@@ -45,6 +57,10 @@ export const PollQuestions: React.FC<PollQuestionsProps> = ({}) => {
|
|
|
45
57
|
const launchingPoll = useSelector(
|
|
46
58
|
(state: RootState) => state.polls.launchingPoll
|
|
47
59
|
);
|
|
60
|
+
const pollType = useSelector(
|
|
61
|
+
(state: RootState) => state.polls.pollConfig.type
|
|
62
|
+
);
|
|
63
|
+
const headerTitle = useSelector((state: RootState) => state.polls.pollName);
|
|
48
64
|
const questions = useSelector((state: RootState) => state.polls.questions);
|
|
49
65
|
|
|
50
66
|
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
@@ -52,31 +68,22 @@ export const PollQuestions: React.FC<PollQuestionsProps> = ({}) => {
|
|
|
52
68
|
color: theme.palette.on_surface_medium,
|
|
53
69
|
fontFamily: `${typography.font_family}-Regular`,
|
|
54
70
|
},
|
|
71
|
+
headerText: {
|
|
72
|
+
color: theme.palette.on_surface_high,
|
|
73
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
74
|
+
},
|
|
75
|
+
container: {
|
|
76
|
+
backgroundColor: theme.palette.surface_dim,
|
|
77
|
+
},
|
|
55
78
|
}));
|
|
56
79
|
|
|
57
80
|
const disableLaunchPoll =
|
|
58
|
-
questions.length <= 0 ||
|
|
59
|
-
questions.some(
|
|
60
|
-
(question) =>
|
|
61
|
-
!question.title ||
|
|
62
|
-
!question.saved ||
|
|
63
|
-
(Array.isArray(question.options) &&
|
|
64
|
-
(question.options.length <= 1 ||
|
|
65
|
-
question.options.some((option) => !option)))
|
|
66
|
-
);
|
|
81
|
+
questions.length <= 0 || questions.some((question) => !question.saved);
|
|
67
82
|
|
|
68
83
|
const launchPoll = async () => {
|
|
69
84
|
try {
|
|
70
85
|
const pollsData = reduxStore.getState().polls;
|
|
71
|
-
|
|
72
|
-
if (
|
|
73
|
-
!pollsData.pollName ||
|
|
74
|
-
pollsData.questions.some(
|
|
75
|
-
(question) =>
|
|
76
|
-
!question.title ||
|
|
77
|
-
(question.options && question.options.some((option) => !option))
|
|
78
|
-
)
|
|
79
|
-
) {
|
|
86
|
+
if (!pollsData.pollName || disableLaunchPoll) {
|
|
80
87
|
console.log('Incorrect data!');
|
|
81
88
|
return;
|
|
82
89
|
}
|
|
@@ -84,19 +91,32 @@ export const PollQuestions: React.FC<PollQuestionsProps> = ({}) => {
|
|
|
84
91
|
|
|
85
92
|
const result = await hmsInstance.interactivityCenter.startPoll({
|
|
86
93
|
title: pollsData.pollName,
|
|
87
|
-
type:
|
|
94
|
+
type: pollType,
|
|
88
95
|
rolesThatCanViewResponses:
|
|
89
|
-
|
|
96
|
+
pollType === HMSPollType.poll &&
|
|
97
|
+
pollsData.pollConfig.voteCountHidden &&
|
|
98
|
+
localPeerRole
|
|
90
99
|
? [localPeerRole]
|
|
91
100
|
: undefined,
|
|
92
101
|
// mode: HMSPollUserTrackingMode.customerUserID, // mode: null, // `pollsData.pollConfig.resultsAnonymous` Make results anonymous set user tracking mode to none
|
|
93
|
-
questions: pollsData.questions.map((question) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
questions: pollsData.questions.map((question) => {
|
|
103
|
+
const weight = parseInt(question.pointWeightage);
|
|
104
|
+
return {
|
|
105
|
+
skippable: question.skippable,
|
|
106
|
+
once: !question.responseEditable,
|
|
107
|
+
text: question.title,
|
|
108
|
+
type: question.type,
|
|
109
|
+
weight:
|
|
110
|
+
pollType === HMSPollType.quiz && !isNaN(weight)
|
|
111
|
+
? weight
|
|
112
|
+
: undefined,
|
|
113
|
+
options: question.options?.map((option) =>
|
|
114
|
+
pollType === HMSPollType.quiz
|
|
115
|
+
? { text: option[1], isCorrectAnswer: option[0] }
|
|
116
|
+
: { text: option[1] }
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
}),
|
|
100
120
|
});
|
|
101
121
|
|
|
102
122
|
console.log('quickStartPoll result > ', result);
|
|
@@ -144,6 +164,10 @@ export const PollQuestions: React.FC<PollQuestionsProps> = ({}) => {
|
|
|
144
164
|
setPollQuestionType(questionIndex, value as HMSPollQuestionType)
|
|
145
165
|
);
|
|
146
166
|
break;
|
|
167
|
+
case 'pointWeightage':
|
|
168
|
+
const cleanNumber = (value as string).replace(/[^0-9]/g, '');
|
|
169
|
+
dispatch(setPollQuestionPointWeightage(questionIndex, cleanNumber));
|
|
170
|
+
break;
|
|
147
171
|
}
|
|
148
172
|
},
|
|
149
173
|
[]
|
|
@@ -170,57 +194,126 @@ export const PollQuestions: React.FC<PollQuestionsProps> = ({}) => {
|
|
|
170
194
|
[]
|
|
171
195
|
);
|
|
172
196
|
|
|
197
|
+
const handleSetPollQuestionCorrectOption = React.useCallback(
|
|
198
|
+
(questionIndex: number, optionIndex: number, corectOption: boolean) => {
|
|
199
|
+
dispatch(
|
|
200
|
+
setPollQuestionCorrectOption(questionIndex, optionIndex, corectOption)
|
|
201
|
+
);
|
|
202
|
+
},
|
|
203
|
+
[]
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
const handleBackPress = () => {
|
|
207
|
+
Keyboard.dismiss();
|
|
208
|
+
if (typeof unmountScreenWithAnimation === 'function') {
|
|
209
|
+
unmountScreenWithAnimation(() => dispatch(popFromNavigationStack()));
|
|
210
|
+
} else {
|
|
211
|
+
dispatch(popFromNavigationStack());
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const handleClosePress = () => {
|
|
216
|
+
Keyboard.dismiss();
|
|
217
|
+
dismissModal();
|
|
218
|
+
};
|
|
219
|
+
|
|
173
220
|
return (
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
221
|
+
<View style={[styles.fullView, hmsRoomStyles.container]}>
|
|
222
|
+
{/* Header */}
|
|
223
|
+
<View style={styles.header}>
|
|
224
|
+
<View style={styles.headerControls}>
|
|
225
|
+
{currentIdx > 0 ? (
|
|
226
|
+
<TouchableOpacity
|
|
227
|
+
onPress={handleBackPress}
|
|
228
|
+
disabled={launchingPoll}
|
|
229
|
+
hitSlop={styles.closeIconHitSlop}
|
|
230
|
+
style={[styles.backIcon, launchingPoll ? { opacity: 0.4 } : null]}
|
|
231
|
+
>
|
|
232
|
+
<ChevronIcon direction="left" />
|
|
233
|
+
</TouchableOpacity>
|
|
234
|
+
) : null}
|
|
183
235
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
);
|
|
196
|
-
})}
|
|
236
|
+
<Text
|
|
237
|
+
numberOfLines={2}
|
|
238
|
+
style={[
|
|
239
|
+
styles.headerText,
|
|
240
|
+
{ flexShrink: 1 },
|
|
241
|
+
hmsRoomStyles.headerText,
|
|
242
|
+
]}
|
|
243
|
+
>
|
|
244
|
+
{headerTitle}
|
|
245
|
+
</Text>
|
|
246
|
+
</View>
|
|
197
247
|
|
|
198
|
-
<View style={[styles.addOptionWrapper, { marginTop: 16 }]}>
|
|
199
248
|
<TouchableOpacity
|
|
200
|
-
onPress={
|
|
201
|
-
|
|
202
|
-
style={
|
|
203
|
-
styles.addOptionContainer,
|
|
204
|
-
launchingPoll ? { opacity: 0.4 } : null,
|
|
205
|
-
]}
|
|
249
|
+
onPress={handleClosePress}
|
|
250
|
+
hitSlop={styles.closeIconHitSlop}
|
|
251
|
+
style={{ marginLeft: 16 }}
|
|
206
252
|
>
|
|
207
|
-
<
|
|
208
|
-
<AddIcon type="circle" />
|
|
209
|
-
</View>
|
|
210
|
-
<Text style={[styles.smallText, hmsRoomStyles.regularMediumText]}>
|
|
211
|
-
Add another question
|
|
212
|
-
</Text>
|
|
253
|
+
<CloseIcon />
|
|
213
254
|
</TouchableOpacity>
|
|
214
255
|
</View>
|
|
215
256
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
257
|
+
{/* Divider */}
|
|
258
|
+
<BottomSheet.Divider style={styles.halfDivider} />
|
|
259
|
+
|
|
260
|
+
<ScrollView
|
|
261
|
+
style={styles.contentContainer}
|
|
262
|
+
contentContainerStyle={{ paddingTop: 24 }}
|
|
263
|
+
>
|
|
264
|
+
{questions.map((pollQuestion, idx, arr) => {
|
|
265
|
+
const isFirst = idx === 0;
|
|
266
|
+
return (
|
|
267
|
+
<React.Fragment key={idx}>
|
|
268
|
+
{isFirst ? null : <View style={{ height: 16 }} />}
|
|
269
|
+
|
|
270
|
+
<PollQuestion
|
|
271
|
+
totalQuestions={arr.length}
|
|
272
|
+
currentQuestionIndex={idx}
|
|
273
|
+
pollQuestion={pollQuestion}
|
|
274
|
+
onAddPollQuestionOption={handleAddPollQuestionOption}
|
|
275
|
+
onDeletePollQuestionOption={handleDeletePollQuestionOption}
|
|
276
|
+
onEditPollQuestionOption={handleEditPollQuestionOption}
|
|
277
|
+
onSetPollQuestionCorrectOption={
|
|
278
|
+
handleSetPollQuestionCorrectOption
|
|
279
|
+
}
|
|
280
|
+
onQuestionFieldChange={onQuestionFieldChange}
|
|
281
|
+
onDelete={deleteQuestion}
|
|
282
|
+
/>
|
|
283
|
+
</React.Fragment>
|
|
284
|
+
);
|
|
285
|
+
})}
|
|
286
|
+
|
|
287
|
+
<View style={[styles.addOptionWrapper, { marginTop: 16 }]}>
|
|
288
|
+
<TouchableOpacity
|
|
289
|
+
onPress={addQuestion}
|
|
290
|
+
disabled={launchingPoll}
|
|
291
|
+
style={[
|
|
292
|
+
styles.addOptionContainer,
|
|
293
|
+
launchingPoll ? { opacity: 0.4 } : null,
|
|
294
|
+
]}
|
|
295
|
+
>
|
|
296
|
+
<View style={styles.addOptionIconWrapper}>
|
|
297
|
+
<AddIcon type="circle" />
|
|
298
|
+
</View>
|
|
299
|
+
<Text style={[styles.smallText, hmsRoomStyles.regularMediumText]}>
|
|
300
|
+
Add another question
|
|
301
|
+
</Text>
|
|
302
|
+
</TouchableOpacity>
|
|
303
|
+
</View>
|
|
304
|
+
|
|
305
|
+
<HMSPrimaryButton
|
|
306
|
+
disabled={disableLaunchPoll || launchingPoll}
|
|
307
|
+
title={`Launch ${pollType === HMSPollType.quiz ? 'Quiz' : 'Poll'}`}
|
|
308
|
+
loading={launchingPoll}
|
|
309
|
+
onPress={launchPoll}
|
|
310
|
+
style={{ marginTop: 16, marginBottom: 56, alignSelf: 'flex-end' }}
|
|
311
|
+
/>
|
|
312
|
+
</ScrollView>
|
|
313
|
+
|
|
314
|
+
{/* Modal */}
|
|
315
|
+
<PollQDeleteConfirmationSheetView />
|
|
316
|
+
</View>
|
|
224
317
|
);
|
|
225
318
|
};
|
|
226
319
|
|
|
@@ -256,4 +349,51 @@ const styles = StyleSheet.create({
|
|
|
256
349
|
marginRight: 8,
|
|
257
350
|
padding: 8,
|
|
258
351
|
},
|
|
352
|
+
|
|
353
|
+
// -------
|
|
354
|
+
|
|
355
|
+
// Utilities
|
|
356
|
+
fullView: {
|
|
357
|
+
flex: 1,
|
|
358
|
+
},
|
|
359
|
+
// Header
|
|
360
|
+
header: {
|
|
361
|
+
flexDirection: 'row',
|
|
362
|
+
alignItems: 'center',
|
|
363
|
+
justifyContent: 'space-between',
|
|
364
|
+
marginTop: 24,
|
|
365
|
+
marginHorizontal: 24,
|
|
366
|
+
},
|
|
367
|
+
headerControls: {
|
|
368
|
+
flexDirection: 'row',
|
|
369
|
+
alignItems: 'center',
|
|
370
|
+
flexShrink: 1,
|
|
371
|
+
},
|
|
372
|
+
headerText: {
|
|
373
|
+
fontSize: 20,
|
|
374
|
+
lineHeight: 24,
|
|
375
|
+
letterSpacing: 0.15,
|
|
376
|
+
marginRight: 12,
|
|
377
|
+
},
|
|
378
|
+
closeIconHitSlop: {
|
|
379
|
+
bottom: 16,
|
|
380
|
+
left: 16,
|
|
381
|
+
right: 16,
|
|
382
|
+
top: 16,
|
|
383
|
+
},
|
|
384
|
+
backIcon: {
|
|
385
|
+
marginRight: 8,
|
|
386
|
+
},
|
|
387
|
+
// Divider
|
|
388
|
+
halfDivider: {
|
|
389
|
+
marginHorizontal: 24,
|
|
390
|
+
marginVertical: 0,
|
|
391
|
+
marginTop: 24,
|
|
392
|
+
width: undefined,
|
|
393
|
+
},
|
|
394
|
+
divider: {
|
|
395
|
+
marginHorizontal: 24,
|
|
396
|
+
marginVertical: 24,
|
|
397
|
+
width: undefined,
|
|
398
|
+
},
|
|
259
399
|
});
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
4
4
|
|
|
5
5
|
import { BottomSheet } from './BottomSheet';
|
|
6
|
-
import {
|
|
7
|
-
useHMSRoomStyleSheet,
|
|
8
|
-
useIsHLSViewer,
|
|
9
|
-
useModalType,
|
|
10
|
-
} from '../hooks-util';
|
|
6
|
+
import { useHMSRoomStyleSheet, useModalType } from '../hooks-util';
|
|
11
7
|
import { useHeaderHeight } from './Header';
|
|
12
8
|
import { useIsLandscapeOrientation } from '../utils/dimension';
|
|
13
9
|
import { PollsAndQuizzesModalContent } from './PollsAndQuizzesModalContent';
|
|
14
10
|
import { ModalTypes } from '../utils/types';
|
|
15
|
-
import
|
|
16
|
-
import { CreatePollStages } from '../redux/actionTypes';
|
|
17
|
-
import { visiblePollsSelector } from '../utils/functions';
|
|
11
|
+
import { resetNavigationStack } from '../redux/actions';
|
|
18
12
|
|
|
19
13
|
export const PollsAndQuizBottomSheet = () => {
|
|
14
|
+
const dispatch = useDispatch();
|
|
20
15
|
const headerHeight = useHeaderHeight();
|
|
21
16
|
const isLandscapeOrientation = useIsLandscapeOrientation();
|
|
22
17
|
const {
|
|
@@ -24,40 +19,26 @@ export const PollsAndQuizBottomSheet = () => {
|
|
|
24
19
|
handleModalVisibleType: setModalVisible,
|
|
25
20
|
} = useModalType();
|
|
26
21
|
|
|
27
|
-
const isPollQuestionStage = useSelector(
|
|
28
|
-
(state: RootState) =>
|
|
29
|
-
state.polls.stage === CreatePollStages.POLL_QUESTION_CONFIG
|
|
30
|
-
);
|
|
31
|
-
const isHLSViewer = useIsHLSViewer();
|
|
32
|
-
const havePolls = useSelector(
|
|
33
|
-
(state: RootState) =>
|
|
34
|
-
visiblePollsSelector(
|
|
35
|
-
Object.values(state.polls.polls),
|
|
36
|
-
isHLSViewer,
|
|
37
|
-
state.polls.cuedPollIds
|
|
38
|
-
).length > 0
|
|
39
|
-
);
|
|
40
|
-
|
|
41
22
|
const hmsRoomStyles = useHMSRoomStyleSheet((theme) => ({
|
|
42
23
|
contentContainer: {
|
|
43
24
|
backgroundColor: theme.palette.surface_dim,
|
|
44
25
|
},
|
|
45
26
|
}));
|
|
46
27
|
|
|
47
|
-
const dismissModal = () =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
28
|
+
const dismissModal = () => {
|
|
29
|
+
setModalVisible(ModalTypes.DEFAULT);
|
|
30
|
+
dispatch(resetNavigationStack());
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const containerStyles = [
|
|
34
|
+
styles.bottomSheet,
|
|
35
|
+
{
|
|
36
|
+
marginTop: isLandscapeOrientation
|
|
37
|
+
? 0
|
|
38
|
+
: headerHeight + (Platform.OS === 'android' ? 24 : 0),
|
|
39
|
+
},
|
|
40
|
+
hmsRoomStyles.contentContainer,
|
|
41
|
+
];
|
|
61
42
|
|
|
62
43
|
return (
|
|
63
44
|
<BottomSheet
|
|
@@ -66,12 +47,9 @@ export const PollsAndQuizBottomSheet = () => {
|
|
|
66
47
|
isVisible={modalVisible === ModalTypes.POLLS_AND_QUIZZES}
|
|
67
48
|
avoidKeyboard={true}
|
|
68
49
|
containerStyle={containerStyles}
|
|
69
|
-
bottomOffsetSpace={
|
|
50
|
+
bottomOffsetSpace={0}
|
|
70
51
|
>
|
|
71
|
-
<PollsAndQuizzesModalContent
|
|
72
|
-
fullHeight={fullHeight}
|
|
73
|
-
dismissModal={dismissModal}
|
|
74
|
-
/>
|
|
52
|
+
<PollsAndQuizzesModalContent dismissModal={dismissModal} />
|
|
75
53
|
</BottomSheet>
|
|
76
54
|
);
|
|
77
55
|
};
|
|
@@ -5,7 +5,7 @@ import type { HMSPoll } from '@100mslive/react-native-hms';
|
|
|
5
5
|
|
|
6
6
|
import { useHMSRoomStyleSheet } from '../hooks-util';
|
|
7
7
|
import { HMSPrimaryButton } from './HMSPrimaryButton';
|
|
8
|
-
import {
|
|
8
|
+
import { pushToNavigationStack, setSelectedPollId } from '../redux/actions';
|
|
9
9
|
import { CreatePollStages } from '../redux/actionTypes';
|
|
10
10
|
import { PollAndQuizzStateLabel } from './PollAndQuizzStateLabel';
|
|
11
11
|
|
|
@@ -36,7 +36,7 @@ export const PollsAndQuizzesCard: React.FC<PollsAndQuizzesCardProps> = ({
|
|
|
36
36
|
|
|
37
37
|
const viewPoll = () => {
|
|
38
38
|
batch(() => {
|
|
39
|
-
dispatch(
|
|
39
|
+
dispatch(pushToNavigationStack(CreatePollStages.POLL_VOTING));
|
|
40
40
|
dispatch(setSelectedPollId(poll.pollId));
|
|
41
41
|
});
|
|
42
42
|
};
|