feat: image variants cache panel
This commit is contained in:
1 parent
951fef18ba
commit
d768668014
53 files changed
+5809
-46
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { formatNumber, t } from '@/i18n'
|
||||
import { formatVariantSize } from '@/lib/variants/variantFormat'
|
||||
|
||||
const PERCENT = 100
|
||||
|
||||
export function cacheSize(bytes: number) {
|
||||
return bytes === 0 ? t('{0} MB', [0]) : formatVariantSize(bytes)
|
||||
}
|
||||
|
||||
export function filesCount(count: number) {
|
||||
return count === 1 ? t('1 file') : t('{0} files', [formatNumber(count)])
|
||||
}
|
||||
|
||||
export function filesAndSize(count: number, bytes: number) {
|
||||
return count === 1
|
||||
? t('1 file · {0}', [formatVariantSize(bytes)])
|
||||
: t('{0} files · {1}', [formatNumber(count), formatVariantSize(bytes)])
|
||||
}
|
||||
|
||||
export function variantsCount(count: number) {
|
||||
return count === 1 ? t('1 variant') : t('{0} variants', [formatNumber(count)])
|
||||
}
|
||||
|
||||
export function barPercent(bytes: number, largest: number) {
|
||||
return largest === 0 ? 0 : Math.round((bytes / largest) * PERCENT)
|
||||
}
|
||||
Reference in new issue
Block a user