export function fmtBytes(bytes) { if (!bytes) return '0 B' const units = ['B', 'KB', 'MB', 'GB', 'TB'] const i = Math.min(Math.floor(Math.log2(bytes) / 10), units.length - 1) const value = bytes / 2 ** (10 * i) return `${value >= 100 || i === 0 ? Math.round(value) : value.toFixed(1)} ${units[i]}` } export default function SelectionBar({ count, total, selectedBytes, totalBytes, onSelectAll, onClear, onDownload, onDownloadAll, onDelete, }) { if (total === 0) return null if (count === 0) { return (
{total} photo{total === 1 ? '' : 's'} ยท {fmtBytes(totalBytes)}
) } return (
{count} of {total} selected {count < total && ( )} {onDelete && ( )}
) }