From e3b2a1f699e4fc92a37dc0b1acbd771c77e0e673 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 11 Nov 2024 18:15:10 +0800 Subject: [PATCH] format --- .../companion-client/src/RequestClient.ts | 1 - packages/@uppy/core/src/Uppy.ts | 25 ++++++++++++------- .../@uppy/progress-bar/src/ProgressBar.tsx | 3 ++- packages/@uppy/status-bar/src/Components.tsx | 22 +++++++++------- packages/@uppy/status-bar/src/StatusBar.tsx | 6 ++++- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/packages/@uppy/companion-client/src/RequestClient.ts b/packages/@uppy/companion-client/src/RequestClient.ts index b80251c3c1..a6d5a2fee2 100644 --- a/packages/@uppy/companion-client/src/RequestClient.ts +++ b/packages/@uppy/companion-client/src/RequestClient.ts @@ -100,7 +100,6 @@ function emitSocketProgress( } } - export default class RequestClient { static VERSION = packageJson.version diff --git a/packages/@uppy/core/src/Uppy.ts b/packages/@uppy/core/src/Uppy.ts index 2c05ccf122..d5ace85fc5 100644 --- a/packages/@uppy/core/src/Uppy.ts +++ b/packages/@uppy/core/src/Uppy.ts @@ -760,7 +760,11 @@ export class Uppy< isUploadInProgress: boolean isSomeGhost: boolean } { - const { files: filesObject, progress: totalProgress, error } = this.getState() + const { + files: filesObject, + progress: totalProgress, + error, + } = this.getState() const files = Object.values(filesObject) const inProgressFiles: UppyFile[] = [] @@ -1472,7 +1476,7 @@ export class Uppy< #updateTotalProgress() { const totalProgress = this.#calculateTotalProgress() - let totalProgressPercent: number | null = null; + let totalProgressPercent: number | null = null if (totalProgress != null) { totalProgressPercent = Math.round(totalProgress * 100) if (totalProgressPercent > 100) totalProgressPercent = 100 @@ -1522,7 +1526,8 @@ export class Uppy< } const sizedFilesInProgress = filesInProgress.filter( - (file) => file.progress.bytesTotal != null && file.progress.bytesTotal !== 0, + (file) => + file.progress.bytesTotal != null && file.progress.bytesTotal !== 0, ) if (sizedFilesInProgress.length === 0) { @@ -1539,13 +1544,15 @@ export class Uppy< return null } - const totalFilesSize = sizedFilesInProgress.reduce((acc, file) => ( - acc + (file.progress.bytesTotal ?? 0) - ), 0) + const totalFilesSize = sizedFilesInProgress.reduce( + (acc, file) => acc + (file.progress.bytesTotal ?? 0), + 0, + ) - const totalUploadedSize = sizedFilesInProgress.reduce((acc, file) => ( - acc + (file.progress.bytesUploaded || 0) - ), 0) + const totalUploadedSize = sizedFilesInProgress.reduce( + (acc, file) => acc + (file.progress.bytesUploaded || 0), + 0, + ) return totalFilesSize === 0 ? 0 : totalUploadedSize / totalFilesSize } diff --git a/packages/@uppy/progress-bar/src/ProgressBar.tsx b/packages/@uppy/progress-bar/src/ProgressBar.tsx index bae4f06ba0..ebc3e28984 100644 --- a/packages/@uppy/progress-bar/src/ProgressBar.tsx +++ b/packages/@uppy/progress-bar/src/ProgressBar.tsx @@ -43,7 +43,8 @@ export default class ProgressBar< const { progress } = state // before starting and after finish should be hidden if specified in the options const isHidden = - (progress == null || progress === 0 || progress === 100) && this.opts.hideAfterFinish + (progress == null || progress === 0 || progress === 100) && + this.opts.hideAfterFinish return (
{ifShowFilesUploadedOfTotal && @@ -292,16 +291,19 @@ function ProgressDetails(props: ProgressDetailsProps) { */} {ifShowFilesUploadedOfTotal && renderDot()} - {totalSize !== 0 ? i18n('dataUploadedOfTotal', { - complete: totalUploadedSizeStr, - total: prettierBytes(totalSize), - }) : totalUploadedSizeStr} + {totalSize !== 0 ? + i18n('dataUploadedOfTotal', { + complete: totalUploadedSizeStr, + total: prettierBytes(totalSize), + }) + : totalUploadedSizeStr} {renderDot()} - {totalETA != null && i18n('xTimeLeft', { - time: prettyETA(totalETA), - })} + {totalETA != null && + i18n('xTimeLeft', { + time: prettyETA(totalETA), + })}
) @@ -430,7 +432,9 @@ function ProgressBarUploading(props: ProgressBarUploadingProps) { : null}
- {supportsUploadProgress && totalProgress != null ? `${title}: ${totalProgress}%` : title} + {supportsUploadProgress && totalProgress != null ? + `${title}: ${totalProgress}%` + : title}
{renderProgressDetails()} diff --git a/packages/@uppy/status-bar/src/StatusBar.tsx b/packages/@uppy/status-bar/src/StatusBar.tsx index 9012e1ec5a..9996518b87 100644 --- a/packages/@uppy/status-bar/src/StatusBar.tsx +++ b/packages/@uppy/status-bar/src/StatusBar.tsx @@ -187,7 +187,11 @@ export default class StatusBar extends UIPlugin< let totalUploadedSize = 0 // If at least one file has an unknown size, it doesn't make sense to display a total size - if (startedFiles.every((f) => f.progress.bytesTotal != null && f.progress.bytesTotal !== 0)) { + if ( + startedFiles.every( + (f) => f.progress.bytesTotal != null && f.progress.bytesTotal !== 0, + ) + ) { startedFiles.forEach((file) => { totalSize += file.progress.bytesTotal || 0 totalUploadedSize += file.progress.bytesUploaded || 0