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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user