Skip to content
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

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

Murderlon
Copy link
Member

Closes #5412

Possibly related: #5350

These conditions aren't pretty. But until Uppy becomes a finite state machine, it is what it is.

@Murderlon Murderlon self-assigned this Aug 19, 2024
Copy link
Contributor

Diff output files
diff --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) &&
Copy link
Contributor

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:

Suggested change
((!isUploadInProgress && !isAllPaused) || recoveredState) &&
(recoveredState || !(isUploadInProgress || isAllPaused)) &&

Copy link
Member Author

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

Copy link
Contributor

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)
    )

Copy link
Member Author

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.

Copy link
Contributor

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

@aduh95 aduh95 merged commit eec0d8a into main Aug 20, 2024
17 checks passed
@aduh95 aduh95 deleted the status-bar-golden-retriever branch August 20, 2024 18:24
@github-actions github-actions bot mentioned this pull request Aug 20, 2024
github-actions bot added a commit that referenced this pull request Aug 21, 2024
| 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removed the resume button for the Golden Retriever Plugin in Uppy
2 participants