2023-10-19 20:57:40 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { PresentationUploaderToast } from './component';
|
2024-06-04 21:40:54 +08:00
|
|
|
|
2023-10-19 20:57:40 +08:00
|
|
|
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';
|
2024-06-04 21:40:54 +08:00
|
|
|
import useDeduplicatedSubscription from '/imports/ui/core/hooks/useDeduplicatedSubscription';
|
2023-10-19 20:57:40 +08:00
|
|
|
|
|
|
|
const PresentationUploaderToastContainer = (props) => {
|
2024-06-14 21:41:14 +08:00
|
|
|
const {
|
|
|
|
data: presentationData,
|
|
|
|
loading: presentationLoading,
|
|
|
|
} = useDeduplicatedSubscription(
|
2024-06-04 21:40:54 +08:00
|
|
|
EXPORTING_PRESENTATIONS_SUBSCRIPTION,
|
|
|
|
);
|
2023-10-19 20:57:40 +08:00
|
|
|
const presentations = presentationData?.pres_presentation || [];
|
|
|
|
|
|
|
|
const convertingPresentations = presentations.filter(
|
2024-06-14 21:41:14 +08:00
|
|
|
(p) => (!p.uploadCompleted || !!p.uploadErrorMsgKey),
|
2023-10-19 20:57:40 +08:00
|
|
|
);
|
2024-06-14 21:41:14 +08:00
|
|
|
if (presentationLoading) return null;
|
|
|
|
if (!presentations.length) return null;
|
2023-10-19 20:57:40 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<PresentationUploaderToast
|
|
|
|
{
|
|
|
|
...{
|
2024-06-14 21:41:14 +08:00
|
|
|
presentations: presentations.filter((p) => p),
|
2023-10-19 20:57:40 +08:00
|
|
|
convertingPresentations,
|
|
|
|
...props,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-06-14 21:41:14 +08:00
|
|
|
export default PresentationUploaderToastContainer;
|