feat: mail composition

Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
2026-06-16 13:24:54 -04:00
parent 7a3d90d0cd
commit f1cff5441a
22 changed files with 1786 additions and 175 deletions
+21
View File
@@ -0,0 +1,21 @@
export function formatFileSize(bytes: number | null | undefined): string {
if (bytes == null || !Number.isFinite(bytes)) {
return ''
}
if (bytes < 1024) {
return `${Math.max(0, Math.round(bytes))} B`
}
const units = ['KB', 'MB', 'GB', 'TB']
let value = bytes / 1024
let unitIndex = 0
while (value >= 1024 && unitIndex < units.length - 1) {
value /= 1024
unitIndex += 1
}
const precision = value >= 10 || unitIndex === 0 ? 1 : 2
return `${value.toFixed(precision)} ${units[unitIndex]}`
}