0c113e7a91
Camera profiles, proofing tables and the half-float sidecar all have to agree with the pixels the editor actually grades, so they land together with the preset filter menu that was unusable while thumbnails streamed in. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
104 lines
3.4 KiB
TypeScript
104 lines
3.4 KiB
TypeScript
export interface RawReprocessFailure {
|
||
name: string;
|
||
error: string;
|
||
}
|
||
|
||
export interface RawReprocessJob {
|
||
running: boolean;
|
||
/** Files attempted so far, including failures. */
|
||
done: number;
|
||
total: number;
|
||
current: string;
|
||
eventName?: string;
|
||
failures: RawReprocessFailure[];
|
||
cancelled?: boolean;
|
||
}
|
||
|
||
interface Props {
|
||
job: RawReprocessJob;
|
||
onCancel: () => void;
|
||
onClose: () => void;
|
||
}
|
||
|
||
/**
|
||
* Progress and summary for a RAW re-decode run. The job keeps running while the
|
||
* dialog is open; Cancel stops it after the file already in flight.
|
||
*/
|
||
export default function RawReprocessModal({ job, onCancel, onClose }: Props) {
|
||
const succeeded = Math.max(0, job.done - job.failures.length);
|
||
const pct = job.total ? Math.round((job.done / job.total) * 100) : 0;
|
||
const scope = job.eventName ? `“${job.eventName}”` : 'the selection';
|
||
|
||
return (
|
||
<div
|
||
className="modal-backdrop"
|
||
onPointerDown={(e) => e.target === e.currentTarget && !job.running && onClose()}
|
||
>
|
||
<div className="modal raw-modal" role="dialog" aria-modal="true" aria-label="RAW reprocess">
|
||
<header className="modal-head">
|
||
<div>
|
||
<h2>{job.running ? 'Reprocessing RAW files' : 'RAW reprocess summary'}</h2>
|
||
<p className="muted small">
|
||
{job.total} RAW file{job.total === 1 ? '' : 's'} from {scope}. Existing edits and crops
|
||
are kept.
|
||
</p>
|
||
</div>
|
||
{!job.running && (
|
||
<button className="icon-btn" onClick={onClose} title="Close">
|
||
×
|
||
</button>
|
||
)}
|
||
</header>
|
||
|
||
<div className="modal-body">
|
||
<div className="progress-bar">
|
||
<div className="progress-fill" style={{ width: `${pct}%` }} />
|
||
</div>
|
||
<p className="muted small">
|
||
{job.running
|
||
? job.cancelled
|
||
? `Stopping after the current file · ${job.done} of ${job.total}`
|
||
: `${job.done} of ${job.total}${job.current ? ` · ${job.current}` : '…'}`
|
||
: job.cancelled
|
||
? `Stopped after ${job.done} of ${job.total}. Reprocessed ${succeeded}.`
|
||
: `Reprocessed ${succeeded} of ${job.total}.`}
|
||
</p>
|
||
|
||
{!job.running && job.failures.length > 0 && (
|
||
<div className="failures">
|
||
<strong>
|
||
{job.failures.length} file{job.failures.length === 1 ? '' : 's'} failed
|
||
</strong>
|
||
<ul>
|
||
{job.failures.slice(0, 12).map((failure) => (
|
||
<li key={failure.name}>
|
||
{failure.name}: {failure.error}
|
||
</li>
|
||
))}
|
||
</ul>
|
||
{job.failures.length > 12 && (
|
||
<p className="muted small">And {job.failures.length - 12} more…</p>
|
||
)}
|
||
</div>
|
||
)}
|
||
</div>
|
||
|
||
<footer className="modal-foot">
|
||
{job.running ? (
|
||
<>
|
||
<span className="muted small">Cancel stops after the current file.</span>
|
||
<button className="btn ghost danger" onClick={onCancel} disabled={job.cancelled}>
|
||
{job.cancelled ? 'Stopping…' : 'Cancel'}
|
||
</button>
|
||
</>
|
||
) : (
|
||
<button className="btn primary" onClick={onClose}>
|
||
Done
|
||
</button>
|
||
)}
|
||
</footer>
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|