show progress view when user clicks on watch modal spinner

This commit is contained in:
Rushikesh Tote 2022-06-07 15:58:20 +05:30
parent 1d9bc49909
commit fd51318ce6
3 changed files with 11 additions and 4 deletions

View file

@ -57,7 +57,7 @@ function WatchModal({
const handleSyncProgressClick = () => {
if (watchService.isUploadRunning) {
// show progress view
watchService.showProgressView();
}
};

View file

@ -120,7 +120,8 @@ export default function Upload(props: Props) {
watchService.setWatchServiceFunctions(
props.setElectronFiles,
setCollectionName,
props.syncWithRemote
props.syncWithRemote,
showProgressView
);
watchService.init();
}
@ -131,6 +132,10 @@ export default function Upload(props: Props) {
pendingDesktopUploadCollectionName.current = collectionName;
};
const showProgressView = () => {
setProgressView(true);
};
useEffect(() => {
if (
props.electronFiles?.length > 0 ||
@ -185,7 +190,7 @@ export default function Upload(props: Props) {
setUploadResult(new Map<number, number>());
setPercentComplete(0);
props.closeCollectionSelector();
setProgressView(true);
!watchService.isUploadRunning && setProgressView(true); // don't show progress view if upload triggered by watch service
};
const resumeDesktopUpload = async (

View file

@ -42,11 +42,13 @@ class WatchService {
setWatchServiceFunctions(
setElectronFiles: (files: ElectronFile[]) => void,
setCollectionName: (collectionName: string) => void,
syncWithRemote: () => void
syncWithRemote: () => void,
showProgressView: () => void
) {
this.setElectronFiles = setElectronFiles;
this.setCollectionName = setCollectionName;
this.syncWithRemote = syncWithRemote;
this.showProgressView = showProgressView;
}
async init() {