feat(ui): make file upload the primary input, video URL secondary

This commit is contained in:
juancarlos.cavero 2026-07-16 18:41:21 +02:00
parent 06efc095a5
commit a122c90c89

View file

@ -9,7 +9,8 @@ const SUPPORTED_PLATFORMS = [
export default function MediaInput({ onProcess, isProcessing }) { export default function MediaInput({ onProcess, isProcessing }) {
const [youtubeUrlEnabled, setYoutubeUrlEnabled] = useState(true); const [youtubeUrlEnabled, setYoutubeUrlEnabled] = useState(true);
const [mode, setMode] = useState('url'); // 'url' | 'file' // File upload is the primary path; the link is secondary.
const [mode, setMode] = useState('file'); // 'file' | 'url'
const [url, setUrl] = useState(''); const [url, setUrl] = useState('');
const [file, setFile] = useState(null); const [file, setFile] = useState(null);
const [acknowledged, setAcknowledged] = useState(false); const [acknowledged, setAcknowledged] = useState(false);
@ -59,6 +60,16 @@ export default function MediaInput({ onProcess, isProcessing }) {
return ( return (
<div className="bg-surface border border-white/5 rounded-2xl p-6 animate-[fadeIn_0.6s_ease-out]"> <div className="bg-surface border border-white/5 rounded-2xl p-6 animate-[fadeIn_0.6s_ease-out]">
<div className="flex gap-4 mb-6 border-b border-white/5 pb-4"> <div className="flex gap-4 mb-6 border-b border-white/5 pb-4">
<button
onClick={() => setMode('file')}
className={`flex items-center gap-2 pb-2 px-2 transition-all ${mode === 'file'
? 'text-primary border-b-2 border-primary -mb-[17px]'
: 'text-zinc-400 hover:text-white'
}`}
>
<Upload size={18} />
Upload File
</button>
{youtubeUrlEnabled && ( {youtubeUrlEnabled && (
<button <button
onClick={() => setMode('url')} onClick={() => setMode('url')}
@ -71,16 +82,6 @@ export default function MediaInput({ onProcess, isProcessing }) {
Video URL Video URL
</button> </button>
)} )}
<button
onClick={() => setMode('file')}
className={`flex items-center gap-2 pb-2 px-2 transition-all ${mode === 'file'
? 'text-primary border-b-2 border-primary -mb-[17px]'
: 'text-zinc-400 hover:text-white'
}`}
>
<Upload size={18} />
Upload File
</button>
</div> </div>
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>