mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-25 01:52:45 +03:00
feat(Upload/Popup): expand the popup when new files are added to the upload queue
This commit is contained in:
parent
8314b9ad71
commit
92d544d175
@ -80,17 +80,17 @@ const useUploadPopup = ({ totalFilesSummary }) => {
|
||||
}, [isStarted]);
|
||||
|
||||
/**
|
||||
* NOTE(amine): show the upload summary when a file fails to upload,
|
||||
* NOTE(amine): show the upload summary when a file fails to upload or is added to the queue,
|
||||
* then automatically collapse the upload summary after 3 seconds
|
||||
*/
|
||||
const isSummaryExpandedRef = React.useRef();
|
||||
isSummaryExpandedRef.current = popupState.isSummaryExpanded;
|
||||
React.useEffect(() => {
|
||||
if (isSummaryExpandedRef.current || totalFilesSummary.failed === 0) return;
|
||||
if (isSummaryExpandedRef.current || totalFilesSummary.total === 0) return;
|
||||
expandUploadSummary();
|
||||
clearTimeout(timeoutRef.current);
|
||||
timeoutRef.current = setTimeout(collapseUploadSummary, 3000);
|
||||
}, [totalFilesSummary.failed]);
|
||||
}, [totalFilesSummary.failed, totalFilesSummary.total]);
|
||||
|
||||
// NOTE(amine): show the upload summary when upload finishes
|
||||
const totalFilesSummaryRef = React.useRef();
|
||||
|
Loading…
Reference in New Issue
Block a user