bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/container.jsx

77 lines
2.4 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { withTracker } from 'meteor/react-meteor-data';
2018-08-23 01:49:33 +08:00
import PresentationService from '/imports/ui/components/presentation/service';
import MediaService from '/imports/ui/components/media/service';
import Service from '/imports/ui/components/actions-bar/service';
import { makeCall } from '/imports/ui/services/api';
import PresentationToolbar from './component';
import PresentationToolbarService from './service';
2016-08-03 06:55:20 +08:00
const POLLING_ENABLED = Meteor.settings.public.poll.enabled;
const PresentationToolbarContainer = (props) => {
const {
userIsPresenter,
layoutSwapped,
} = props;
2016-08-03 06:55:20 +08:00
if (userIsPresenter && !layoutSwapped) {
// Only show controls if user is presenter and layout isn't swapped
return (
<PresentationToolbar
{...props}
/>
);
2016-08-03 06:55:20 +08:00
}
return null;
};
2016-08-03 06:55:20 +08:00
export default withTracker((params) => {
const {
podId,
presentationId,
} = params;
2016-08-06 02:39:24 +08:00
const startPoll = (type, id) => {
Session.set('openPanel', 'poll');
Session.set('forcePollOpen', true);
2020-10-03 20:42:34 +08:00
makeCall('startPoll', type, id, '');
};
2016-08-06 02:39:24 +08:00
return {
amIPresenter: Service.amIPresenter(),
layoutSwapped: MediaService.getSwapLayout() && MediaService.shouldEnableSwapLayout(),
userIsPresenter: PresentationService.isPresenter(podId),
numberOfSlides: PresentationToolbarService.getNumberOfSlides(podId, presentationId),
nextSlide: PresentationToolbarService.nextSlide,
previousSlide: PresentationToolbarService.previousSlide,
skipToSlide: PresentationToolbarService.skipToSlide,
2019-06-27 00:29:34 +08:00
isMeteorConnected: Meteor.status().connected,
isPollingEnabled: POLLING_ENABLED,
currentSlidHasContent: PresentationService.currentSlidHasContent(),
parseCurrentSlideContent: PresentationService.parseCurrentSlideContent,
startPoll,
2016-08-06 02:39:24 +08:00
};
})(PresentationToolbarContainer);
2016-08-03 06:55:20 +08:00
PresentationToolbarContainer.propTypes = {
// Number of current slide being displayed
currentSlideNum: PropTypes.number.isRequired,
2018-08-23 01:49:33 +08:00
zoom: PropTypes.number.isRequired,
zoomChanger: PropTypes.func.isRequired,
// Is the user a presenter
userIsPresenter: PropTypes.bool.isRequired,
// Total number of slides in this presentation
numberOfSlides: PropTypes.number.isRequired,
// Actions required for the presenter toolbar
nextSlide: PropTypes.func.isRequired,
previousSlide: PropTypes.func.isRequired,
skipToSlide: PropTypes.func.isRequired,
};