feat(frontend): show destination format badge, fix download size to reflect converted output

The download button was showing the input file's size (carried over
client-side from upload) instead of the actual converted file's size.
It now reads outputSizeBytes from the polled job status once done.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 16:14:44 +02:00
co-authored by Claude Sonnet 5
parent db3e73860b
commit 023a96e5d8
2 changed files with 24 additions and 5 deletions
+19 -3
View File
@@ -80,7 +80,11 @@ export function HomePage() {
async function handleConvert() {
const validItems = pendingFiles.filter((item) => item.targetFormat);
const jobs = await uploadFiles(validItems);
const jobsWithSize = jobs.map((job, i) => ({ ...job, size: validItems[i].file.size }));
const jobsWithSize = jobs.map((job, i) => ({
...job,
size: validItems[i].file.size,
targetFormat: validItems[i].targetFormat,
}));
setSubmittedJobs((current) => [...current, ...jobsWithSize]);
setPendingFiles([]);
}
@@ -117,9 +121,21 @@ export function HomePage() {
<ul className="job-list">
{submittedJobs.map((job, index) =>
job.id ? (
<FileCard key={job.id} fileName={job.file} fileSize={job.size} jobId={job.id} />
<FileCard
key={job.id}
fileName={job.file}
fileSize={job.size}
targetFormat={job.targetFormat}
jobId={job.id}
/>
) : (
<FileCard key={`${job.file}-${index}`} fileName={job.file} fileSize={job.size} initialError={job.error} />
<FileCard
key={`${job.file}-${index}`}
fileName={job.file}
fileSize={job.size}
targetFormat={job.targetFormat}
initialError={job.error}
/>
)
)}
</ul>