-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@uppy/status-bar: show upload button when files are recovered #5418
Conversation
Diff output filesdiff --git a/packages/@uppy/status-bar/lib/StatusBarUI.js b/packages/@uppy/status-bar/lib/StatusBarUI.js
index e518609..07a54f3 100644
--- a/packages/@uppy/status-bar/lib/StatusBarUI.js
+++ b/packages/@uppy/status-bar/lib/StatusBarUI.js
@@ -97,7 +97,7 @@ export default function StatusBarUI(_ref) {
}
const progressValue = getProgressValue();
const width = progressValue != null ? progressValue : 100;
- const showUploadBtn = !error && newFiles && !isUploadInProgress && !isAllPaused && allowNewUpload
+ const showUploadBtn = !error && newFiles && (!isUploadInProgress && !isAllPaused || recoveredState) && allowNewUpload
&& !hideUploadButton;
const showCancelBtn = !hideCancelButton && uploadState !== STATE_WAITING && uploadState !== STATE_COMPLETE;
const showPauseResumeBtn = resumableUploads && !hidePauseResumeButton && uploadState === STATE_UPLOADING; |
@@ -140,8 +140,7 @@ export default function StatusBarUI<M extends Meta, B extends Body>({ | |||
const showUploadBtn = | |||
!error && | |||
newFiles && | |||
!isUploadInProgress && | |||
!isAllPaused && | |||
((!isUploadInProgress && !isAllPaused) || recoveredState) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it might be easier to follow the logic by rewriting it to:
((!isUploadInProgress && !isAllPaused) || recoveredState) && | |
(recoveredState || !(isUploadInProgress || isAllPaused)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I read the first one quicker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt of
const showUploadBtn =
!hideUploadButton &&
!error &&
newFiles &&
allowNewUpload &&
(
recoveredState ||
(!isUploadInProgress && !isAllPaused)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's basically the same but different formatting? It's up to prettier to decide that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order is different, and IMO easier to follow
| Package | Version | Package | Version | | ----------------- | ------- | ----------------- | ------- | | @uppy/core | 4.1.2 | @uppy/transloadit | 4.1.0 | | @uppy/status-bar | 4.0.3 | uppy | 4.2.0 | | @uppy/svelte | 4.0.1 | | | - @uppy/status-bar: show upload button when files are recovered (Merlijn Vos / #5418) - meta: Bump docker/build-push-action from 6.6.1 to 6.7.0 (dependabot[bot] / #5413) - docs: remove stale reference to plugins page (Merlijn Vos / #5414) - @uppy/transloadit: add execution_progress to AssemblyResponse type (Merlijn Vos / #5420) - @uppy/svelte: fix exports condition (Merlijn Vos / #5416) - @uppy/transloadit: fix check if all files have been removed (Merlijn Vos / #5419) - examples: remove `useUppy` from React Native example (Mikael Finstad / #5405)
Closes #5412
Possibly related: #5350
These conditions aren't pretty. But until Uppy becomes a finite state machine, it is what it is.