Spaces:
Sleeping
Sleeping
Update index.html
Browse files38 unmodified lines39404142434445464748491 unmodified line51525354555654 unmodified lines1111121131141151161175 unmodified lines12312412512612712812913013116 unmodified lines14814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921 unmodified lines2312322332342352362372 unmodified lines24024124224324424524624724856 unmodified lines30530630730830931031138 unmodified linesconst [files, setFiles] = useState([]);const [youtubeUrl, setYoutubeUrl] = useState("");const [youtubeFormat, setYoutubeFormat] = useState('mp3');const [status, setStatus] = useState('idle'); // idle, uploading, processing, completed, failedconst [progress, setProgress] = useState(0);const [lastLog, setLastLog] = useState("");const [downloadUrl, setDownloadUrl] = useState(null);const [error, setError] = useState(null);const pollInterval = useRef(null);1 unmodified linesetFiles(Array.from(e.target.files));};const startProcessing = async () => {if (selectedTool.id === 'youtube' && !youtubeUrl) return;if (selectedTool.id !== 'youtube' && files.length === 0) return;54 unmodified lines}, 2000);};// ツール選択画面に完全に戻る(データを消去)const reset = () => {if (pollInterval.current) clearInterval(pollInterval.current);setSelectedTool(null);5 unmodified linessetLastLog("");setDownloadUrl(null);setError(null);};// 入力画面に戻る(URLや選択ファイルを保持)const backToInput = () => {if (pollInterval.current) clearInterval(pollInterval.current);setStatus('idle');16 unmodified lines</div>{!selectedTool ? (<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">{TOOLS.map(tool => (<buttonkey={tool.id}onClick={() => setSelectedTool(tool)}className="group bg-white p-6 rounded-3xl border border-slate-100 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all text-left relative overflow-hidden"><div className={`w-12 h-12 ${tool.color} rounded-2xl flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`}><Icon name={tool.icon} className="text-white w-6 h-6" /></div><h3 className="font-bold text-slate-900 mb-1">{tool.title}</h3><p className="text-xs text-slate-500 leading-relaxed">{tool.description}</p>{tool.id === 'youtube' && (<div className="absolute top-2 right-2 bg-amber-100 text-amber-700 text-[10px] px-2 py-0.5 rounded-full font-bold">要Colab設定</div>)}</button>))}</div>) : (<div className="bg-white rounded-[2.5rem] border border-slate-100 shadow-2xl overflow-hidden animate-in fade-in zoom-in duration-300"><div className="p-8"><buttononClick={reset}className="flex items-center text-slate-400 hover:text-indigo-600 font-bold mb-8 transition-colors"><Icon name="arrow-left" className="w-5 h-5 mr-2" />ツール選択に戻る</button><div className="flex items-center gap-4 mb-8"><div className={`w-14 h-14 ${selectedTool.color} rounded-2xl flex items-center justify-center shadow-lg`}><Icon name={selectedTool.icon} className="text-white w-7 h-7" /></div><div><h2 className="text-2xl font-black text-slate-900">{selectedTool.title}</h2><p className="text-slate-500 font-medium">{selectedTool.description}</p></div></div><div className="space-y-6">{status === 'idle' ? (<>{selectedTool.id === 'youtube' ? (<div className="space-y-4 animate-in fade-in duration-300"><div className="space-y-2"><label className="block text-sm font-bold text-slate-700">YouTube URL (1行に1つ)</label><textareaplaceholder="https://www.youtube.com/watch?v=..."className="w-full h-32 p-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-indigo-500 focus:outline-none transition-all font-mono text-sm"value={youtubeUrl}onChange={(e) => setYoutubeUrl(e.target.value)}/></div>{/* 保存形式の選択 */}<div className="flex gap-4 p-4 bg-slate-50 rounded-2xl border border-slate-100"><span className="text-sm font-bold text-slate-500 flex items-center">保存形式:</span><label className="flex items-center gap-2 cursor-pointer group">21 unmodified lines</div></div>) : (<div className="border-2 border-dashed border-slate-200 rounded-3xl p-12 text-center hover:border-indigo-400 transition-all bg-slate-50 group"><inputtype="file"multiple2 unmodified linesonChange={handleFileChange}/><label htmlFor="fileInput" className="cursor-pointer block"><Icon name="upload-cloud" className="w-12 h-12 text-slate-300 mx-auto mb-4 group-hover:text-indigo-500 transition-colors" /><p className="text-slate-600 font-bold mb-1">{files.length > 0 ? `${files.length}個のファイルを選択中` : 'ファイルをドラッグ&ドロップ'}</p><p className="text-slate-400 text-sm font-medium">またはクリックしてファイルを選択</p></label>56 unmodified lines)}</div>{/* Footer / Copyright */}<footer className="py-8 text-center border-t border-slate-100"><div className="flex items-center justify-center gap-2 text-slate-400 text-sm font-medium"><span>© {new Date().getFullYear()}</span>38 unmodified lines3940414243444546474849501 unmodified line525354555657585960616263646566676869707172737475767778798054 unmodified lines1351361371381391405 unmodified lines14614714814915015115215315416 unmodified lines17117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322421 unmodified lines2462472482492502512522532542552562572582592602612 unmodified lines26426526626726826927027127227327427527656 unmodified lines33333433533633733833938 unmodified linesconst [files, setFiles] = useState([]);const [youtubeUrl, setYoutubeUrl] = useState("");const [youtubeFormat, setYoutubeFormat] = useState('mp3');const [status, setStatus] = useState('idle');const [progress, setProgress] = useState(0);const [lastLog, setLastLog] = useState("");const [downloadUrl, setDownloadUrl] = useState(null);const [error, setError] = useState(null);const [isDragging, setIsDragging] = useState(false);const pollInterval = useRef(null);1 unmodified linesetFiles(Array.from(e.target.files));};// ドラッグ&ドロップハンドラconst handleDragOver = (e) => {e.preventDefault();e.stopPropagation();setIsDragging(true);};const handleDragLeave = (e) => {e.preventDefault();e.stopPropagation();setIsDragging(false);};const handleDrop = (e) => {e.preventDefault();e.stopPropagation();setIsDragging(false);const dropped = Array.from(e.dataTransfer.files);if (dropped.length > 0) {setFiles(dropped);}};const startProcessing = async () => {if (selectedTool.id === 'youtube' && !youtubeUrl) return;if (selectedTool.id !== 'youtube' && files.length === 0) return;54 unmodified lines}, 2000);};const reset = () => {if (pollInterval.current) clearInterval(pollInterval.current);setSelectedTool(null);5 unmodified linessetLastLog("");setDownloadUrl(null);setError(null);setIsDragging(false);};const backToInput = () => {if (pollInterval.current) clearInterval(pollInterval.current);setStatus('idle');16 unmodified lines</div>{!selectedTool ? (<div className="grid grid-cols-2 md:grid-cols-3 gap-4">{TOOLS.map(tool => (<buttonkey={tool.id}onClick={() => setSelectedTool(tool)}className="group p-6 bg-white rounded-3xl shadow-sm hover:shadow-xl transition-all duration-300 text-left border border-slate-100 hover:border-indigo-200 hover:-translate-y-1"><div className={`inline-flex p-3 ${tool.color} rounded-2xl mb-4 shadow-lg`}><Icon name={tool.icon} className="w-6 h-6 text-white" /></div><p className="font-black text-slate-900 mb-1">{tool.title}</p><p className="text-xs text-slate-400 font-medium leading-relaxed">{tool.description}</p></button>))}</div>) : (<div className="max-w-lg mx-auto"><div className="bg-white rounded-3xl shadow-sm border border-slate-100 overflow-hidden">{/* Tool Header */}<div className={`${selectedTool.color} p-6`}><button onClick={reset} className="flex items-center gap-2 text-white/80 hover:text-white mb-4 text-sm font-bold transition-colors"><Icon name="arrow-left" className="w-4 h-4" />ツール選択に戻る</button><div className="flex items-center gap-3"><Icon name={selectedTool.icon} className="w-8 h-8 text-white" /><div><h2 className="text-xl font-black text-white">{selectedTool.title}</h2><p className="text-white/70 text-sm font-medium">{selectedTool.description}</p></div></div></div>{/* Content */}<div className="p-6 space-y-4">{status === 'idle' || status === 'uploading' ? (<>{selectedTool.id === 'youtube' ? (<div className="space-y-4"><div><label className="block text-sm font-bold text-slate-600 mb-2">YouTube URL(複数行入力可)</label><textareaplaceholder="https://www.youtube.com/watch?v=..."className="w-full h-32 p-4 bg-slate-50 border-2 border-slate-100 rounded-2xl focus:border-indigo-500 focus:outline-none transition-all font-mono text-sm"value={youtubeUrl}onChange={(e) => setYoutubeUrl(e.target.value)}/></div><div className="flex gap-4 p-4 bg-slate-50 rounded-2xl border border-slate-100"><span className="text-sm font-bold text-slate-500 flex items-center">保存形式:</span><label className="flex items-center gap-2 cursor-pointer group">21 unmodified lines</div></div>) : (<divclassName={`border-2 border-dashed rounded-3xl p-12 text-center transition-all ${isDragging? 'border-indigo-500 bg-indigo-50': 'border-slate-200 bg-slate-50 hover:border-indigo-400'}`}onDragOver={handleDragOver}onDragLeave={handleDragLeave}onDrop={handleDrop}><inputtype="file"multiple2 unmodified linesonChange={handleFileChange}/><label htmlFor="fileInput" className="cursor-pointer block"><Icon name="upload-cloud" className={`w-12 h-12 mx-auto mb-4 transition-colors ${isDragging ? 'text-indigo-500' : 'text-slate-300'}`} /><p className="text-slate-600 font-bold mb-1">{files.length > 0? `${files.length}個のファイルを選択中`: isDragging? 'ここにドロップ': 'ファイルをドラッグ&ドロップ'}</p><p className="text-slate-400 text-sm font-medium">またはクリックしてファイルを選択</p></label>56 unmodified lines)}</div>{/* Footer */}<footer className="py-8 text-center border-t border-slate-100"><div className="flex items-center justify-center gap-2 text-slate-400 text-sm font-medium"><span>© {new Date().getFullYear()}</span>
index.html+70-42