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';
|
|
|
|
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';
|
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];
|
|
|
|
const userIsPresenter = currentUser.presenter;
|
|
|
|
|
|
|
|
return userIsPresenter && (
|
2021-06-12 03:33:15 +08:00
|
|
|
<ErrorBoundary Fallback={() => <FallbackModal />}>
|
2021-11-23 22:12:00 +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;
|
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,
|
2021-09-18 04:55:31 +08:00
|
|
|
allowDownloadable: PRESENTATION_CONFIG.allowDownloadable,
|
2022-07-22 21:06:32 +08:00
|
|
|
handleSave: (presentations, toUploadCount, intl) => Service.persistPresentationChanges(
|
2017-05-23 22:05:42 +08:00
|
|
|
currentPresentations,
|
|
|
|
presentations,
|
2017-06-07 20:28:41 +08:00
|
|
|
PRESENTATION_CONFIG.uploadEndpoint,
|
2018-09-05 00:56:10 +08:00
|
|
|
'DEFAULT_PRESENTATION_POD',
|
2022-07-22 21:06:32 +08:00
|
|
|
toUploadCount,
|
|
|
|
intl
|
|
|
|
),
|
|
|
|
handleDismissToast: Service.handleDismissToast,
|
|
|
|
renderToastList: Service.renderToastList,
|
|
|
|
renderPresentationItemStatus: Service.renderPresentationItemStatus,
|
2019-02-21 06:20:04 +08:00
|
|
|
dispatchDisableDownloadable,
|
|
|
|
dispatchEnableDownloadable,
|
|
|
|
dispatchTogglePresentationDownloadable,
|
2022-07-20 03:36:00 +08:00
|
|
|
exportPresentationToChat,
|
2020-03-10 20:58:14 +08:00
|
|
|
isOpen: Session.get('showUploadPresentationView') || false,
|
2020-03-10 23:19:14 +08:00
|
|
|
selectedToBeNextCurrent: Session.get('selectedToBeNextCurrent') || null,
|
2017-05-04 00:36:16 +08:00
|
|
|
};
|
2021-06-14 20:55:18 +08:00
|
|
|
})(PresentationUploaderContainer);
|