From 18912547a86223f7334e90ff9eb069bace3219a2 Mon Sep 17 00:00:00 2001 From: noah Date: Mon, 9 Mar 2026 22:06:58 +0100 Subject: [PATCH] Added mobile support --- src/app/convert/page.tsx | 93 +++---- src/components/DropZone.tsx | 16 +- src/components/FileRow.tsx | 517 +++++++++++++++++++++++------------- 3 files changed, 389 insertions(+), 237 deletions(-) diff --git a/src/app/convert/page.tsx b/src/app/convert/page.tsx index 382fb7b..a31fe6d 100644 --- a/src/app/convert/page.tsx +++ b/src/app/convert/page.tsx @@ -64,15 +64,15 @@ export default function ConvertPage() { /> {/* Finder Window — the entire converter lives inside this */} -
+
{/* ─ Title bar ─ */} -
+
{/* Traffic lights */}
@@ -80,8 +80,8 @@ export default function ConvertPage() {
- {/* Navigation arrows */} -
+ {/* Navigation arrows — hidden on mobile */} +
@@ -94,8 +94,8 @@ export default function ConvertPage() {
{/* eslint-disable-next-line @next/next/no-img-element */} - Transmute - {'\u203A'} + Transmute + {'\u203A'} Converter
@@ -120,8 +120,8 @@ export default function ConvertPage() { {/* ─ Toolbar (only when files present) ─ */} {hasFiles && ( -
-
+
+
{files.length} file{files.length !== 1 ? 's' : ''} @@ -130,13 +130,11 @@ export default function ConvertPage() { {formatFileSize(totalSize)} {completedCount > 0 && ( - <> -
- -
- {completedCount} converted - - + +
+
+ {completedCount} converted + )}
- + )} +
+ + {/* 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 ( +
+ + + + +
+ ); + } + + if (file.status === 'converting') { + return ( +
+ + + {Math.round(file.progress)}% + +
+ ); + } + + if (file.status === 'done') { + return ( +
+ + + + + + +
+ ); + } + + if (file.status === 'error') { + return ( +
+ + + + + Failed +
+ ); + } + + // No formats available + return ( + unsupported + ); +}