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

57 lines
2.5 KiB
React
Raw Normal View History

import React, { useContext } from 'react';
2020-02-26 03:29:14 +08:00
import { Meteor } from 'meteor/meteor';
import { withTracker } from 'meteor/react-meteor-data';
import ErrorBoundary from '/imports/ui/components/common/error-boundary/component';
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 PresUploaderController from '/imports/ui/components/presentation/presentation-toast/presentation-toast-controller';
2017-05-04 00:36:16 +08:00
import PresentationUploader from './component';
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
import Auth from '/imports/ui/services/auth';
import { isDownloadPresentationWithAnnotationsEnabled } from '/imports/ui/services/features';
2020-02-26 03:29:14 +08:00
const PRESENTATION_CONFIG = Meteor.settings.public.presentation;
2017-05-04 00:36:16 +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 && (
<ErrorBoundary Fallback={() => <FallbackModal />}>
<PresentationUploader isPresenter={userIsPresenter} {...props} />
</ErrorBoundary>
);
};
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();
const {
dispatchDisableDownloadable,
dispatchEnableDownloadable,
dispatchTogglePresentationDownloadable,
exportPresentationToChat,
} = Service;
2017-05-04 00:36:16 +08:00
return {
presentations: currentPresentations,
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,
allowDownloadable: isDownloadPresentationWithAnnotationsEnabled(),
handleSave: Service.handleSavePresentation,
handleDismissToast: PresUploaderController.handleDismissToast,
renderToastList: Service.renderToastList,
renderPresentationItemStatus: PresUploaderController.renderPresentationItemStatus,
dispatchDisableDownloadable,
dispatchEnableDownloadable,
dispatchTogglePresentationDownloadable,
exportPresentationToChat,
isOpen: Session.get('showUploadPresentationView') || false,
selectedToBeNextCurrent: Session.get('selectedToBeNextCurrent') || null,
externalUploadData: Service.getExternalUploadData(),
2017-05-04 00:36:16 +08:00
};
2021-06-14 20:55:18 +08:00
})(PresentationUploaderContainer);