feat(frontend): add remove button to pending and submitted file cards
Lets users drop an uploaded file from the UI list before or after conversion, without cancelling anything server-side. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { CircleNotch, DownloadSimple, CheckCircle, WarningCircle } from '@phosphor-icons/react';
|
||||
import { CircleNotch, DownloadSimple, CheckCircle, WarningCircle, X } from '@phosphor-icons/react';
|
||||
import { fetchJobStatus, downloadUrl } from './api.js';
|
||||
import { formatBytes } from './utils/formatBytes.js';
|
||||
import { fileTypeMeta } from './utils/fileFamily.js';
|
||||
@@ -9,7 +9,7 @@ function extensionOf(fileName) {
|
||||
return fileName.split('.').pop();
|
||||
}
|
||||
|
||||
export function FileCard({ fileName, fileSize, targetFormat, jobId, initialError }) {
|
||||
export function FileCard({ fileName, fileSize, targetFormat, jobId, initialError, onRemove }) {
|
||||
const { t } = useTranslation();
|
||||
const [status, setStatus] = useState(initialError ? 'failed' : 'pending');
|
||||
const [errorMessage, setErrorMessage] = useState(initialError ?? null);
|
||||
@@ -45,6 +45,14 @@ export function FileCard({ fileName, fileSize, targetFormat, jobId, initialError
|
||||
<span className="file-tile-name">{fileName}</span>
|
||||
{targetFormat && <span className="format-badge">{targetFormat.toUpperCase()}</span>}
|
||||
<span className="file-tile-size">{formatBytes(fileSize)}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="file-remove-button"
|
||||
onClick={onRemove}
|
||||
aria-label={t('common.remove')}
|
||||
>
|
||||
<X size={16} weight="bold" />
|
||||
</button>
|
||||
</div>
|
||||
{(status === 'pending' || status === 'processing') && (
|
||||
<div className="job-progress">
|
||||
|
||||
Reference in New Issue
Block a user