Skip to content

Commit

Permalink
[CP-2086] The user can decline to upload files to the File Manager if…
Browse files Browse the repository at this point in the history
… they select more files than they can add within the limit [Harmony] (#1414)

Co-authored-by: Łukasz Kowalczyk <[email protected]>
Co-authored-by: patryk-sierzega <[email protected]>
Co-authored-by: Łukasz Kowalczyk <[email protected]>
Co-authored-by: Daniel Karski <[email protected]>
  • Loading branch information
5 people authored Oct 2, 2023
1 parent 493d098 commit 7bc1c7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"component.updateDownloadedModalDescription": "Do you want to update app now or during next launch?",
"component.updateDownloadedModalMessage": "Update is ready to install",
"component.updateDownloadedModalWarning": "Note that update process will require app {osxPlatform, select, false {restart} true {quit}}.\nMake sure you saved all data you're currently working on.",
"component.updateErrorModalDescription": "Please download the latest Mudita Center version from {link}",
"component.updateErrorModalDescription": "Please restart the app or update it manually.",
"component.updateErrorModalMessage": "Error",
"component.updateForcedModalButton": "Download",
"component.updateForcedModalCurrentVersion": "Your current version: v.{version}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export const abortPendingUpload = createAsyncThunk(
FilesManagerEvent.AbortPendingUpload,
(_, { dispatch }) => {
dispatch(setPendingFilesToUpload([]))
dispatch(setUploadingState(State.Loaded))
dispatch(setUploadingState(State.Initial))
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const FilesManager: FunctionComponent<FilesManagerProps> = ({
abortPendingUpload,
continuePendingUpload,
}) => {
const uploadTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const fileInputRef = useRef<HTMLInputElement>(null)
const { noFoundFiles, searchValue, filteredFiles, handleSearchValueChange } =
useFilesFilter({ files: files ?? [] })
Expand Down Expand Up @@ -141,7 +142,12 @@ const FilesManager: FunctionComponent<FilesManagerProps> = ({
} else if (uploading === State.Loaded) {
updateFieldState("uploading", false)
updateFieldState("deletingInfo", false)
updateFieldState("uploadingInfo", true)
if (uploadingFileCount) {
updateFieldState("uploadingInfo", true)
}
} else if (uploading === State.Pending) {
updateFieldState("uploadingInfo", false)
clearTimeout(uploadTimeoutRef.current || undefined)
} else if (uploading === State.Failed) {
updateFieldState("uploading", false)
updateFieldState("uploadingFailed", true)
Expand Down Expand Up @@ -176,13 +182,13 @@ const FilesManager: FunctionComponent<FilesManagerProps> = ({
return
}

const hideInfoPopupsTimeout = setTimeout(() => {
uploadTimeoutRef.current = setTimeout(() => {
updateFieldState("uploadingInfo", false)
resetUploadingStateAfterSuccess()
}, 5000)

return () => {
clearTimeout(hideInfoPopupsTimeout)
clearTimeout(uploadTimeoutRef.current || undefined)
}
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit 7bc1c7b

Please sign in to comment.