2023-10-19 20:57:40 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import { UploadingPresentations } from '/imports/api/presentations';
|
|
|
|
import { PresentationUploaderToast } from './component';
|
|
|
|
import { useSubscription } from '@apollo/client';
|
|
|
|
import {
|
2023-10-20 02:56:13 +08:00
|
|
|
EXPORTING_PRESENTATIONS_SUBSCRIPTION,
|
2023-10-19 20:57:40 +08:00
|
|
|
} from '/imports/ui/components/whiteboard/queries';
|
|
|
|
|
|
|
|
const PresentationUploaderToastContainer = (props) => {
|
2023-10-20 02:56:13 +08:00
|
|
|
const { data: presentationData } = useSubscription(EXPORTING_PRESENTATIONS_SUBSCRIPTION);
|
2023-10-19 20:57:40 +08:00
|
|
|
const presentations = presentationData?.pres_presentation || [];
|
|
|
|
|
|
|
|
const convertingPresentations = presentations.filter(
|
2023-10-26 20:16:49 +08:00
|
|
|
(p) => !p.uploadCompleted || !!p.uploadErrorMsgKey,
|
2023-10-19 20:57:40 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<PresentationUploaderToast
|
|
|
|
{
|
|
|
|
...{
|
2023-10-20 02:56:13 +08:00
|
|
|
presentations,
|
2023-10-19 20:57:40 +08:00
|
|
|
convertingPresentations,
|
|
|
|
...props,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withTracker(() => {
|
|
|
|
const uploadingPresentations = UploadingPresentations.find({ $or: [{ 'upload.error': true }, { 'upload.done': false }] }).fetch();
|
|
|
|
|
|
|
|
return {
|
|
|
|
uploadingPresentations,
|
|
|
|
};
|
|
|
|
})(PresentationUploaderToastContainer);
|