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

104 lines
2.7 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 {
currentSlideNum,
userIsPresenter,
numberOfSlides,
actions,
2018-08-23 01:49:33 +08:00
zoom,
zoomChanger,
2018-09-25 20:47:49 +08:00
fitToWidthHandler,
2018-12-22 00:03:55 +08:00
getSwapLayout,
2019-02-12 21:35:52 +08:00
isFullscreen,
fullscreenRef,
fitToWidth,
} = props;
2016-08-03 06:55:20 +08:00
if (userIsPresenter && !getSwapLayout) {
// Only show controls if user is presenter and layout isn't swapped
return (
<PresentationToolbar
2018-08-23 01:49:33 +08:00
{...{
2019-02-12 21:35:52 +08:00
isFullscreen,
fullscreenRef,
2018-08-23 01:49:33 +08:00
currentSlideNum,
numberOfSlides,
actions,
zoom,
zoomChanger,
2018-09-25 20:47:49 +08:00
fitToWidthHandler,
fitToWidth,
2018-08-23 01:49:33 +08:00
}}
/>
);
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, fitToWidth } = params;
const data = PresentationToolbarService.getSlideData(podId, presentationId);
2016-08-06 02:39:24 +08:00
const {
numberOfSlides,
} = data;
return {
getSwapLayout: MediaService.getSwapLayout(),
2018-09-25 20:47:49 +08:00
fitToWidthHandler: params.fitToWidthHandler,
fitToWidth,
userIsPresenter: PresentationService.isPresenter(podId),
2016-08-06 02:39:24 +08:00
numberOfSlides,
2018-08-23 01:49:33 +08:00
zoom: params.zoom,
zoomChanger: params.zoomChanger,
2016-08-06 02:39:24 +08:00
actions: {
2018-12-22 00:03:55 +08:00
nextSlideHandler: () => PresentationToolbarService.nextSlide(
params.currentSlideNum,
numberOfSlides,
podId,
),
previousSlideHandler: () => PresentationToolbarService.previousSlide(
params.currentSlideNum,
podId,
),
skipToSlideHandler: requestedSlideNum => PresentationToolbarService.skipToSlide(
requestedSlideNum,
podId,
),
zoomSlideHandler: value => PresentationToolbarService.zoomSlide(
params.currentSlideNum,
podId,
value,
),
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
actions: PropTypes.shape({
nextSlideHandler: PropTypes.func.isRequired,
previousSlideHandler: PropTypes.func.isRequired,
skipToSlideHandler: PropTypes.func.isRequired,
}).isRequired,
};