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

47 lines
1.3 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 Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import Presentations from '/imports/api/presentations';
import PresentationAreaService from '/imports/ui/components/presentation/service';
import Poll from './component';
2018-09-24 06:20:20 +08:00
const PollContainer = ({ ...props }) => <Poll {...props} />;
export default withTracker(({ }) => {
const currentPresentation = Presentations.findOne({
current: true,
});
const currentSlide = PresentationAreaService.getCurrentSlide(currentPresentation.podId);
2018-09-24 06:20:20 +08:00
const currentUser = Users.findOne({ userId: Auth.userID });
// 'YN' = Yes,No
// 'TF' = True,False
// 'A-2' = A,B
// 'A-3' = A,B,C
// 'A-4' = A,B,C,D
// 'A-5' = A,B,C,D,E
const pollTypes = ['YN', 'TF', 'A-2', 'A-3', 'A-4', 'A-5', 'custom'];
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);
2018-09-25 06:43:54 +08:00
const stopPoll = () => makeCall('stopPoll', Auth.userId);
const publishPoll = () => makeCall('publishPoll');
2018-09-24 06:20:20 +08:00
return {
currentSlide,
currentUser,
pollTypes,
startPoll,
startCustomPoll,
2018-09-25 06:43:54 +08:00
stopPoll,
publishPoll,
2018-09-24 06:20:20 +08:00
};
})(PollContainer);