Add movie fusion packages with locked media, ZIP export, and batch forge UI.
Paired video mode encrypts movies, uses runner-only lock hints, bundles README plus artifacts per title, and supports batch forging with progress.
This commit is contained in:
33
server/web/src/components/DownloadButton.tsx
Normal file
33
server/web/src/components/DownloadButton.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { useState, type ReactNode } from 'react';
|
||||
import { downloadApiFile } from '../api/download';
|
||||
|
||||
type Props = {
|
||||
apiPath: string;
|
||||
filename: string;
|
||||
className?: string;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
/** Click to save an API file to the browser Downloads folder. */
|
||||
export default function DownloadButton({ apiPath, filename, className, children }: Props) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
const handleClick = async (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
if (busy) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
await downloadApiFile(apiPath, filename);
|
||||
} catch (err) {
|
||||
window.alert(err instanceof Error ? err.message : 'Download failed');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<button type="button" className={className} onClick={handleClick} disabled={busy}>
|
||||
{busy ? 'Downloading…' : children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user