2021-11-23 22:12:00 +08:00
|
|
|
import React, { useContext } from 'react';
|
2020-02-26 03:29:14 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2022-02-15 22:11:03 +08:00
|
|
|
import ErrorBoundary from '/imports/ui/components/common/error-boundary/component';
|
2022-02-15 22:29:38 +08:00
|
|
|
import FallbackModal from '/imports/ui/components/common/fallback-errors/fallback-modal/component';
|
2017-05-04 00:36:16 +08:00
|
|
|
import Service from './service';
|
2022-09-23 23:24:39 +08:00
|
|
|
import PresUploaderToast from '/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component';
|
2017-05-04 00:36:16 +08:00
|
|
|
import PresentationUploader from './component';
|
2021-11-23 22:12:00 +08:00
|
|
|
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
2023-03-10 19:30:46 +08:00
|
|
|
import { isDownloadPresentationWithAnnotationsEnabled, isPresentationEnabled } from '/imports/ui/services/features';
|
2020-02-26 03:29:14 +08:00
|
|
|
|
2020-03-10 20:58:14 +08:00
|
|
|
const PRESENTATION_CONFIG = Meteor.settings.public.presentation;
|
2017-05-04 00:36:16 +08:00
|
|
|
|
2021-11-23 22:12:00 +08:00
|
|
|
const PresentationUploaderContainer = (props) => {
|
|
|
|
const usingUsersContext = useContext(UsersContext);
|
|
|
|
const { users } = usingUsersContext;
|
|
|
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
2023-02-15 05:43:35 +08:00
|
|
|
const userIsPresenter = currentUser.presenter;
|
2021-11-23 22:12:00 +08:00
|
|
|
|
|
|
|
return userIsPresenter && (
|
2023-03-24 21:07:56 +08:00
|
|
|
<ErrorBoundary Fallback={FallbackModal}>
|
2023-02-15 05:43:35 +08:00
|
|
|
<PresentationUploader isPresenter={userIsPresenter} {...props} />
|
2021-06-12 03:33:15 +08:00
|
|
|
</ErrorBoundary>
|
2021-11-23 22:12:00 +08:00
|
|
|
);
|
|
|
|
};
|
2017-05-04 00:36:16 +08:00
|
|
|
|
2021-06-14 20:55:18 +08:00
|
|
|
export default withTracker(() => {
|
2017-05-04 00:36:16 +08:00
|
|
|
const currentPresentations = Service.getPresentations();
|
2019-12-24 22:48:44 +08:00
|
|
|
const {
|
2021-11-23 22:12:00 +08:00
|
|
|
dispatchDisableDownloadable,
|
|
|
|
dispatchEnableDownloadable,
|
|
|
|
dispatchTogglePresentationDownloadable,
|
2022-07-20 03:36:00 +08:00
|
|
|
exportPresentationToChat,
|
2021-11-23 22:12:00 +08:00
|
|
|
} = Service;
|
2023-02-23 04:16:43 +08:00
|
|
|
const isOpen = isPresentationEnabled() && (Session.get('showUploadPresentationView') || false);
|
2017-05-04 00:36:16 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
presentations: currentPresentations,
|
2022-01-20 03:45:24 +08:00
|
|
|
fileUploadConstraintsHint: PRESENTATION_CONFIG.fileUploadConstraintsHint,
|
|
|
|
fileSizeMax: PRESENTATION_CONFIG.mirroredFromBBBCore.uploadSizeMax,
|
|
|
|
filePagesMax: PRESENTATION_CONFIG.mirroredFromBBBCore.uploadPagesMax,
|
2017-05-04 00:36:16 +08:00
|
|
|
fileValidMimeTypes: PRESENTATION_CONFIG.uploadValidMimeTypes,
|
2022-08-02 21:53:40 +08:00
|
|
|
allowDownloadable: isDownloadPresentationWithAnnotationsEnabled(),
|
2022-08-08 19:50:52 +08:00
|
|
|
handleSave: Service.handleSavePresentation,
|
2022-09-23 23:24:39 +08:00
|
|
|
handleDismissToast: PresUploaderToast.handleDismissToast,
|
2022-07-22 21:06:32 +08:00
|
|
|
renderToastList: Service.renderToastList,
|
2022-09-23 23:24:39 +08:00
|
|
|
renderPresentationItemStatus: PresUploaderToast.renderPresentationItemStatus,
|
2019-02-21 06:20:04 +08:00
|
|
|
dispatchDisableDownloadable,
|
|
|
|
dispatchEnableDownloadable,
|
|
|
|
dispatchTogglePresentationDownloadable,
|
2022-07-20 03:36:00 +08:00
|
|
|
exportPresentationToChat,
|
2023-02-21 20:38:44 +08:00
|
|
|
isOpen,
|
2020-03-10 23:19:14 +08:00
|
|
|
selectedToBeNextCurrent: Session.get('selectedToBeNextCurrent') || null,
|
2022-06-25 00:47:17 +08:00
|
|
|
externalUploadData: Service.getExternalUploadData(),
|
2022-12-08 22:20:17 +08:00
|
|
|
handleFiledrop: Service.handleFiledrop,
|
2017-05-04 00:36:16 +08:00
|
|
|
};
|
2021-06-14 20:55:18 +08:00
|
|
|
})(PresentationUploaderContainer);
|