bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/poll/container.jsx
Michael Zinsmeister e52df55bf8 fix bug
2021-03-07 18:11:57 +01:00

45 lines
1.6 KiB
JavaScript

import React from 'react';
import { makeCall } from '/imports/ui/services/api';
import { withTracker } from 'meteor/react-meteor-data';
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 './service';
const CHAT_CONFIG = Meteor.settings.public.chat;
const PUBLIC_CHAT_KEY = CHAT_CONFIG.public_id;
const PollContainer = ({ ...props }) => <Poll {...props} />;
export default withTracker(() => {
Meteor.subscribe('current-poll');
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 = '', isMultipleResponse) => makeCall('startPoll', type, pollId, question, isMultipleResponse);
const startCustomPoll = (type, question = '', isMultipleResponse, answers) => makeCall('startPoll', type, pollId, question, isMultipleResponse, answers);
const stopPoll = () => makeCall('stopPoll');
return {
currentSlide,
amIPresenter: Service.amIPresenter(),
pollTypes: Service.pollTypes,
startPoll,
startCustomPoll,
stopPoll,
publishPoll: Service.publishPoll,
currentPoll: Service.currentPoll(),
resetPollPanel: Session.get('resetPollPanel') || false,
pollAnswerIds: Service.pollAnswerIds,
isMeteorConnected: Meteor.status().connected,
};
})(PollContainer);