2017-06-07 20:28:41 +08:00
|
|
|
import React 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';
|
2020-10-22 21:00:09 +08:00
|
|
|
import ErrorBoundary from '/imports/ui/components/error-boundary/component';
|
|
|
|
import FallbackModal from '/imports/ui/components/fallback-errors/fallback-modal/component';
|
2017-05-04 00:36:16 +08:00
|
|
|
import Service from './service';
|
2021-06-14 20:55:18 +08:00
|
|
|
import PresentationService from '../service';
|
2017-05-04 00:36:16 +08:00
|
|
|
import PresentationUploader from './component';
|
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-04-21 01:21:12 +08:00
|
|
|
const PresentationUploaderContainer = (props) => (
|
2021-02-16 02:23:02 +08:00
|
|
|
props.isPresenter
|
|
|
|
&& (
|
2021-06-12 03:33:15 +08:00
|
|
|
<ErrorBoundary Fallback={() => <FallbackModal />}>
|
|
|
|
<PresentationUploader {...props} />
|
|
|
|
</ErrorBoundary>
|
2021-02-16 02:23:02 +08:00
|
|
|
)
|
2017-06-07 20:28:41 +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-09-18 04:55:31 +08:00
|
|
|
dispatchDisableDownloadable,
|
|
|
|
dispatchEnableDownloadable,
|
|
|
|
dispatchTogglePresentationDownloadable,
|
|
|
|
} = Service;
|
2017-05-04 00:36:16 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
presentations: currentPresentations,
|
|
|
|
fileValidMimeTypes: PRESENTATION_CONFIG.uploadValidMimeTypes,
|
2021-09-18 04:55:31 +08:00
|
|
|
allowDownloadable: PRESENTATION_CONFIG.allowDownloadable,
|
2021-04-21 01:21:12 +08:00
|
|
|
handleSave: (presentations) => 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',
|
2017-05-23 22:05:42 +08:00
|
|
|
),
|
2019-02-21 06:20:04 +08:00
|
|
|
dispatchDisableDownloadable,
|
|
|
|
dispatchEnableDownloadable,
|
|
|
|
dispatchTogglePresentationDownloadable,
|
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,
|
2021-06-14 20:55:18 +08:00
|
|
|
isPresenter: PresentationService.isPresenter('DEFAULT_PRESENTATION_POD'),
|
2017-05-04 00:36:16 +08:00
|
|
|
};
|
2021-06-14 20:55:18 +08:00
|
|
|
})(PresentationUploaderContainer);
|