aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index e33bb77de..d7d988c19 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -446,6 +446,7 @@ export function CollectionSubView<X>(moreProps?: X) {
}
this.slowLoadDocuments(files, options, generatedDocuments, text, completed, e.clientX, e.clientY, addDocument).then(batch.end);
}
+
slowLoadDocuments = async (
files: File[] | string,
options: DocumentOptions,
@@ -456,11 +457,30 @@ export function CollectionSubView<X>(moreProps?: X) {
clientY: number,
addDocument: (doc: Doc | Doc[]) => boolean
) => {
- const disposer = OverlayView.Instance.addElement(<ReactLoading type={'spinningBubbles'} color={'green'} height={250} width={250} />, { x: clientX - 125, y: clientY - 125 });
+ // create placeholder docs
+ // inside placeholder docs have some func that
+
+ // TODO: once loading thing is moved it should update the x and y of the file it is placeholder for
+ let pileUpDoc = undefined;
+ // const disposer = OverlayView.Instance.addElement(<ReactLoading type={'spinningBubbles'} color={'green'} height={250} width={250} />, { x: clientX - 125, y: clientY - 125 });
if (typeof files === 'string') {
- generatedDocuments.push(...(await DocUtils.uploadYoutubeVideo(files, options)));
+ // uploadYoutubeVideo and similar should return a placeholder, one for each placeholder
+ // generatedDocuments.push(Docs.Create.LoadingDocument(files, options));
+ const loading = Docs.Create.LoadingDocument(files, options);
+ generatedDocuments.push(loading);
+ Docs.Create.docsToFiles.set(loading, files);
+ DocUtils.uploadYoutubeVideoLoading(files, {}, loading);
} else {
- generatedDocuments.push(...(await DocUtils.uploadFilesToDocs(files, options)));
+ // uploadFilesToDocs and similar should return a placeholder, one for each placeholder
+ generatedDocuments.push(
+ ...files.map(file => {
+ const loading = Docs.Create.LoadingDocument(file, options);
+ // now that there is a doc do whatever slowload was going to do with that file
+ Docs.Create.docsToFiles.set(loading, file);
+ DocUtils.uploadFileToDoc(file, {}, loading);
+ return loading;
+ })
+ );
}
if (generatedDocuments.length) {
// Creating a dash document
@@ -476,7 +496,8 @@ export function CollectionSubView<X>(moreProps?: X) {
if (completed) completed(set);
else {
if (isFreeformView && generatedDocuments.length > 1) {
- addDocument(DocUtils.pileup(generatedDocuments, options.x as number, options.y as number)!);
+ pileUpDoc = DocUtils.pileup(generatedDocuments, options.x as number, options.y as number)!;
+ addDocument(pileUpDoc);
} else {
generatedDocuments.forEach(addDocument);
}
@@ -488,7 +509,6 @@ export function CollectionSubView<X>(moreProps?: X) {
alert('Document upload failed - possibly an unsupported file type.');
}
}
- disposer();
};
}