From 4224f44259da03000a924c3ed382fa358909ecb1 Mon Sep 17 00:00:00 2001 From: Finn Dittmar Date: Thu, 9 Oct 2025 08:49:13 +0200 Subject: [PATCH] Remove duplicate (and also wrong byte conversion) --- client/components/cards/ItemUploadCard.vue | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/client/components/cards/ItemUploadCard.vue b/client/components/cards/ItemUploadCard.vue index cb9dd5589..adbf3adbe 100644 --- a/client/components/cards/ItemUploadCard.vue +++ b/client/components/cards/ItemUploadCard.vue @@ -143,19 +143,12 @@ export default { return Math.min(100, Math.round((this.uploadProgress.loaded / this.uploadProgress.total) * 100)) }, uploadProgressText() { - const loaded = this.formatBytes(this.uploadProgress.loaded) - const total = this.formatBytes(this.uploadProgress.total) + const loaded = this.$bytesPretty(this.uploadProgress.loaded) + const total = this.$bytesPretty(this.uploadProgress.total) return `${this.uploadProgressPercent}% (${loaded} / ${total})` } }, methods: { - formatBytes(bytes) { - if (bytes === 0) return '0 Bytes' - const k = 1024 - const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] - const i = Math.floor(Math.log(bytes) / Math.log(k)) - return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] - }, setUploadStatus(status) { this.isUploading = status === 'uploading' this.uploadFailed = status === 'failed'