import { X } from '@phosphor-icons/react'; import { formatBytes } from '../utils/formatBytes.js'; import { fileTypeMeta } from '../utils/fileFamily.js'; const QUALITY_FORMATS = ['jpg', 'jpeg', 'webp', 'avif', 'tiff']; const ICON_SIZES = [16, 32, 48, 256, 512]; const DEFAULT_ICON_SIZE = 256; function extensionOf(fileName) { return fileName.split('.').pop(); } function rangeProgress(value, min, max) { return `${((value - min) / (max - min)) * 100}%`; } function RangeField({ label, value, min, max, onChange }) { return (
{label} {value}
onChange(Number(event.target.value))} />
); } export function FileConfigCard({ item, index, t, onTargetFormatChange, onQualityChange, onIconSizeChange, onRemove }) { const { Icon, colorVar } = fileTypeMeta(extensionOf(item.file.name)); return (
  • {item.file.name} {formatBytes(item.file.size)}
    {item.targets.length > 0 ? (
    {t('quality.targetFormat')}
    {item.targets.map((target) => ( ))}
    {QUALITY_FORMATS.includes(item.targetFormat) && ( onQualityChange(index, value)} /> )} {item.targetFormat === 'png' && ( onQualityChange(index, value)} /> )} {item.targetFormat === 'ico' && (
    {t('quality.iconSize')}
    {ICON_SIZES.map((size) => ( ))}
    )} {item.targetFormat === 'pdf' && (
    {item.quality !== null && ( onQualityChange(index, value)} /> )}
    )}
    ) : ( {t('hero.unsupportedFormat')} )}
  • ); }