-
- {/* Format selector — hidden on small screens, shown inline */}
-
- {file.availableFormats.length > 0 && file.status !== 'done' ? (
-
-
-
- {/* Status / actions column */}
-
-
- {/* Idle — just format selector on mobile, or nothing */}
- {file.status === 'idle' && (
-
+ {/* Icon */}
+
+ {file.preview ? (
+ // eslint-disable-next-line @next/next/no-img-element
+

+ ) : (
+ icon
+ )}
+
+
+ {/* Content */}
+
+ {/* Row 1: Name + remove button */}
+
+
+ {truncateFilename(file.name, 24)}
+
+
- {/* Mobile format selector */}
- {file.availableFormats.length > 0 && (
- onSetFormat(file.id, e.target.value)}
- className="sm:hidden font-mono text-[10px] font-bold text-text-dark bg-transparent px-1 py-0.5 rounded border border-border-soft/60 cursor-pointer appearance-none select-arrow-warm"
- style={{ paddingRight: '18px', maxWidth: '70px' }}
- >
- {file.availableFormats.map((fmt) => (
-
- ))}
-
- )}
- {/* Remove button */}
+ .{file.extension}
+
+ {/* Remove — always visible on mobile */}
+ {file.status !== 'converting' && (
-
+ )}
+
+
+ {/* Row 2: Size + format selector + status */}
+
+
+ {formatFileSize(file.size)}
+
+
+ {/* Format selector or status */}
+
+
+
+ {/* Error message */}
+ {file.status === 'error' && file.error && (
+
{file.error}
)}
-
- {/* Converting — spinner + progress */}
- {file.status === 'converting' && (
-
-
-
- {Math.round(file.progress)}%
-
-
- )}
-
- {/* Done — checkmark + preview + download */}
- {file.status === 'done' && (
-
- {/* Checkmark */}
-
-
-
-
-
- {/* Preview button */}
-
-
- {/* Download button */}
-
-
- )}
-
- {/* Error — icon + remove */}
- {file.status === 'error' && (
-
-
-
-
-
- Failed
-
-
- )}
-
+
);
}
+
+/* ── Desktop status (sm+) ─────────────────────────────── */
+function DesktopStatus({
+ file,
+ color,
+ onRemove,
+ onDownload,
+ onPreview,
+}: {
+ file: UploadedFile;
+ color: string;
+ onRemove: (id: string) => void;
+ onDownload: (file: UploadedFile) => void;
+ onPreview: (file: UploadedFile) => void;
+}) {
+ return (
+
+ {file.status === 'idle' && (
+
+
+
+ )}
+
+ {file.status === 'converting' && (
+
+
+
+ {Math.round(file.progress)}%
+
+
+ )}
+
+ {file.status === 'done' && (
+
+
+
+
+
+
+
+
+ )}
+
+ {file.status === 'error' && (
+
+
+
+
+
+ Failed
+
+
+ )}
+
+ );
+}
+
+/* ── Mobile status (< sm) ─────────────────────────────── */
+function MobileStatus({
+ file,
+ color,
+ onSetFormat,
+ onDownload,
+ onPreview,
+}: {
+ file: UploadedFile;
+ color: string;
+ onSetFormat: (id: string, format: string) => void;
+ onDownload: (file: UploadedFile) => void;
+ onPreview: (file: UploadedFile) => void;
+}) {
+ if (file.status === 'idle' && file.availableFormats.length > 0) {
+ return (
+
+
+
+
+
onSetFormat(file.id, e.target.value)}
+ className="font-mono text-[11px] font-bold text-text-dark bg-transparent px-1.5 py-0.5 rounded-md border border-border-soft/60 cursor-pointer focus:outline-none focus:border-pink/40 transition-all appearance-none select-arrow-warm"
+ style={{ maxWidth: '80px' }}
+ >
+ {file.availableFormats.map((fmt) => (
+
+ ))}
+
+
+ );
+ }
+
+ if (file.status === 'converting') {
+ return (
+
+
+
+ {Math.round(file.progress)}%
+
+
+ );
+ }
+
+ if (file.status === 'done') {
+ return (
+
+
+
+
+
+
+
+
+ );
+ }
+
+ if (file.status === 'error') {
+ return (
+
+ );
+ }
+
+ // No formats available
+ return (
+
unsupported
+ );
+}