@100mslive/react-native-room-kit 1.1.0 → 1.1.2
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 +47 -0
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Add/assets/add-circle.png +0 -0
- package/lib/commonjs/Icons/Add/assets/add-circle@2x.png +0 -0
- package/lib/commonjs/Icons/Add/assets/add-circle@3x.png +0 -0
- package/lib/commonjs/Icons/Add/index.js +35 -0
- package/lib/commonjs/Icons/Add/index.js.map +1 -0
- 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/assets/checkbox-checked.png +0 -0
- package/lib/commonjs/Icons/CheckBox/assets/checkbox-checked@2x.png +0 -0
- package/lib/commonjs/Icons/CheckBox/assets/checkbox-checked@3x.png +0 -0
- package/lib/commonjs/Icons/CheckBox/assets/checkbox.png +0 -0
- package/lib/commonjs/Icons/CheckBox/assets/checkbox@2x.png +0 -0
- package/lib/commonjs/Icons/CheckBox/assets/checkbox@3x.png +0 -0
- package/lib/commonjs/Icons/CheckBox/index.js +41 -0
- package/lib/commonjs/Icons/CheckBox/index.js.map +1 -0
- package/lib/commonjs/Icons/Poll/assets/poll.png +0 -0
- package/lib/commonjs/Icons/Poll/assets/poll@2x.png +0 -0
- package/lib/commonjs/Icons/Poll/assets/poll@3x.png +0 -0
- package/lib/commonjs/Icons/Poll/index.js +33 -0
- package/lib/commonjs/Icons/Poll/index.js.map +1 -0
- package/lib/commonjs/Icons/PollVote/assets/poll-vote.png +0 -0
- package/lib/commonjs/Icons/PollVote/assets/poll-vote@2x.png +0 -0
- package/lib/commonjs/Icons/PollVote/assets/poll-vote@3x.png +0 -0
- package/lib/commonjs/Icons/PollVote/index.js +33 -0
- package/lib/commonjs/Icons/PollVote/index.js.map +1 -0
- package/lib/commonjs/Icons/Quiz/assets/quiz.png +0 -0
- package/lib/commonjs/Icons/Quiz/assets/quiz@2x.png +0 -0
- package/lib/commonjs/Icons/Quiz/assets/quiz@3x.png +0 -0
- package/lib/commonjs/Icons/Quiz/index.js +33 -0
- package/lib/commonjs/Icons/Quiz/index.js.map +1 -0
- package/lib/commonjs/Icons/TrashBin/assets/trash-bin.png +0 -0
- package/lib/commonjs/Icons/TrashBin/assets/trash-bin@2x.png +0 -0
- package/lib/commonjs/Icons/TrashBin/assets/trash-bin@3x.png +0 -0
- package/lib/commonjs/Icons/TrashBin/index.js +34 -0
- package/lib/commonjs/Icons/TrashBin/index.js.map +1 -0
- package/lib/commonjs/Icons/index.js +66 -0
- package/lib/commonjs/Icons/index.js.map +1 -1
- package/lib/commonjs/components/CheckboxInputRow.js +53 -0
- package/lib/commonjs/components/CheckboxInputRow.js.map +1 -0
- package/lib/commonjs/components/CreatePoll.js +209 -0
- package/lib/commonjs/components/CreatePoll.js.map +1 -0
- package/lib/commonjs/components/Footer.js +6 -1
- package/lib/commonjs/components/Footer.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/HLSPlayerEmoticons.js +2 -3
- package/lib/commonjs/components/HLSPlayerEmoticons.js.map +1 -1
- package/lib/commonjs/components/HMSBaseButton.js +4 -2
- package/lib/commonjs/components/HMSBaseButton.js.map +1 -1
- package/lib/commonjs/components/HMSNotification.js +5 -1
- package/lib/commonjs/components/HMSNotification.js.map +1 -1
- package/lib/commonjs/components/HMSNotifications.js +4 -0
- package/lib/commonjs/components/HMSNotifications.js.map +1 -1
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js +95 -0
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -0
- package/lib/commonjs/components/HMSRoomOptions.js +2 -1
- package/lib/commonjs/components/HMSRoomOptions.js.map +1 -1
- package/lib/commonjs/components/HMSSecondaryButton.js +56 -0
- package/lib/commonjs/components/HMSSecondaryButton.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js +233 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizVoting.js +135 -0
- package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizzStateLabel.js +72 -0
- package/lib/commonjs/components/PollAndQuizzStateLabel.js.map +1 -0
- package/lib/commonjs/components/PollQDeleteConfirmationSheetView.js +68 -0
- package/lib/commonjs/components/PollQDeleteConfirmationSheetView.js.map +1 -0
- package/lib/commonjs/components/PollQuestion.js +424 -0
- package/lib/commonjs/components/PollQuestion.js.map +1 -0
- package/lib/commonjs/components/PollQuestionDeleteConfirmation.js +97 -0
- package/lib/commonjs/components/PollQuestionDeleteConfirmation.js.map +1 -0
- package/lib/commonjs/components/PollQuestions.js +203 -0
- package/lib/commonjs/components/PollQuestions.js.map +1 -0
- package/lib/commonjs/components/PollResponseProgressView.js +68 -0
- package/lib/commonjs/components/PollResponseProgressView.js.map +1 -0
- package/lib/commonjs/components/PollsAndQuizBottomSheet.js +59 -0
- package/lib/commonjs/components/PollsAndQuizBottomSheet.js.map +1 -0
- package/lib/commonjs/components/PollsAndQuizzesCard.js +97 -0
- package/lib/commonjs/components/PollsAndQuizzesCard.js.map +1 -0
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js +159 -0
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -0
- package/lib/commonjs/components/PollsConfigAndList.js +32 -0
- package/lib/commonjs/components/PollsConfigAndList.js.map +1 -0
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +76 -0
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -0
- package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
- package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
- package/lib/commonjs/components/RadioInput.js +49 -0
- package/lib/commonjs/components/RadioInput.js.map +1 -0
- package/lib/commonjs/components/RadioInputRow.js +57 -0
- package/lib/commonjs/components/RadioInputRow.js.map +1 -0
- package/lib/commonjs/components/RoomSettingsModalContent.js +31 -6
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/SwitchRow.js +2 -1
- package/lib/commonjs/components/SwitchRow.js.map +1 -1
- package/lib/commonjs/components/TilesContainer.js +3 -4
- package/lib/commonjs/components/TilesContainer.js.map +1 -1
- package/lib/commonjs/hooks-util.js +26 -1
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +40 -1
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +153 -1
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/index.js +3 -1
- package/lib/commonjs/redux/reducers/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/polls.js +278 -0
- package/lib/commonjs/redux/reducers/polls.js.map +1 -0
- package/lib/commonjs/types.js +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/functions.js +52 -2
- package/lib/commonjs/utils/functions.js.map +1 -1
- package/lib/commonjs/utils/types.js +1 -0
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +50 -3
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Add/assets/add-circle.png +0 -0
- package/lib/module/Icons/Add/assets/add-circle@2x.png +0 -0
- package/lib/module/Icons/Add/assets/add-circle@3x.png +0 -0
- package/lib/module/Icons/Add/index.js +27 -0
- package/lib/module/Icons/Add/index.js.map +1 -0
- 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/assets/checkbox-checked.png +0 -0
- package/lib/module/Icons/CheckBox/assets/checkbox-checked@2x.png +0 -0
- package/lib/module/Icons/CheckBox/assets/checkbox-checked@3x.png +0 -0
- package/lib/module/Icons/CheckBox/assets/checkbox.png +0 -0
- package/lib/module/Icons/CheckBox/assets/checkbox@2x.png +0 -0
- package/lib/module/Icons/CheckBox/assets/checkbox@3x.png +0 -0
- package/lib/module/Icons/CheckBox/index.js +33 -0
- package/lib/module/Icons/CheckBox/index.js.map +1 -0
- package/lib/module/Icons/Poll/assets/poll.png +0 -0
- package/lib/module/Icons/Poll/assets/poll@2x.png +0 -0
- package/lib/module/Icons/Poll/assets/poll@3x.png +0 -0
- package/lib/module/Icons/Poll/index.js +25 -0
- package/lib/module/Icons/Poll/index.js.map +1 -0
- package/lib/module/Icons/PollVote/assets/poll-vote.png +0 -0
- package/lib/module/Icons/PollVote/assets/poll-vote@2x.png +0 -0
- package/lib/module/Icons/PollVote/assets/poll-vote@3x.png +0 -0
- package/lib/module/Icons/PollVote/index.js +25 -0
- package/lib/module/Icons/PollVote/index.js.map +1 -0
- package/lib/module/Icons/Quiz/assets/quiz.png +0 -0
- package/lib/module/Icons/Quiz/assets/quiz@2x.png +0 -0
- package/lib/module/Icons/Quiz/assets/quiz@3x.png +0 -0
- package/lib/module/Icons/Quiz/index.js +25 -0
- package/lib/module/Icons/Quiz/index.js.map +1 -0
- package/lib/module/Icons/TrashBin/assets/trash-bin.png +0 -0
- package/lib/module/Icons/TrashBin/assets/trash-bin@2x.png +0 -0
- package/lib/module/Icons/TrashBin/assets/trash-bin@3x.png +0 -0
- package/lib/module/Icons/TrashBin/index.js +26 -0
- package/lib/module/Icons/TrashBin/index.js.map +1 -0
- package/lib/module/Icons/index.js +6 -0
- package/lib/module/Icons/index.js.map +1 -1
- package/lib/module/components/CheckboxInputRow.js +45 -0
- package/lib/module/components/CheckboxInputRow.js.map +1 -0
- package/lib/module/components/CreatePoll.js +200 -0
- package/lib/module/components/CreatePoll.js.map +1 -0
- package/lib/module/components/Footer.js +6 -1
- package/lib/module/components/Footer.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/HLSPlayerEmoticons.js +2 -3
- package/lib/module/components/HLSPlayerEmoticons.js.map +1 -1
- package/lib/module/components/HMSBaseButton.js +5 -3
- package/lib/module/components/HMSBaseButton.js.map +1 -1
- package/lib/module/components/HMSNotification.js +5 -1
- package/lib/module/components/HMSNotification.js.map +1 -1
- package/lib/module/components/HMSNotifications.js +4 -0
- package/lib/module/components/HMSNotifications.js.map +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js +86 -0
- package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -0
- package/lib/module/components/HMSRoomOptions.js +2 -1
- package/lib/module/components/HMSRoomOptions.js.map +1 -1
- package/lib/module/components/HMSSecondaryButton.js +47 -0
- package/lib/module/components/HMSSecondaryButton.js.map +1 -0
- package/lib/module/components/PollAndQuizQuestionResponseCard.js +224 -0
- package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -0
- package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
- package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/module/components/PollAndQuizVoting.js +126 -0
- package/lib/module/components/PollAndQuizVoting.js.map +1 -0
- package/lib/module/components/PollAndQuizzStateLabel.js +63 -0
- package/lib/module/components/PollAndQuizzStateLabel.js.map +1 -0
- package/lib/module/components/PollQDeleteConfirmationSheetView.js +60 -0
- package/lib/module/components/PollQDeleteConfirmationSheetView.js.map +1 -0
- package/lib/module/components/PollQuestion.js +415 -0
- package/lib/module/components/PollQuestion.js.map +1 -0
- package/lib/module/components/PollQuestionDeleteConfirmation.js +88 -0
- package/lib/module/components/PollQuestionDeleteConfirmation.js.map +1 -0
- package/lib/module/components/PollQuestions.js +194 -0
- package/lib/module/components/PollQuestions.js.map +1 -0
- package/lib/module/components/PollResponseProgressView.js +59 -0
- package/lib/module/components/PollResponseProgressView.js.map +1 -0
- package/lib/module/components/PollsAndQuizBottomSheet.js +50 -0
- package/lib/module/components/PollsAndQuizBottomSheet.js.map +1 -0
- package/lib/module/components/PollsAndQuizzesCard.js +88 -0
- package/lib/module/components/PollsAndQuizzesCard.js.map +1 -0
- package/lib/module/components/PollsAndQuizzesModalContent.js +150 -0
- package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -0
- package/lib/module/components/PollsConfigAndList.js +23 -0
- package/lib/module/components/PollsConfigAndList.js.map +1 -0
- package/lib/module/components/PreviousPollsAndQuizzesList.js +67 -0
- package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -0
- package/lib/module/components/QuizEndOptionsView.js +54 -0
- package/lib/module/components/QuizEndOptionsView.js.map +1 -0
- package/lib/module/components/RadioInput.js +41 -0
- package/lib/module/components/RadioInput.js.map +1 -0
- package/lib/module/components/RadioInputRow.js +49 -0
- package/lib/module/components/RadioInputRow.js.map +1 -0
- package/lib/module/components/RoomSettingsModalContent.js +32 -7
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/SwitchRow.js +2 -1
- package/lib/module/components/SwitchRow.js.map +1 -1
- package/lib/module/components/TilesContainer.js +5 -6
- package/lib/module/components/TilesContainer.js.map +1 -1
- package/lib/module/hooks-util.js +26 -4
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/redux/actionTypes.js +41 -0
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +127 -1
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/index.js +3 -1
- package/lib/module/redux/reducers/index.js.map +1 -1
- package/lib/module/redux/reducers/polls.js +272 -0
- package/lib/module/redux/reducers/polls.js.map +1 -0
- package/lib/module/types.js +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/functions.js +45 -1
- package/lib/module/utils/functions.js.map +1 -1
- package/lib/module/utils/types.js +1 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Add/index.d.ts +8 -0
- package/lib/typescript/Icons/Add/index.d.ts.map +1 -0
- 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 +9 -0
- package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Poll/index.d.ts +7 -0
- package/lib/typescript/Icons/Poll/index.d.ts.map +1 -0
- package/lib/typescript/Icons/PollVote/index.d.ts +7 -0
- package/lib/typescript/Icons/PollVote/index.d.ts.map +1 -0
- package/lib/typescript/Icons/Quiz/index.d.ts +7 -0
- package/lib/typescript/Icons/Quiz/index.d.ts.map +1 -0
- package/lib/typescript/Icons/TrashBin/index.d.ts +7 -0
- package/lib/typescript/Icons/TrashBin/index.d.ts.map +1 -0
- package/lib/typescript/Icons/index.d.ts +6 -0
- package/lib/typescript/Icons/index.d.ts.map +1 -1
- package/lib/typescript/components/CheckboxInputRow.d.ts +13 -0
- package/lib/typescript/components/CheckboxInputRow.d.ts.map +1 -0
- package/lib/typescript/components/CreatePoll.d.ts +5 -0
- package/lib/typescript/components/CreatePoll.d.ts.map +1 -0
- package/lib/typescript/components/Footer.d.ts.map +1 -1
- package/lib/typescript/components/GridView.d.ts.map +1 -1
- package/lib/typescript/components/HLSPlayerEmoticons.d.ts.map +1 -1
- package/lib/typescript/components/HMSBaseButton.d.ts +2 -1
- package/lib/typescript/components/HMSBaseButton.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
- package/lib/typescript/components/HMSPollsQuizzesNotification.d.ts +7 -0
- package/lib/typescript/components/HMSPollsQuizzesNotification.d.ts.map +1 -0
- package/lib/typescript/components/HMSPrimaryButton.d.ts +1 -1
- package/lib/typescript/components/HMSPrimaryButton.d.ts.map +1 -1
- package/lib/typescript/components/HMSRoomOptions.d.ts.map +1 -1
- package/lib/typescript/components/HMSSecondaryButton.d.ts +15 -0
- package/lib/typescript/components/HMSSecondaryButton.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts +13 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts +6 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizzStateLabel.d.ts +7 -0
- package/lib/typescript/components/PollAndQuizzStateLabel.d.ts.map +1 -0
- package/lib/typescript/components/PollQDeleteConfirmationSheetView.d.ts +6 -0
- package/lib/typescript/components/PollQDeleteConfirmationSheetView.d.ts.map +1 -0
- package/lib/typescript/components/PollQuestion.d.ts +15 -0
- package/lib/typescript/components/PollQuestion.d.ts.map +1 -0
- package/lib/typescript/components/PollQuestionDeleteConfirmation.d.ts +6 -0
- package/lib/typescript/components/PollQuestionDeleteConfirmation.d.ts.map +1 -0
- package/lib/typescript/components/PollQuestions.d.ts +6 -0
- package/lib/typescript/components/PollQuestions.d.ts.map +1 -0
- package/lib/typescript/components/PollResponseProgressView.d.ts +9 -0
- package/lib/typescript/components/PollResponseProgressView.d.ts.map +1 -0
- package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts +3 -0
- package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/PollsAndQuizzesCard.d.ts +7 -0
- package/lib/typescript/components/PollsAndQuizzesCard.d.ts.map +1 -0
- package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts +7 -0
- package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts.map +1 -0
- package/lib/typescript/components/PollsConfigAndList.d.ts +5 -0
- package/lib/typescript/components/PollsConfigAndList.d.ts.map +1 -0
- package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts +5 -0
- package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts.map +1 -0
- package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
- package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
- package/lib/typescript/components/RadioInput.d.ts +10 -0
- package/lib/typescript/components/RadioInput.d.ts.map +1 -0
- package/lib/typescript/components/RadioInputRow.d.ts +16 -0
- package/lib/typescript/components/RadioInputRow.d.ts.map +1 -0
- package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/SwitchRow.d.ts +2 -1
- package/lib/typescript/components/SwitchRow.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts +1 -0
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +176 -0
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +38 -2
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +13 -0
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +13 -0
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/polls.d.ts +19 -0
- package/lib/typescript/redux/reducers/polls.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +3 -1
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/functions.d.ts +7 -1
- package/lib/typescript/utils/functions.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +1 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/HMSRoomSetup.tsx +62 -0
- package/src/Icons/Add/assets/add-circle.png +0 -0
- package/src/Icons/Add/assets/add-circle@2x.png +0 -0
- package/src/Icons/Add/assets/add-circle@3x.png +0 -0
- package/src/Icons/Add/index.tsx +37 -0
- 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/assets/checkbox-checked.png +0 -0
- package/src/Icons/CheckBox/assets/checkbox-checked@2x.png +0 -0
- package/src/Icons/CheckBox/assets/checkbox-checked@3x.png +0 -0
- package/src/Icons/CheckBox/assets/checkbox.png +0 -0
- package/src/Icons/CheckBox/assets/checkbox@2x.png +0 -0
- package/src/Icons/CheckBox/assets/checkbox@3x.png +0 -0
- package/src/Icons/CheckBox/index.tsx +54 -0
- package/src/Icons/Poll/assets/poll.png +0 -0
- package/src/Icons/Poll/assets/poll@2x.png +0 -0
- package/src/Icons/Poll/assets/poll@3x.png +0 -0
- package/src/Icons/Poll/index.tsx +30 -0
- package/src/Icons/PollVote/assets/poll-vote.png +0 -0
- package/src/Icons/PollVote/assets/poll-vote@2x.png +0 -0
- package/src/Icons/PollVote/assets/poll-vote@3x.png +0 -0
- package/src/Icons/PollVote/index.tsx +33 -0
- package/src/Icons/Quiz/assets/quiz.png +0 -0
- package/src/Icons/Quiz/assets/quiz@2x.png +0 -0
- package/src/Icons/Quiz/assets/quiz@3x.png +0 -0
- package/src/Icons/Quiz/index.tsx +30 -0
- package/src/Icons/TrashBin/assets/trash-bin.png +0 -0
- package/src/Icons/TrashBin/assets/trash-bin@2x.png +0 -0
- package/src/Icons/TrashBin/assets/trash-bin@3x.png +0 -0
- package/src/Icons/TrashBin/index.tsx +34 -0
- package/src/Icons/index.ts +6 -0
- package/src/components/CheckboxInputRow.tsx +68 -0
- package/src/components/CreatePoll.tsx +249 -0
- package/src/components/Footer.tsx +7 -1
- package/src/components/GridView.tsx +4 -14
- package/src/components/HLSPlayerEmoticons.tsx +2 -3
- package/src/components/HMSBaseButton.tsx +8 -3
- package/src/components/HMSNotification.tsx +1 -1
- package/src/components/HMSNotifications.tsx +7 -0
- package/src/components/HMSPollsQuizzesNotification.tsx +110 -0
- package/src/components/HMSPrimaryButton.tsx +1 -1
- package/src/components/HMSRoomOptions.tsx +3 -0
- package/src/components/HMSSecondaryButton.tsx +72 -0
- package/src/components/PollAndQuizQuestionResponseCard.tsx +414 -0
- package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
- package/src/components/PollAndQuizVoting.tsx +161 -0
- package/src/components/PollAndQuizzStateLabel.tsx +83 -0
- package/src/components/PollQDeleteConfirmationSheetView.tsx +82 -0
- package/src/components/PollQuestion.tsx +668 -0
- package/src/components/PollQuestionDeleteConfirmation.tsx +110 -0
- package/src/components/PollQuestions.tsx +277 -0
- package/src/components/PollResponseProgressView.tsx +77 -0
- package/src/components/PollsAndQuizBottomSheet.tsx +83 -0
- package/src/components/PollsAndQuizzesCard.tsx +111 -0
- package/src/components/PollsAndQuizzesModalContent.tsx +198 -0
- package/src/components/PollsConfigAndList.tsx +29 -0
- package/src/components/PreviousPollsAndQuizzesList.tsx +103 -0
- package/src/components/QuizEndOptionsView.tsx +71 -0
- package/src/components/RadioInput.tsx +56 -0
- package/src/components/RadioInputRow.tsx +73 -0
- package/src/components/RoomSettingsModalContent.tsx +23 -0
- package/src/components/SwitchRow.tsx +4 -2
- package/src/components/TilesContainer.tsx +4 -4
- package/src/hooks-util.ts +40 -1
- package/src/redux/actionTypes.ts +241 -0
- package/src/redux/actions/index.ts +240 -1
- package/src/redux/reducers/index.ts +2 -0
- package/src/redux/reducers/polls.ts +378 -0
- package/src/types.ts +2 -0
- package/src/utils/functions.ts +98 -0
- package/src/utils/types.ts +1 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
5
|
+
import {
|
|
6
|
+
HMSPollQuestionType,
|
|
7
|
+
HMSPollState,
|
|
8
|
+
HMSPollType,
|
|
9
|
+
} from '@100mslive/react-native-hms';
|
|
10
|
+
import type {
|
|
11
|
+
HMSPoll,
|
|
12
|
+
HMSPollQuestion,
|
|
13
|
+
HMSPollQuestionOption,
|
|
14
|
+
} from '@100mslive/react-native-hms';
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
useHMSInstance,
|
|
18
|
+
useHMSRoomColorPalette,
|
|
19
|
+
useHMSRoomStyleSheet,
|
|
20
|
+
} from '../hooks-util';
|
|
21
|
+
import { RadioInputRow } from './RadioInputRow';
|
|
22
|
+
import { HMSPrimaryButton } from './HMSPrimaryButton';
|
|
23
|
+
import { HMSBaseButton } from './HMSBaseButton';
|
|
24
|
+
import type { RootState } from '../redux';
|
|
25
|
+
import {
|
|
26
|
+
addPollQuestionResponse,
|
|
27
|
+
removePollQuestionResponse,
|
|
28
|
+
setPollQuestionResponse,
|
|
29
|
+
} from '../redux/actions';
|
|
30
|
+
import { PollResponseProgressView } from './PollResponseProgressView';
|
|
31
|
+
import { CheckboxInputRow } from './CheckboxInputRow';
|
|
32
|
+
import {
|
|
33
|
+
checkIsCorrectAnswer,
|
|
34
|
+
checkIsCorrectOption,
|
|
35
|
+
checkIsSelected,
|
|
36
|
+
getLabelFromPollQuestionType,
|
|
37
|
+
} from '../utils/functions';
|
|
38
|
+
import { CheckIcon, CrossCircleIcon } from '../Icons';
|
|
39
|
+
import { QuizEndOptionsView } from './QuizEndOptionsView';
|
|
40
|
+
|
|
41
|
+
export interface PollAndQuizQuestionResponseCardProps {
|
|
42
|
+
pollId: HMSPoll['pollId'];
|
|
43
|
+
pollState: HMSPoll['state'];
|
|
44
|
+
totalQuestions: number;
|
|
45
|
+
pollQuestion: HMSPollQuestion;
|
|
46
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
47
|
+
onSubmit?: (d: any) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const PollAndQuizQuestionResponseCard: React.FC<
|
|
51
|
+
PollAndQuizQuestionResponseCardProps
|
|
52
|
+
> = ({
|
|
53
|
+
pollState,
|
|
54
|
+
totalQuestions,
|
|
55
|
+
pollId,
|
|
56
|
+
pollQuestion,
|
|
57
|
+
containerStyle,
|
|
58
|
+
onSubmit,
|
|
59
|
+
}) => {
|
|
60
|
+
const {
|
|
61
|
+
primary_bright: primaryBrightColor,
|
|
62
|
+
on_surface_low: onSurfaceLowColor,
|
|
63
|
+
} = useHMSRoomColorPalette();
|
|
64
|
+
|
|
65
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
66
|
+
container: {
|
|
67
|
+
backgroundColor: theme.palette.surface_default,
|
|
68
|
+
borderColor: theme.palette.surface_default,
|
|
69
|
+
},
|
|
70
|
+
surfaceLowSemiBoldText: {
|
|
71
|
+
color: theme.palette.on_surface_low,
|
|
72
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
73
|
+
},
|
|
74
|
+
surfaceHighRegularText: {
|
|
75
|
+
color: theme.palette.on_surface_high,
|
|
76
|
+
fontFamily: `${typography.font_family}-Regular`,
|
|
77
|
+
},
|
|
78
|
+
wrongAnswer: {
|
|
79
|
+
borderColor: theme.palette.alert_error_default,
|
|
80
|
+
},
|
|
81
|
+
correctAnswer: {
|
|
82
|
+
borderColor: theme.palette.alert_success,
|
|
83
|
+
},
|
|
84
|
+
wrongAnswerText: {
|
|
85
|
+
color: theme.palette.alert_error_default,
|
|
86
|
+
},
|
|
87
|
+
correctAnswerText: {
|
|
88
|
+
color: theme.palette.alert_success,
|
|
89
|
+
},
|
|
90
|
+
wrongAnswerIcon: {
|
|
91
|
+
tintColor: theme.palette.alert_error_default,
|
|
92
|
+
},
|
|
93
|
+
correctAnswerIcon: {
|
|
94
|
+
tintColor: theme.palette.alert_success,
|
|
95
|
+
},
|
|
96
|
+
skipButton: {
|
|
97
|
+
borderColor: theme.palette.border_bright,
|
|
98
|
+
borderWidth: 1,
|
|
99
|
+
marginRight: 16,
|
|
100
|
+
},
|
|
101
|
+
skipButtonText: {
|
|
102
|
+
color: theme.palette.on_surface_high,
|
|
103
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
104
|
+
},
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
// variable to save timestamp when the question became visible to user
|
|
108
|
+
const startTime = React.useRef<number | null>(null);
|
|
109
|
+
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
startTime.current = Date.now();
|
|
112
|
+
}, [pollQuestion.index]);
|
|
113
|
+
|
|
114
|
+
const hmsInstance = useHMSInstance();
|
|
115
|
+
const dispatch = useDispatch();
|
|
116
|
+
|
|
117
|
+
const selectedOptions = useSelector(
|
|
118
|
+
(state: RootState) =>
|
|
119
|
+
state.polls.pollsResponses[pollId]?.[pollQuestion.index] ?? null
|
|
120
|
+
);
|
|
121
|
+
const pollType = useSelector(
|
|
122
|
+
(state: RootState) => state.polls.polls[pollId]?.type ?? HMSPollType.poll
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const canViewPollResponse = useSelector((state: RootState) => {
|
|
126
|
+
const localPeerRole = state.hmsStates.localPeer?.role;
|
|
127
|
+
const rolesThatCanViewResponses =
|
|
128
|
+
state.polls.polls[pollId]?.rolesThatCanViewResponses;
|
|
129
|
+
|
|
130
|
+
return Array.isArray(rolesThatCanViewResponses) &&
|
|
131
|
+
rolesThatCanViewResponses.length > 0
|
|
132
|
+
? localPeerRole &&
|
|
133
|
+
rolesThatCanViewResponses.findIndex(
|
|
134
|
+
(role) => role.name === localPeerRole.name
|
|
135
|
+
) !== -1
|
|
136
|
+
: true;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const handleOptionSelection = (
|
|
140
|
+
selected: boolean,
|
|
141
|
+
option: HMSPollQuestionOption
|
|
142
|
+
) => {
|
|
143
|
+
if (pollQuestion.type === HMSPollQuestionType.singleChoice) {
|
|
144
|
+
dispatch(
|
|
145
|
+
setPollQuestionResponse(pollId, pollQuestion.index, option.index)
|
|
146
|
+
);
|
|
147
|
+
} else {
|
|
148
|
+
if (selected) {
|
|
149
|
+
dispatch(
|
|
150
|
+
addPollQuestionResponse(pollId, pollQuestion.index, option.index)
|
|
151
|
+
);
|
|
152
|
+
} else {
|
|
153
|
+
dispatch(
|
|
154
|
+
removePollQuestionResponse(pollId, pollQuestion.index, option.index)
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const handleVotePress = async (e: any) => {
|
|
161
|
+
if (!selectedOptions) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
onSubmit?.(e);
|
|
165
|
+
const result = await hmsInstance.interactivityCenter.add({
|
|
166
|
+
pollId,
|
|
167
|
+
pollQuestionIndex: pollQuestion.index,
|
|
168
|
+
responses: {
|
|
169
|
+
options: Array.isArray(selectedOptions)
|
|
170
|
+
? selectedOptions
|
|
171
|
+
: [selectedOptions],
|
|
172
|
+
duration:
|
|
173
|
+
pollType === HMSPollType.quiz && startTime.current !== null
|
|
174
|
+
? Date.now() - startTime.current
|
|
175
|
+
: undefined,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
console.log(JSON.stringify(result, null, 4));
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const handleSkipPress = async (e: any) => {
|
|
182
|
+
onSubmit?.(e);
|
|
183
|
+
// TODO: Implement skip API
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const anyOptionSelected = Array.isArray(selectedOptions)
|
|
187
|
+
? selectedOptions.length > 0
|
|
188
|
+
: selectedOptions !== null;
|
|
189
|
+
const isVoted = pollQuestion.myResponses.length > 0;
|
|
190
|
+
const InputComponent =
|
|
191
|
+
pollQuestion.type === HMSPollQuestionType.singleChoice
|
|
192
|
+
? RadioInputRow
|
|
193
|
+
: pollQuestion.type === HMSPollQuestionType.multipleChoice
|
|
194
|
+
? CheckboxInputRow
|
|
195
|
+
: null;
|
|
196
|
+
|
|
197
|
+
const isCorrectAnswer = checkIsCorrectAnswer(
|
|
198
|
+
pollQuestion.type,
|
|
199
|
+
pollQuestion.myResponses,
|
|
200
|
+
pollQuestion.answer
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<View
|
|
205
|
+
style={[
|
|
206
|
+
hmsRoomStyles.container,
|
|
207
|
+
styles.container,
|
|
208
|
+
pollType === HMSPollType.quiz &&
|
|
209
|
+
isVoted &&
|
|
210
|
+
pollState === HMSPollState.stopped
|
|
211
|
+
? isCorrectAnswer
|
|
212
|
+
? hmsRoomStyles.correctAnswer
|
|
213
|
+
: hmsRoomStyles.wrongAnswer
|
|
214
|
+
: null,
|
|
215
|
+
containerStyle,
|
|
216
|
+
]}
|
|
217
|
+
>
|
|
218
|
+
<View style={{ flexDirection: 'row' }}>
|
|
219
|
+
{pollType === HMSPollType.quiz &&
|
|
220
|
+
isVoted &&
|
|
221
|
+
pollState === HMSPollState.stopped ? (
|
|
222
|
+
isCorrectAnswer ? (
|
|
223
|
+
<CheckIcon
|
|
224
|
+
type="in-circle"
|
|
225
|
+
style={[
|
|
226
|
+
hmsRoomStyles.correctAnswerIcon,
|
|
227
|
+
{ marginRight: 8, width: 16, height: 16 },
|
|
228
|
+
]}
|
|
229
|
+
/>
|
|
230
|
+
) : (
|
|
231
|
+
<CrossCircleIcon
|
|
232
|
+
style={[
|
|
233
|
+
hmsRoomStyles.wrongAnswerIcon,
|
|
234
|
+
{ marginRight: 8, width: 16, height: 16 },
|
|
235
|
+
]}
|
|
236
|
+
/>
|
|
237
|
+
)
|
|
238
|
+
) : null}
|
|
239
|
+
|
|
240
|
+
<Text
|
|
241
|
+
numberOfLines={2}
|
|
242
|
+
style={[
|
|
243
|
+
styles.tinyText,
|
|
244
|
+
hmsRoomStyles.surfaceLowSemiBoldText,
|
|
245
|
+
styles.uppercaseContent,
|
|
246
|
+
pollType === HMSPollType.quiz &&
|
|
247
|
+
isVoted &&
|
|
248
|
+
pollState === HMSPollState.stopped
|
|
249
|
+
? isCorrectAnswer
|
|
250
|
+
? hmsRoomStyles.correctAnswerText
|
|
251
|
+
: hmsRoomStyles.wrongAnswerText
|
|
252
|
+
: null,
|
|
253
|
+
]}
|
|
254
|
+
>
|
|
255
|
+
Question {pollQuestion.index} of {totalQuestions}:{' '}
|
|
256
|
+
{getLabelFromPollQuestionType(pollQuestion.type)}
|
|
257
|
+
</Text>
|
|
258
|
+
</View>
|
|
259
|
+
|
|
260
|
+
<Text
|
|
261
|
+
style={[
|
|
262
|
+
hmsRoomStyles.surfaceHighRegularText,
|
|
263
|
+
styles.regularText,
|
|
264
|
+
styles.verticalNormalSpacer,
|
|
265
|
+
]}
|
|
266
|
+
>
|
|
267
|
+
{pollQuestion.text}
|
|
268
|
+
</Text>
|
|
269
|
+
|
|
270
|
+
{!InputComponent ? null : (
|
|
271
|
+
<>
|
|
272
|
+
{pollType === HMSPollType.poll &&
|
|
273
|
+
canViewPollResponse &&
|
|
274
|
+
(pollQuestion.myResponses.length > 0 ||
|
|
275
|
+
pollState === HMSPollState.stopped) ? (
|
|
276
|
+
<>
|
|
277
|
+
{pollQuestion.options
|
|
278
|
+
?.sort((a, b) => a.index - b.index)
|
|
279
|
+
.map((option, _, arr) => {
|
|
280
|
+
return (
|
|
281
|
+
<PollResponseProgressView
|
|
282
|
+
key={option.index}
|
|
283
|
+
option={option}
|
|
284
|
+
totalVotes={arr.reduce(
|
|
285
|
+
(acc, curr) => acc + curr.voteCount,
|
|
286
|
+
0
|
|
287
|
+
)}
|
|
288
|
+
/>
|
|
289
|
+
);
|
|
290
|
+
})}
|
|
291
|
+
</>
|
|
292
|
+
) : pollType === HMSPollType.quiz &&
|
|
293
|
+
pollState === HMSPollState.stopped ? (
|
|
294
|
+
<>
|
|
295
|
+
{pollQuestion.options
|
|
296
|
+
?.sort((a, b) => a.index - b.index)
|
|
297
|
+
.map((option) => {
|
|
298
|
+
const isSelected = checkIsSelected(
|
|
299
|
+
pollQuestion,
|
|
300
|
+
option,
|
|
301
|
+
null
|
|
302
|
+
);
|
|
303
|
+
const isCorrect = checkIsCorrectOption(
|
|
304
|
+
pollQuestion.type,
|
|
305
|
+
option,
|
|
306
|
+
pollQuestion.answer
|
|
307
|
+
);
|
|
308
|
+
return (
|
|
309
|
+
<QuizEndOptionsView
|
|
310
|
+
key={option.index}
|
|
311
|
+
option={option}
|
|
312
|
+
isSelected={isSelected}
|
|
313
|
+
isCorrect={isCorrect}
|
|
314
|
+
/>
|
|
315
|
+
);
|
|
316
|
+
})}
|
|
317
|
+
</>
|
|
318
|
+
) : (
|
|
319
|
+
<>
|
|
320
|
+
{pollQuestion.options
|
|
321
|
+
?.sort((a, b) => a.index - b.index)
|
|
322
|
+
.map((option) => {
|
|
323
|
+
const isSelected = checkIsSelected(
|
|
324
|
+
pollQuestion,
|
|
325
|
+
option,
|
|
326
|
+
selectedOptions
|
|
327
|
+
);
|
|
328
|
+
return (
|
|
329
|
+
<InputComponent
|
|
330
|
+
key={option.index}
|
|
331
|
+
disabled={isVoted}
|
|
332
|
+
selected={isSelected}
|
|
333
|
+
radioColor={
|
|
334
|
+
isVoted
|
|
335
|
+
? isSelected
|
|
336
|
+
? primaryBrightColor
|
|
337
|
+
: onSurfaceLowColor
|
|
338
|
+
: undefined
|
|
339
|
+
}
|
|
340
|
+
onChange={(selected) =>
|
|
341
|
+
handleOptionSelection(selected, option)
|
|
342
|
+
}
|
|
343
|
+
text={option.text}
|
|
344
|
+
containerStyle={{ marginBottom: 16 }}
|
|
345
|
+
/>
|
|
346
|
+
);
|
|
347
|
+
})}
|
|
348
|
+
</>
|
|
349
|
+
)}
|
|
350
|
+
</>
|
|
351
|
+
)}
|
|
352
|
+
|
|
353
|
+
{isVoted &&
|
|
354
|
+
(pollType === HMSPollType.poll || pollState === HMSPollState.started) ? (
|
|
355
|
+
<Text
|
|
356
|
+
style={[
|
|
357
|
+
styles.regularText,
|
|
358
|
+
styles.votedLabel,
|
|
359
|
+
hmsRoomStyles.surfaceLowSemiBoldText,
|
|
360
|
+
]}
|
|
361
|
+
>
|
|
362
|
+
{pollType === HMSPollType.quiz ? 'Answered' : 'Voted'}
|
|
363
|
+
</Text>
|
|
364
|
+
) : pollState === HMSPollState.started ? (
|
|
365
|
+
<View style={{ alignSelf: 'flex-end', flexDirection: 'row' }}>
|
|
366
|
+
{pollQuestion.skippable ? (
|
|
367
|
+
<HMSBaseButton
|
|
368
|
+
loading={false}
|
|
369
|
+
onPress={handleSkipPress}
|
|
370
|
+
title="Skip"
|
|
371
|
+
style={hmsRoomStyles.skipButton}
|
|
372
|
+
textStyle={hmsRoomStyles.skipButtonText}
|
|
373
|
+
useTouchableOpacity={true}
|
|
374
|
+
/>
|
|
375
|
+
) : null}
|
|
376
|
+
|
|
377
|
+
<HMSPrimaryButton
|
|
378
|
+
loading={false}
|
|
379
|
+
disabled={!anyOptionSelected}
|
|
380
|
+
onPress={handleVotePress}
|
|
381
|
+
title={pollType === HMSPollType.quiz ? 'Answer' : 'Vote'}
|
|
382
|
+
/>
|
|
383
|
+
</View>
|
|
384
|
+
) : null}
|
|
385
|
+
</View>
|
|
386
|
+
);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const styles = StyleSheet.create({
|
|
390
|
+
container: {
|
|
391
|
+
padding: 16,
|
|
392
|
+
borderRadius: 8,
|
|
393
|
+
borderWidth: 1,
|
|
394
|
+
},
|
|
395
|
+
tinyText: {
|
|
396
|
+
fontSize: 10,
|
|
397
|
+
lineHeight: 16,
|
|
398
|
+
letterSpacing: 1.5,
|
|
399
|
+
},
|
|
400
|
+
regularText: {
|
|
401
|
+
fontSize: 16,
|
|
402
|
+
lineHeight: 24,
|
|
403
|
+
},
|
|
404
|
+
verticalNormalSpacer: {
|
|
405
|
+
marginVertical: 16,
|
|
406
|
+
},
|
|
407
|
+
votedLabel: {
|
|
408
|
+
paddingVertical: 8,
|
|
409
|
+
alignSelf: 'flex-end',
|
|
410
|
+
},
|
|
411
|
+
uppercaseContent: {
|
|
412
|
+
textTransform: 'uppercase',
|
|
413
|
+
},
|
|
414
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { HMSPollType, type HMSPoll } from '@100mslive/react-native-hms';
|
|
4
|
+
|
|
5
|
+
import { PollAndQuizQuestionResponseCard } from './PollAndQuizQuestionResponseCard';
|
|
6
|
+
import type { PollAndQuizQuestionResponseCardProps } from './PollAndQuizQuestionResponseCard';
|
|
7
|
+
|
|
8
|
+
export interface PollAndQuizQuestionResponseCardsProps {
|
|
9
|
+
poll: HMSPoll;
|
|
10
|
+
onVote: PollAndQuizQuestionResponseCardProps['onSubmit'];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PollAndQuizQuestionResponseCards: React.FC<
|
|
14
|
+
PollAndQuizQuestionResponseCardsProps
|
|
15
|
+
> = ({ poll, onVote }) => {
|
|
16
|
+
if (!Array.isArray(poll.questions) || poll.questions.length <= 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const pollQuestions = poll.questions.sort((a, b) => a.index - b.index);
|
|
21
|
+
|
|
22
|
+
// Show all question cards if the pollType is a `poll` OR if all questions have been answered
|
|
23
|
+
if (
|
|
24
|
+
poll.type === HMSPollType.poll ||
|
|
25
|
+
pollQuestions.every((q) => q.myResponses.length > 0)
|
|
26
|
+
) {
|
|
27
|
+
return (
|
|
28
|
+
<View>
|
|
29
|
+
{pollQuestions.map((question, _, arr) => (
|
|
30
|
+
<PollAndQuizQuestionResponseCard
|
|
31
|
+
key={question.index}
|
|
32
|
+
pollState={poll.state}
|
|
33
|
+
pollId={poll.pollId}
|
|
34
|
+
totalQuestions={arr.length}
|
|
35
|
+
pollQuestion={question}
|
|
36
|
+
containerStyle={{ marginBottom: 16 }}
|
|
37
|
+
onSubmit={onVote}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const unansweredQuestion = pollQuestions.find(
|
|
45
|
+
(q) => !q.myResponses || q.myResponses.length <= 0
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// Show question cards one at a time if the pollType is a `quiz` and not all questions have been answered
|
|
49
|
+
if (unansweredQuestion) {
|
|
50
|
+
return (
|
|
51
|
+
<PollAndQuizQuestionResponseCard
|
|
52
|
+
pollState={poll.state}
|
|
53
|
+
pollId={poll.pollId}
|
|
54
|
+
totalQuestions={pollQuestions.length}
|
|
55
|
+
pollQuestion={unansweredQuestion}
|
|
56
|
+
containerStyle={{ marginBottom: 16 }}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Text,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
ScrollView,
|
|
6
|
+
findNodeHandle,
|
|
7
|
+
UIManager,
|
|
8
|
+
View,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { useSelector } from 'react-redux';
|
|
11
|
+
import { HMSPollState, HMSPollType } from '@100mslive/react-native-hms';
|
|
12
|
+
|
|
13
|
+
import { useHMSInstance, useHMSRoomStyleSheet } from '../hooks-util';
|
|
14
|
+
import type { RootState } from '../redux';
|
|
15
|
+
import { HMSDangerButton } from './HMSDangerButton';
|
|
16
|
+
import { PollAndQuizQuestionResponseCards } from './PollAndQuizQuestionResponseCards';
|
|
17
|
+
|
|
18
|
+
export interface PollAndQuizVotingProps {
|
|
19
|
+
dismissModal(): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const PollAndQuizVoting: React.FC<PollAndQuizVotingProps> = () => {
|
|
23
|
+
const scrollViewRef = React.useRef<ScrollView>(null);
|
|
24
|
+
const hmsInstance = useHMSInstance();
|
|
25
|
+
const selectedPoll = useSelector((state: RootState) => {
|
|
26
|
+
const pollsData = state.polls;
|
|
27
|
+
if (pollsData.selectedPollId !== null) {
|
|
28
|
+
return pollsData.polls[pollsData.selectedPollId] || null;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
});
|
|
32
|
+
const canCreateOrEndPoll = useSelector((state: RootState) => {
|
|
33
|
+
const permissions = state.hmsStates.localPeer?.role?.permissions;
|
|
34
|
+
return permissions?.pollWrite;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
38
|
+
regularMediumText: {
|
|
39
|
+
color: theme.palette.on_surface_medium,
|
|
40
|
+
fontFamily: `${typography.font_family}-Regular`,
|
|
41
|
+
},
|
|
42
|
+
semiBoldMediumText: {
|
|
43
|
+
color: theme.palette.on_surface_medium,
|
|
44
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const endPoll = async () => {
|
|
49
|
+
if (!selectedPoll || !canCreateOrEndPoll) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const result = await hmsInstance.interactivityCenter.stop(
|
|
53
|
+
selectedPoll.pollId
|
|
54
|
+
);
|
|
55
|
+
console.log('Poll ended', result);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleVote = (e: any) => {
|
|
59
|
+
const handle = findNodeHandle(e.nativeEvent.target);
|
|
60
|
+
const scrollHandle = findNodeHandle(scrollViewRef.current);
|
|
61
|
+
if (!handle) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (scrollHandle === null) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
UIManager.measureLayout(
|
|
68
|
+
handle,
|
|
69
|
+
scrollHandle,
|
|
70
|
+
() => {
|
|
71
|
+
console.log('Failed', e);
|
|
72
|
+
},
|
|
73
|
+
(_left, top, _width, _height) => {
|
|
74
|
+
scrollViewRef.current?.scrollTo({
|
|
75
|
+
y: top + 400,
|
|
76
|
+
animated: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<View style={{ flex: 1 }}>
|
|
84
|
+
<ScrollView
|
|
85
|
+
ref={scrollViewRef}
|
|
86
|
+
style={styles.contentContainer}
|
|
87
|
+
contentContainerStyle={{ flexGrow: 1, paddingVertical: 24 }}
|
|
88
|
+
>
|
|
89
|
+
<Text style={[styles.normalText, hmsRoomStyles.semiBoldMediumText]}>
|
|
90
|
+
{selectedPoll?.createdBy?.name} started a{' '}
|
|
91
|
+
{selectedPoll?.type === HMSPollType.quiz ? 'quiz' : 'poll'}
|
|
92
|
+
</Text>
|
|
93
|
+
|
|
94
|
+
{selectedPoll ? (
|
|
95
|
+
<PollAndQuizQuestionResponseCards
|
|
96
|
+
poll={selectedPoll}
|
|
97
|
+
onVote={handleVote}
|
|
98
|
+
/>
|
|
99
|
+
) : null}
|
|
100
|
+
</ScrollView>
|
|
101
|
+
|
|
102
|
+
{selectedPoll &&
|
|
103
|
+
selectedPoll.state === HMSPollState.started &&
|
|
104
|
+
canCreateOrEndPoll ? (
|
|
105
|
+
<HMSDangerButton
|
|
106
|
+
disabled={!selectedPoll}
|
|
107
|
+
title={
|
|
108
|
+
selectedPoll?.type === HMSPollType.quiz ? 'End Quiz' : 'End Poll'
|
|
109
|
+
}
|
|
110
|
+
loading={false}
|
|
111
|
+
onPress={endPoll}
|
|
112
|
+
style={{
|
|
113
|
+
marginTop: 16,
|
|
114
|
+
marginBottom: 16,
|
|
115
|
+
marginRight: 24,
|
|
116
|
+
alignSelf: 'flex-end',
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
) : null}
|
|
120
|
+
</View>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const styles = StyleSheet.create({
|
|
125
|
+
smallText: {
|
|
126
|
+
fontSize: 14,
|
|
127
|
+
lineHeight: 20,
|
|
128
|
+
},
|
|
129
|
+
normalText: {
|
|
130
|
+
fontSize: 16,
|
|
131
|
+
lineHeight: 24,
|
|
132
|
+
marginBottom: 16,
|
|
133
|
+
},
|
|
134
|
+
contentContainer: {
|
|
135
|
+
paddingHorizontal: 24,
|
|
136
|
+
},
|
|
137
|
+
typeSelectionLabel: {
|
|
138
|
+
fontSize: 12,
|
|
139
|
+
lineHeight: 16,
|
|
140
|
+
},
|
|
141
|
+
pollNameLabel: {
|
|
142
|
+
fontSize: 14,
|
|
143
|
+
lineHeight: 20,
|
|
144
|
+
marginBottom: 8,
|
|
145
|
+
},
|
|
146
|
+
textInput: {
|
|
147
|
+
flex: undefined,
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
addOptionWrapper: {
|
|
151
|
+
alignSelf: 'flex-start',
|
|
152
|
+
},
|
|
153
|
+
addOptionContainer: {
|
|
154
|
+
flexDirection: 'row',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
},
|
|
157
|
+
addOptionIconWrapper: {
|
|
158
|
+
marginRight: 8,
|
|
159
|
+
padding: 8,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { HMSPollState } from '@100mslive/react-native-hms';
|
|
4
|
+
|
|
5
|
+
import { useHMSRoomStyleSheet } from '../hooks-util';
|
|
6
|
+
|
|
7
|
+
export interface PollAndQuizzStateLabelProps {
|
|
8
|
+
state: HMSPollState;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const PollAndQuizzStateLabel: React.FC<PollAndQuizzStateLabelProps> = ({
|
|
12
|
+
state,
|
|
13
|
+
}) => {
|
|
14
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
15
|
+
surfaceHighSemiBoldText: {
|
|
16
|
+
color: theme.palette.on_surface_high,
|
|
17
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
18
|
+
},
|
|
19
|
+
container: {
|
|
20
|
+
backgroundColor: theme.palette.surface_default,
|
|
21
|
+
},
|
|
22
|
+
liveStateLabelWrapper: {
|
|
23
|
+
backgroundColor: theme.palette.alert_error_default,
|
|
24
|
+
},
|
|
25
|
+
stateLabelWrapper: {
|
|
26
|
+
backgroundColor: theme.palette.surface_brighter,
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
style={[
|
|
33
|
+
styles.stateLabelWrapper,
|
|
34
|
+
state === HMSPollState.started
|
|
35
|
+
? hmsRoomStyles.liveStateLabelWrapper
|
|
36
|
+
: hmsRoomStyles.stateLabelWrapper,
|
|
37
|
+
]}
|
|
38
|
+
>
|
|
39
|
+
<Text style={[styles.stateLabel, hmsRoomStyles.surfaceHighSemiBoldText]}>
|
|
40
|
+
{state === HMSPollState.started
|
|
41
|
+
? 'LIVE'
|
|
42
|
+
: state === HMSPollState.stopped
|
|
43
|
+
? 'ENDED'
|
|
44
|
+
: 'DRAFT'}
|
|
45
|
+
</Text>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const styles = StyleSheet.create({
|
|
51
|
+
container: {
|
|
52
|
+
padding: 16,
|
|
53
|
+
borderRadius: 8,
|
|
54
|
+
marginBottom: 24,
|
|
55
|
+
},
|
|
56
|
+
spacer: {
|
|
57
|
+
height: 16,
|
|
58
|
+
},
|
|
59
|
+
row: {
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'space-between',
|
|
63
|
+
},
|
|
64
|
+
rightRow: {
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
justifyContent: 'flex-end',
|
|
67
|
+
},
|
|
68
|
+
pollTitle: {
|
|
69
|
+
fontSize: 16,
|
|
70
|
+
lineHeight: 24,
|
|
71
|
+
letterSpacing: 0.15,
|
|
72
|
+
},
|
|
73
|
+
stateLabelWrapper: {
|
|
74
|
+
paddingVertical: 4,
|
|
75
|
+
paddingHorizontal: 8,
|
|
76
|
+
borderRadius: 4,
|
|
77
|
+
},
|
|
78
|
+
stateLabel: {
|
|
79
|
+
fontSize: 10,
|
|
80
|
+
lineHeight: 16,
|
|
81
|
+
letterSpacing: 1.5,
|
|
82
|
+
},
|
|
83
|
+
});
|