import clsx from 'clsx'; import { CheckCircle } from 'lucide-react'; export type UploaderState = 'idle' | 'needs_login' | 'uploading' | 'preparing' | 'ready' | 'polling_error'; interface UploaderOverlayProps { state: UploaderState; error: string | null; playbackId: string | null; onLogin: () => void; onRetry: () => void; } /** Shared overlay container matching drop zone styling */ function OverlayWrapper({ children, className }: { children: React.ReactNode; className?: string }) { return (
{children}
); } /** * Renders state-based overlays on top of MuxUploader. * - needs_login: Login prompt * - preparing: Spinner while polling for playback ID * - ready: Success message with playback ID * - polling_error: Error during post-upload processing (MuxUploader handles upload errors natively) */ export default function UploaderOverlay({ state, error, playbackId, onLogin, onRetry }: UploaderOverlayProps) { // No overlay needed for idle or uploading (MuxUploader handles its own UI) if (state === 'idle' || state === 'uploading') { return null; } if (state === 'needs_login') { return (

To upload this video to Mux…

); } if (state === 'preparing') { return (

Preparing video...

); } if (state === 'ready' && playbackId) { return (

Ready to play

See code below, or{' '} manage on Mux .

); } if (state === 'polling_error') { return (

Error preparing video: {error}

); } return null; }