bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/poll/container.jsx

45 lines
1.5 KiB
React
Raw Normal View History

import React from 'react';
import { makeCall } from '/imports/ui/services/api';
2018-09-24 06:20:20 +08:00
import { withTracker } from 'meteor/react-meteor-data';
import Presentations from '/imports/api/presentations';
import PresentationAreaService from '/imports/ui/components/presentation/service';
2019-03-15 03:34:53 +08:00
import Poll from '/imports/ui/components/poll/component';
import Service from './service';
const CHAT_CONFIG = Meteor.settings.public.chat;
const PUBLIC_CHAT_KEY = CHAT_CONFIG.public_id;
2018-11-23 12:08:48 +08:00
const PollContainer = ({ ...props }) => <Poll {...props} />;
2018-09-24 06:20:20 +08:00
export default withTracker(() => {
Meteor.subscribe('current-poll');
2018-10-29 23:27:50 +08:00
const currentPresentation = Presentations.findOne({
current: true,
}, { fields: { podId: 1 } }) || {};
const currentSlide = PresentationAreaService.getCurrentSlide(currentPresentation.podId);
const pollId = currentSlide ? currentSlide.id : PUBLIC_CHAT_KEY;
const startPoll = (type, question = '') => makeCall('startPoll', type, pollId, question);
const startCustomPoll = (type, question = '', answers) => makeCall('startPoll', type, pollId, question, answers);
2018-09-24 06:20:20 +08:00
const stopPoll = () => makeCall('stopPoll');
2018-09-24 06:20:20 +08:00
return {
currentSlide,
amIPresenter: Service.amIPresenter(),
pollTypes: Service.pollTypes,
2018-09-24 06:20:20 +08:00
startPoll,
startCustomPoll,
stopPoll,
publishPoll: Service.publishPoll,
currentPoll: Service.currentPoll(),
resetPollPanel: Session.get('resetPollPanel') || false,
2019-05-23 02:00:44 +08:00
pollAnswerIds: Service.pollAnswerIds,
isMeteorConnected: Meteor.status().connected,
2018-09-24 06:20:20 +08:00
};
})(PollContainer);