Improve account storage readability and show used capacity percentage
CI / verify (push) Canceled after 0s

This commit is contained in:
Sucukdeluxe committed 2026-09-29 11:32:15 +02:00
1 parent f2c96bd9c5
commit f446deb938
4 files changed
+11 -4

No files matched your search

+5 -1
View File
@@ -62,7 +62,11 @@
const used = formatAmount(storage?.used);
const total = formatAmount(storage?.total);
if (!used || !total || storage.total.value <= 0) return null;
return `${used} ${String(locale).startsWith('de') ? 'von' : 'of'} ${total}`;
const amountInBytes = amount => amount.value * (amount.unit.includes('I') ? 1024 : 1000) ** 'BKMGTPE'.indexOf(amount.unit[0]);
const percent = amountInBytes(storage.used) / amountInBytes(storage.total) * 100;
if (!Number.isFinite(percent)) return null;
const percentage = new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(percent);
return `${used} ${String(locale).startsWith('de') ? 'von' : 'of'} ${total} (${percentage}%)`;
}
const accountStatus = {