Skip to content

Commit

Permalink
Hide upload button when state is recovered if hideUploadButton is true
Browse files Browse the repository at this point in the history
  • Loading branch information
Madeline Lumetta authored and maddy-jo committed Sep 12, 2023
1 parent 3104f94 commit 6f3ff0c
Showing 1 changed file with 46 additions and 37 deletions.
83 changes: 46 additions & 37 deletions packages/@uppy/status-bar/src/StatusBarUI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,11 @@ export default function StatusBar (props) {

const width = progressValue ?? 100

const showUploadBtn = !error
&& newFiles
&& !isUploadInProgress
&& !isAllPaused
&& allowNewUpload
&& !hideUploadButton
const showUploadBtn = !hideUploadButton
&& (
(!error && newFiles && !isUploadInProgress && !isAllPaused && allowNewUpload)
|| recoveredState
)

const showCancelBtn = !hideCancelButton
&& uploadState !== STATE_WAITING
Expand All @@ -141,6 +140,14 @@ export default function StatusBar (props) {

const showDoneBtn = doneButtonHandler && uploadState === STATE_COMPLETE

const hasActions = (
showUploadBtn
|| showCancelBtn
|| showPauseResumeBtn
|| showRetryBtn
|| showDoneBtn
)

const progressClassNames = classNames('uppy-StatusBar-progress', {
'is-indeterminate': getIsIndeterminate(),
})
Expand Down Expand Up @@ -204,37 +211,39 @@ export default function StatusBar (props) {
}
})()}

<div className="uppy-StatusBar-actions">
{recoveredState || showUploadBtn ? (
<UploadBtn
newFiles={newFiles}
isUploadStarted={isUploadStarted}
recoveredState={recoveredState}
i18n={i18n}
isSomeGhost={isSomeGhost}
startUpload={startUpload}
uploadState={uploadState}
/>
) : null}

{showRetryBtn ? <RetryBtn i18n={i18n} uppy={uppy} /> : null}

{showPauseResumeBtn ? (
<PauseResumeButton
isAllPaused={isAllPaused}
i18n={i18n}
isAllComplete={isAllComplete}
resumableUploads={resumableUploads}
uppy={uppy}
/>
) : null}

{showCancelBtn ? <CancelBtn i18n={i18n} uppy={uppy} /> : null}

{showDoneBtn ? (
<DoneBtn i18n={i18n} doneButtonHandler={doneButtonHandler} />
) : null}
</div>
{hasActions ? (
<div className="uppy-StatusBar-actions">
{showUploadBtn ? (
<UploadBtn
newFiles={newFiles}
isUploadStarted={isUploadStarted}
recoveredState={recoveredState}
i18n={i18n}
isSomeGhost={isSomeGhost}
startUpload={startUpload}
uploadState={uploadState}
/>
) : null}

{showRetryBtn ? <RetryBtn i18n={i18n} uppy={uppy} /> : null}

{showPauseResumeBtn ? (
<PauseResumeButton
isAllPaused={isAllPaused}
i18n={i18n}
isAllComplete={isAllComplete}
resumableUploads={resumableUploads}
uppy={uppy}
/>
) : null}

{showCancelBtn ? <CancelBtn i18n={i18n} uppy={uppy} /> : null}

{showDoneBtn ? (
<DoneBtn i18n={i18n} doneButtonHandler={doneButtonHandler} />
) : null}
</div>
) : null}
</div>
)
}

0 comments on commit 6f3ff0c

Please sign in to comment.