UNPKG

@100mslive/react-native-room-kit

Version:

100ms Room Kit provides simple & easy to use UI components to build Live Streaming & Video Conferencing experiences in your apps.

56 lines 2.95 kB
import * as React from 'react'; import { View, StyleSheet } from 'react-native'; import { useSelector } from 'react-redux'; import { PollQuestions } from './PollQuestions'; import { CreatePollStages } from '../redux/actionTypes'; import { PollsConfigAndList } from './PollsConfigAndList'; import { PollAndQuizVoting } from './PollAndQuizVoting'; import { PollAndQuizSheetScreen } from './PollAndQuizSheetScreen'; import { QuizLeaderboardScreen } from './QuizLeaderboardScreen'; import { QuizLeaderboardEntriesScreen } from './QuizLeaderboardEntriesScreen'; export const PollsAndQuizzesModalContent = ({ dismissModal }) => { const pollsNavigationStack = useSelector(state => state.polls.navigationStack); const canCreateOrEndPoll = useSelector(state => { var _state$hmsStates$loca; const permissions = (_state$hmsStates$loca = state.hmsStates.localPeer) === null || _state$hmsStates$loca === void 0 || (_state$hmsStates$loca = _state$hmsStates$loca.role) === null || _state$hmsStates$loca === void 0 ? void 0 : _state$hmsStates$loca.permissions; return permissions === null || permissions === void 0 ? void 0 : permissions.pollWrite; }); const canVoteOnPoll = useSelector(state => { var _state$hmsStates$loca2; const permissions = (_state$hmsStates$loca2 = state.hmsStates.localPeer) === null || _state$hmsStates$loca2 === void 0 || (_state$hmsStates$loca2 = _state$hmsStates$loca2.role) === null || _state$hmsStates$loca2 === void 0 ? void 0 : _state$hmsStates$loca2.permissions; return permissions === null || permissions === void 0 ? void 0 : permissions.pollRead; }); return /*#__PURE__*/React.createElement(View, { style: [styles.relative, styles.fullView] }, pollsNavigationStack.map((stage, index) => /*#__PURE__*/React.createElement(PollAndQuizSheetScreen, { key: stage, zIndex: index, disableAnimation: index === 0 }, stage === CreatePollStages.POLL_CONFIG ? /*#__PURE__*/React.createElement(PollsConfigAndList, { dismissModal: dismissModal }) : stage === CreatePollStages.POLL_QUESTION_CONFIG && canCreateOrEndPoll ? /*#__PURE__*/React.createElement(PollQuestions, { currentIdx: index, dismissModal: dismissModal }) : stage === CreatePollStages.POLL_VOTING && (canVoteOnPoll || canCreateOrEndPoll) ? /*#__PURE__*/React.createElement(PollAndQuizVoting, { currentIdx: index, dismissModal: dismissModal }) : stage === CreatePollStages.QUIZ_LEADERBOARD ? /*#__PURE__*/React.createElement(QuizLeaderboardScreen, { currentIdx: index, dismissModal: dismissModal }) : stage === CreatePollStages.QUIZ_LEADERBOARD_ENTRIES ? /*#__PURE__*/React.createElement(QuizLeaderboardEntriesScreen, { currentIdx: index, dismissModal: dismissModal }) : null))); }; const styles = StyleSheet.create({ relative: { position: 'relative', overflow: 'hidden' }, fullView: { flex: 1 } }); //# sourceMappingURL=PollsAndQuizzesModalContent.js.map