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

61 lines
1.8 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 PresentationToolbar from './component';
import PresentationToolbarService from './service';
2016-08-03 06:55:20 +08:00
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
return {
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,
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,
};