bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/poll/container.jsx
2019-05-22 18:00:44 +00:00

39 lines
1.3 KiB
JavaScript

import React from 'react';
import { makeCall } from '/imports/ui/services/api';
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';
import Poll from '/imports/ui/components/poll/component';
import Service from '/imports/ui/components/poll/service';
const PollContainer = ({ ...props }) => <Poll {...props} />;
export default withTracker(() => {
Meteor.subscribe('current-poll', Auth.meetingID);
const currentPresentation = Presentations.findOne({
current: true,
}) || {};
const currentSlide = PresentationAreaService.getCurrentSlide(currentPresentation.podId);
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,
startPoll,
startCustomPoll,
stopPoll: Service.stopPoll,
publishPoll: Service.publishPoll,
currentPoll: Service.currentPoll(),
getUser: Service.getUser,
resetPollPanel: Session.get('resetPollPanel') || false,
pollAnswerIds: Service.pollAnswerIds,
};
})(PollContainer);