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

40 lines
1.4 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 Auth from '/imports/ui/services/auth';
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 '/imports/ui/components/poll/service';
2018-11-23 12:08:48 +08:00
const PollContainer = ({ ...props }) => <Poll {...props} />;
2018-09-24 06:20:20 +08:00
export default withTracker(() => {
2018-10-29 23:27:50 +08:00
Meteor.subscribe('current-poll', Auth.meetingID);
const currentPresentation = Presentations.findOne({
current: true,
}) || {};
const currentSlide = PresentationAreaService.getCurrentSlide(currentPresentation.podId);
2018-09-24 06:20:20 +08:00
const startPoll = type => makeCall('startPoll', type, currentSlide.id);
const startCustomPoll = (type, answers) => makeCall('startPoll', type, currentSlide.id, answers);
return {
currentSlide,
currentUser: Service.currentUser(),
pollTypes: Service.pollTypes,
2018-09-24 06:20:20 +08:00
startPoll,
startCustomPoll,
stopPoll: Service.stopPoll,
publishPoll: Service.publishPoll,
currentPoll: Service.currentPoll(),
getUser: Service.getUser,
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);