2017-08-21 08:16:39 +08:00
|
|
|
import React from 'react';
|
2017-06-04 10:40:14 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2018-08-23 01:49:33 +08:00
|
|
|
import PresentationService from '/imports/ui/components/presentation/service';
|
2018-12-12 00:28:37 +08:00
|
|
|
import MediaService from '/imports/ui/components/media/service';
|
2017-08-21 08:16:39 +08:00
|
|
|
import PresentationToolbar from './component';
|
2019-02-14 20:03:25 +08:00
|
|
|
import PresentationToolbarService from './service';
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2017-09-26 07:45:44 +08:00
|
|
|
const PresentationToolbarContainer = (props) => {
|
2017-08-21 08:16:39 +08:00
|
|
|
const {
|
|
|
|
userIsPresenter,
|
2019-08-14 01:41:47 +08:00
|
|
|
layoutSwapped,
|
2017-08-21 08:16:39 +08:00
|
|
|
} = props;
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2019-08-14 01:41:47 +08:00
|
|
|
if (userIsPresenter && !layoutSwapped) {
|
2018-12-12 00:28:37 +08:00
|
|
|
// Only show controls if user is presenter and layout isn't swapped
|
|
|
|
|
2017-08-21 08:16:39 +08:00
|
|
|
return (
|
|
|
|
<PresentationToolbar
|
2019-07-18 08:30:28 +08:00
|
|
|
{...props}
|
2017-08-21 08:16:39 +08:00
|
|
|
/>
|
|
|
|
);
|
2016-08-03 06:55:20 +08:00
|
|
|
}
|
2017-08-21 08:16:39 +08:00
|
|
|
return null;
|
|
|
|
};
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
export default withTracker((params) => {
|
2019-04-24 22:20:53 +08:00
|
|
|
const {
|
2019-07-18 08:30:28 +08:00
|
|
|
podId,
|
|
|
|
presentationId,
|
2019-04-24 22:20:53 +08:00
|
|
|
} = params;
|
2016-08-06 02:39:24 +08:00
|
|
|
|
|
|
|
return {
|
2019-08-14 01:41:47 +08:00
|
|
|
layoutSwapped: MediaService.getSwapLayout() && MediaService.shouldEnableSwapLayout(),
|
2018-07-25 04:20:37 +08:00
|
|
|
userIsPresenter: PresentationService.isPresenter(podId),
|
2019-07-18 08:30:28 +08:00
|
|
|
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
|
|
|
};
|
2018-01-08 12:44:42 +08:00
|
|
|
})(PresentationToolbarContainer);
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2017-08-21 08:16:39 +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,
|
2017-08-21 08:16:39 +08:00
|
|
|
|
|
|
|
// 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
|
2019-07-18 08:30:28 +08:00
|
|
|
nextSlide: PropTypes.func.isRequired,
|
|
|
|
previousSlide: PropTypes.func.isRequired,
|
|
|
|
skipToSlide: PropTypes.func.isRequired,
|
2017-08-21 08:16:39 +08:00
|
|
|
};
|