2017-08-09 04:55:38 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2020-05-12 20:58:14 +08:00
|
|
|
import MediaService, { getSwapLayout, shouldEnableSwapLayout } from '/imports/ui/components/media/service';
|
2019-05-10 01:44:54 +08:00
|
|
|
import { notify } from '/imports/ui/services/notification';
|
2017-02-17 05:11:46 +08:00
|
|
|
import PresentationAreaService from './service';
|
|
|
|
import PresentationArea from './component';
|
2019-07-18 08:30:28 +08:00
|
|
|
import PresentationToolbarService from './presentation-toolbar/service';
|
2020-05-12 20:58:14 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import Meetings from '/imports/api/meetings';
|
|
|
|
import Users from '/imports/api/users';
|
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
|
|
|
|
|
|
|
const ROLE_VIEWER = Meteor.settings.public.user.role_viewer;
|
2016-05-04 04:40:46 +08:00
|
|
|
|
2019-03-07 05:57:07 +08:00
|
|
|
const PresentationAreaContainer = ({ presentationPodIds, mountPresentationArea, ...props }) => (
|
|
|
|
mountPresentationArea && <PresentationArea {...props} />
|
2017-08-21 08:16:39 +08:00
|
|
|
);
|
2016-05-04 04:40:46 +08:00
|
|
|
|
2018-07-27 03:35:38 +08:00
|
|
|
export default withTracker(({ podId }) => {
|
|
|
|
const currentSlide = PresentationAreaService.getCurrentSlide(podId);
|
2019-02-21 01:17:17 +08:00
|
|
|
const presentationIsDownloadable = PresentationAreaService.isPresentationDownloadable(podId);
|
2019-08-14 01:41:47 +08:00
|
|
|
const layoutSwapped = getSwapLayout() && shouldEnableSwapLayout();
|
2020-05-12 20:58:14 +08:00
|
|
|
const isViewer = Users.findOne({ meetingId: Auth.meetingID, userId: Auth.userID }, {
|
|
|
|
fields: {
|
|
|
|
role: 1,
|
|
|
|
},
|
|
|
|
}).role === ROLE_VIEWER;
|
2019-08-01 03:10:41 +08:00
|
|
|
|
2019-08-02 01:50:39 +08:00
|
|
|
let slidePosition;
|
2019-08-01 03:10:41 +08:00
|
|
|
if (currentSlide) {
|
|
|
|
const {
|
|
|
|
presentationId,
|
|
|
|
id: slideId,
|
|
|
|
} = currentSlide;
|
|
|
|
slidePosition = PresentationAreaService.getSlidePosition(podId, presentationId, slideId);
|
|
|
|
}
|
2018-07-27 03:35:38 +08:00
|
|
|
return {
|
|
|
|
currentSlide,
|
2019-08-01 03:10:41 +08:00
|
|
|
slidePosition,
|
2019-02-21 01:17:17 +08:00
|
|
|
downloadPresentationUri: PresentationAreaService.downloadPresentationUri(podId),
|
2019-08-14 01:41:47 +08:00
|
|
|
userIsPresenter: PresentationAreaService.isPresenter(podId) && !layoutSwapped,
|
2019-03-07 05:57:07 +08:00
|
|
|
multiUser: PresentationAreaService.getMultiUserStatus(currentSlide && currentSlide.id)
|
2019-08-14 01:41:47 +08:00
|
|
|
&& !layoutSwapped,
|
2019-02-21 01:17:17 +08:00
|
|
|
presentationIsDownloadable,
|
2019-03-07 05:57:07 +08:00
|
|
|
mountPresentationArea: !!currentSlide,
|
2019-05-10 01:44:54 +08:00
|
|
|
currentPresentation: PresentationAreaService.getCurrentPresentation(podId),
|
|
|
|
notify,
|
2019-07-18 08:30:28 +08:00
|
|
|
zoomSlide: PresentationToolbarService.zoomSlide,
|
2020-01-25 09:02:36 +08:00
|
|
|
podId,
|
2020-05-12 20:58:14 +08:00
|
|
|
layoutSwapped,
|
|
|
|
toggleSwapLayout: MediaService.toggleSwapLayout,
|
|
|
|
publishedPoll: Meetings.findOne({ meetingId: Auth.meetingID }, {
|
|
|
|
fields: {
|
|
|
|
publishedPoll: 1,
|
|
|
|
},
|
|
|
|
}).publishedPoll,
|
|
|
|
isViewer,
|
2020-05-15 05:06:55 +08:00
|
|
|
currentPresentationId: Session.get('currentPresentationId') || null,
|
2020-05-12 20:58:14 +08:00
|
|
|
restoreOnUpdate: getFromUserSettings(
|
|
|
|
'bbb_force_restore_presentation_on_new_events',
|
|
|
|
Meteor.settings.public.presentation.restoreOnUpdate,
|
|
|
|
),
|
2018-07-27 03:35:38 +08:00
|
|
|
};
|
|
|
|
})(PresentationAreaContainer);
|