import React from "react"; import Button from "../buttons/Button.tsx"; import { kickerClass } from "../../utils/styles.ts"; type props = { dataSend: React.MouseEventHandler; handleDownload: React.MouseEventHandler; downloadable: boolean; progress: number; uploading: boolean; } // queued → reading source → encoding → writing file → complete const stageOf = (progress: number, uploading: boolean, downloadable: boolean): string => { if (downloadable) return "complete"; if (!uploading) return "waiting"; if (progress < 0.05) return "reading source"; if (progress < 0.95) return "encoding"; return "writing file"; }; const ExportWidget = ({ dataSend, handleDownload, downloadable, progress, uploading }: props) => { const pct = downloadable ? 100 : Math.round(Math.min(1, Math.max(0, progress)) * 100); return (

Export

{stageOf(progress, uploading, downloadable)}

{downloadable ? "done" : `${pct}%`}

{downloadable && ( )}
) } export default ExportWidget;