|
@@ -52,7 +52,8 @@ function togglePauseResume (props) {
|
|
|
module.exports = (props) => {
|
|
|
props = props || {}
|
|
|
|
|
|
- const { newFiles,
|
|
|
+ const {
|
|
|
+ newFiles,
|
|
|
allowNewUpload,
|
|
|
isUploadInProgress,
|
|
|
isAllPaused,
|
|
@@ -61,7 +62,8 @@ module.exports = (props) => {
|
|
|
hideUploadButton,
|
|
|
hidePauseResumeButton,
|
|
|
hideCancelButton,
|
|
|
- hideRetryButton } = props
|
|
|
+ hideRetryButton
|
|
|
+ } = props
|
|
|
|
|
|
const uploadState = props.uploadState
|
|
|
|
|
@@ -120,18 +122,20 @@ module.exports = (props) => {
|
|
|
|
|
|
return (
|
|
|
<div class={statusBarClassNames} aria-hidden={isHidden}>
|
|
|
- <div class={progressClassNames}
|
|
|
+ <div
|
|
|
+ class={progressClassNames}
|
|
|
style={{ width: width + '%' }}
|
|
|
role="progressbar"
|
|
|
aria-valuemin="0"
|
|
|
aria-valuemax="100"
|
|
|
- aria-valuenow={progressValue} />
|
|
|
+ aria-valuenow={progressValue}
|
|
|
+ />
|
|
|
{progressBarContent}
|
|
|
<div class="uppy-StatusBar-actions">
|
|
|
- { showUploadBtn ? <UploadBtn {...props} uploadState={uploadState} /> : null }
|
|
|
- { showRetryBtn ? <RetryBtn {...props} /> : null }
|
|
|
- { showPauseResumeBtn ? <PauseResumeButton {...props} /> : null }
|
|
|
- { showCancelBtn ? <CancelBtn {...props} /> : null }
|
|
|
+ {showUploadBtn ? <UploadBtn {...props} uploadState={uploadState} /> : null}
|
|
|
+ {showRetryBtn ? <RetryBtn {...props} /> : null}
|
|
|
+ {showPauseResumeBtn ? <PauseResumeButton {...props} /> : null}
|
|
|
+ {showCancelBtn ? <CancelBtn {...props} /> : null}
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|
|
@@ -146,23 +150,28 @@ const UploadBtn = (props) => {
|
|
|
{ 'uppy-c-btn-primary': props.uploadState === statusBarStates.STATE_WAITING }
|
|
|
)
|
|
|
|
|
|
- return <button type="button"
|
|
|
- class={uploadBtnClassNames}
|
|
|
- aria-label={props.i18n('uploadXFiles', { smart_count: props.newFiles })}
|
|
|
- onclick={props.startUpload}
|
|
|
- data-uppy-super-focusable>
|
|
|
- {props.newFiles && props.isUploadStarted
|
|
|
- ? props.i18n('uploadXNewFiles', { smart_count: props.newFiles })
|
|
|
- : props.i18n('uploadXFiles', { smart_count: props.newFiles })
|
|
|
- }
|
|
|
- </button>
|
|
|
+ return (
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ class={uploadBtnClassNames}
|
|
|
+ aria-label={props.i18n('uploadXFiles', { smart_count: props.newFiles })}
|
|
|
+ onclick={props.startUpload}
|
|
|
+ data-uppy-super-focusable
|
|
|
+ >
|
|
|
+ {props.newFiles && props.isUploadStarted
|
|
|
+ ? props.i18n('uploadXNewFiles', { smart_count: props.newFiles })
|
|
|
+ : props.i18n('uploadXFiles', { smart_count: props.newFiles })}
|
|
|
+ </button>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const RetryBtn = (props) => {
|
|
|
return (
|
|
|
- <button type="button"
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
class="uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry" aria-label={props.i18n('retryUpload')} onclick={props.retryAll}
|
|
|
- data-uppy-super-focusable>
|
|
|
+ data-uppy-super-focusable
|
|
|
+ >
|
|
|
<svg aria-hidden="true" focusable="false" class="UppyIcon" width="8" height="10" viewBox="0 0 8 10">
|
|
|
<path d="M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z" />
|
|
|
</svg>
|
|
@@ -172,64 +181,75 @@ const RetryBtn = (props) => {
|
|
|
}
|
|
|
|
|
|
const CancelBtn = (props) => {
|
|
|
- return <button
|
|
|
- type="button"
|
|
|
- class="uppy-u-reset uppy-StatusBar-actionCircleBtn"
|
|
|
- title={props.i18n('cancel')}
|
|
|
- aria-label={props.i18n('cancel')}
|
|
|
- onclick={props.cancelAll}
|
|
|
- data-uppy-super-focusable>
|
|
|
- <svg aria-hidden="true" focusable="false" class="UppyIcon" width="16" height="16" viewBox="0 0 16 16">
|
|
|
- <g fill="none" fill-rule="evenodd">
|
|
|
- <circle fill="#888" cx="8" cy="8" r="8" />
|
|
|
- <path fill="#FFF" d="M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z" />
|
|
|
- </g>
|
|
|
- </svg>
|
|
|
- </button>
|
|
|
+ return (
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ class="uppy-u-reset uppy-StatusBar-actionCircleBtn"
|
|
|
+ title={props.i18n('cancel')}
|
|
|
+ aria-label={props.i18n('cancel')}
|
|
|
+ onclick={props.cancelAll}
|
|
|
+ data-uppy-super-focusable
|
|
|
+ >
|
|
|
+ <svg aria-hidden="true" focusable="false" class="UppyIcon" width="16" height="16" viewBox="0 0 16 16">
|
|
|
+ <g fill="none" fill-rule="evenodd">
|
|
|
+ <circle fill="#888" cx="8" cy="8" r="8" />
|
|
|
+ <path fill="#FFF" d="M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z" />
|
|
|
+ </g>
|
|
|
+ </svg>
|
|
|
+ </button>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const PauseResumeButton = (props) => {
|
|
|
const { isAllPaused, i18n } = props
|
|
|
const title = isAllPaused ? i18n('resume') : i18n('pause')
|
|
|
|
|
|
- return <button
|
|
|
- title={title}
|
|
|
- aria-label={title}
|
|
|
- class="uppy-u-reset uppy-StatusBar-actionCircleBtn"
|
|
|
- type="button"
|
|
|
- onclick={() => togglePauseResume(props)}
|
|
|
- data-uppy-super-focusable>
|
|
|
- {isAllPaused
|
|
|
- ? <svg aria-hidden="true" focusable="false" class="UppyIcon" width="16" height="16" viewBox="0 0 16 16">
|
|
|
- <g fill="none" fill-rule="evenodd">
|
|
|
- <circle fill="#888" cx="8" cy="8" r="8" />
|
|
|
- <path fill="#FFF" d="M6 4.25L11.5 8 6 11.75z" />
|
|
|
- </g>
|
|
|
- </svg>
|
|
|
- : <svg aria-hidden="true" focusable="false" class="UppyIcon" width="16" height="16" viewBox="0 0 16 16">
|
|
|
- <g fill="none" fill-rule="evenodd">
|
|
|
- <circle fill="#888" cx="8" cy="8" r="8" />
|
|
|
- <path d="M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z" fill="#FFF" />
|
|
|
- </g>
|
|
|
- </svg>
|
|
|
- }
|
|
|
- </button>
|
|
|
+ return (
|
|
|
+ <button
|
|
|
+ title={title}
|
|
|
+ aria-label={title}
|
|
|
+ class="uppy-u-reset uppy-StatusBar-actionCircleBtn"
|
|
|
+ type="button"
|
|
|
+ onclick={() => togglePauseResume(props)}
|
|
|
+ data-uppy-super-focusable
|
|
|
+ >
|
|
|
+ {isAllPaused ? (
|
|
|
+ <svg aria-hidden="true" focusable="false" class="UppyIcon" width="16" height="16" viewBox="0 0 16 16">
|
|
|
+ <g fill="none" fill-rule="evenodd">
|
|
|
+ <circle fill="#888" cx="8" cy="8" r="8" />
|
|
|
+ <path fill="#FFF" d="M6 4.25L11.5 8 6 11.75z" />
|
|
|
+ </g>
|
|
|
+ </svg>
|
|
|
+ ) : (
|
|
|
+ <svg aria-hidden="true" focusable="false" class="UppyIcon" width="16" height="16" viewBox="0 0 16 16">
|
|
|
+ <g fill="none" fill-rule="evenodd">
|
|
|
+ <circle fill="#888" cx="8" cy="8" r="8" />
|
|
|
+ <path d="M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z" fill="#FFF" />
|
|
|
+ </g>
|
|
|
+ </svg>
|
|
|
+ )}
|
|
|
+ </button>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const LoadingSpinner = () => {
|
|
|
- return <svg aria-hidden="true" focusable="false" class="uppy-StatusBar-spinner" width="14" height="14">
|
|
|
- <path d="M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0" fill-rule="evenodd" />
|
|
|
- </svg>
|
|
|
+ return (
|
|
|
+ <svg aria-hidden="true" focusable="false" class="uppy-StatusBar-spinner" width="14" height="14">
|
|
|
+ <path d="M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0" fill-rule="evenodd" />
|
|
|
+ </svg>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const ProgressBarProcessing = (props) => {
|
|
|
const value = Math.round(props.value * 100)
|
|
|
|
|
|
- return <div class="uppy-StatusBar-content">
|
|
|
- <LoadingSpinner />
|
|
|
- {props.mode === 'determinate' ? `${value}% \u00B7 ` : ''}
|
|
|
- {props.message}
|
|
|
- </div>
|
|
|
+ return (
|
|
|
+ <div class="uppy-StatusBar-content">
|
|
|
+ <LoadingSpinner />
|
|
|
+ {props.mode === 'determinate' ? `${value}% \u00B7 ` : ''}
|
|
|
+ {props.message}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const renderDot = () =>
|
|
@@ -238,43 +258,47 @@ const renderDot = () =>
|
|
|
const ProgressDetails = (props) => {
|
|
|
const ifShowFilesUploadedOfTotal = props.numUploads > 1
|
|
|
|
|
|
- return <div class="uppy-StatusBar-statusSecondary">
|
|
|
- {
|
|
|
- ifShowFilesUploadedOfTotal &&
|
|
|
- props.i18n('filesUploadedOfTotal', {
|
|
|
- complete: props.complete,
|
|
|
- smart_count: props.numUploads
|
|
|
- })
|
|
|
- }
|
|
|
- <span class="uppy-StatusBar-additionalInfo">
|
|
|
- {/* When should we render this dot?
|
|
|
- 1. .-additionalInfo is shown (happens only on desktops)
|
|
|
- 2. AND 'filesUploadedOfTotal' was shown
|
|
|
- */}
|
|
|
- {ifShowFilesUploadedOfTotal && renderDot()}
|
|
|
-
|
|
|
+ return (
|
|
|
+ <div class="uppy-StatusBar-statusSecondary">
|
|
|
{
|
|
|
- props.i18n('dataUploadedOfTotal', {
|
|
|
- complete: prettyBytes(props.totalUploadedSize),
|
|
|
- total: prettyBytes(props.totalSize)
|
|
|
+ ifShowFilesUploadedOfTotal &&
|
|
|
+ props.i18n('filesUploadedOfTotal', {
|
|
|
+ complete: props.complete,
|
|
|
+ smart_count: props.numUploads
|
|
|
})
|
|
|
}
|
|
|
+ <span class="uppy-StatusBar-additionalInfo">
|
|
|
+ {/* When should we render this dot?
|
|
|
+ 1. .-additionalInfo is shown (happens only on desktops)
|
|
|
+ 2. AND 'filesUploadedOfTotal' was shown
|
|
|
+ */}
|
|
|
+ {ifShowFilesUploadedOfTotal && renderDot()}
|
|
|
+
|
|
|
+ {
|
|
|
+ props.i18n('dataUploadedOfTotal', {
|
|
|
+ complete: prettyBytes(props.totalUploadedSize),
|
|
|
+ total: prettyBytes(props.totalSize)
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- {renderDot()}
|
|
|
+ {renderDot()}
|
|
|
|
|
|
- {
|
|
|
- props.i18n('xTimeLeft', {
|
|
|
- time: prettyETA(props.totalETA)
|
|
|
- })
|
|
|
- }
|
|
|
- </span>
|
|
|
- </div>
|
|
|
+ {
|
|
|
+ props.i18n('xTimeLeft', {
|
|
|
+ time: prettyETA(props.totalETA)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const UnknownProgressDetails = (props) => {
|
|
|
- return <div class="uppy-StatusBar-statusSecondary">
|
|
|
- { props.i18n('filesUploadedOfTotal', { complete: props.complete, smart_count: props.numUploads }) }
|
|
|
- </div>
|
|
|
+ return (
|
|
|
+ <div class="uppy-StatusBar-statusSecondary">
|
|
|
+ {props.i18n('filesUploadedOfTotal', { complete: props.complete, smart_count: props.numUploads })}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const UploadNewlyAddedFiles = (props) => {
|
|
@@ -285,17 +309,21 @@ const UploadNewlyAddedFiles = (props) => {
|
|
|
'uppy-StatusBar-actionBtn--uploadNewlyAdded'
|
|
|
)
|
|
|
|
|
|
- return <div class="uppy-StatusBar-statusSecondary">
|
|
|
- <div class="uppy-StatusBar-statusSecondaryHint">
|
|
|
- { props.i18n('xMoreFilesAdded', { smart_count: props.newFiles }) }
|
|
|
+ return (
|
|
|
+ <div class="uppy-StatusBar-statusSecondary">
|
|
|
+ <div class="uppy-StatusBar-statusSecondaryHint">
|
|
|
+ {props.i18n('xMoreFilesAdded', { smart_count: props.newFiles })}
|
|
|
+ </div>
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ class={uploadBtnClassNames}
|
|
|
+ aria-label={props.i18n('uploadXFiles', { smart_count: props.newFiles })}
|
|
|
+ onclick={props.startUpload}
|
|
|
+ >
|
|
|
+ {props.i18n('upload')}
|
|
|
+ </button>
|
|
|
</div>
|
|
|
- <button type="button"
|
|
|
- class={uploadBtnClassNames}
|
|
|
- aria-label={props.i18n('uploadXFiles', { smart_count: props.newFiles })}
|
|
|
- onclick={props.startUpload}>
|
|
|
- {props.i18n('upload')}
|
|
|
- </button>
|
|
|
- </div>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const ThrottledProgressDetails = throttle(ProgressDetails, 500, { leading: true, trailing: true })
|
|
@@ -310,16 +338,15 @@ const ProgressBarUploading = (props) => {
|
|
|
|
|
|
return (
|
|
|
<div class="uppy-StatusBar-content" aria-label={title} title={title}>
|
|
|
- { !props.isAllPaused ? <LoadingSpinner /> : null }
|
|
|
+ {!props.isAllPaused ? <LoadingSpinner /> : null}
|
|
|
<div class="uppy-StatusBar-status">
|
|
|
<div class="uppy-StatusBar-statusPrimary">
|
|
|
{props.supportsUploadProgress ? `${title}: ${props.totalProgress}%` : title}
|
|
|
</div>
|
|
|
- { !props.isAllPaused && !showUploadNewlyAddedFiles && props.showProgressDetails
|
|
|
+ {!props.isAllPaused && !showUploadNewlyAddedFiles && props.showProgressDetails
|
|
|
? (props.supportsUploadProgress ? <ThrottledProgressDetails {...props} /> : <UnknownProgressDetails {...props} />)
|
|
|
- : null
|
|
|
- }
|
|
|
- { showUploadNewlyAddedFiles ? <UploadNewlyAddedFiles {...props} /> : null }
|
|
|
+ : null}
|
|
|
+ {showUploadNewlyAddedFiles ? <UploadNewlyAddedFiles {...props} /> : null}
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|
|
@@ -354,11 +381,15 @@ const ProgressBarError = ({ error, retryAll, hideRetryButton, i18n }) => {
|
|
|
{/* {!hideRetryButton &&
|
|
|
<span class="uppy-StatusBar-contentPadding">{i18n('pleasePressRetry')}</span>
|
|
|
} */}
|
|
|
- <span class="uppy-StatusBar-details"
|
|
|
+ <span
|
|
|
+ class="uppy-StatusBar-details"
|
|
|
aria-label={error}
|
|
|
data-microtip-position="top-right"
|
|
|
data-microtip-size="medium"
|
|
|
- role="tooltip">?</span>
|
|
|
+ role="tooltip"
|
|
|
+ >
|
|
|
+ ?
|
|
|
+ </span>
|
|
|
</div>
|
|
|
)
|
|
|
}
|