import React, { useState, useRef } from 'react'; import { GitBranch, UploadCloud, Link2, Lock, FileArchive, Cpu, Sparkles, ArrowRight } from 'lucide-react'; const EXAMPLE_REPOS = [ 'https://github.com/pallets/flask', 'https://github.com/tiangolo/fastapi', 'https://github.com/django/django', ]; export default function InputForm({ onSubmit, loading }) { const [inputType, setInputType] = useState('url'); const [repoUrl, setRepoUrl] = useState(''); const [token, setToken] = useState(''); const [apiKey, setApiKey] = useState(''); const [zipFile, setZipFile] = useState(null); const [dragActive, setDragActive] = useState(false); const fileInputRef = useRef(null); const handleDrag = (e) => { e.preventDefault(); e.stopPropagation(); setDragActive(e.type === 'dragenter' || e.type === 'dragover'); }; const handleDrop = (e) => { e.preventDefault(); e.stopPropagation(); setDragActive(false); const file = e.dataTransfer.files?.[0]; if (file?.name.endsWith('.zip')) setZipFile(file); else if (file) alert('Only .zip archives are supported.'); }; const handleFileChange = (e) => { const file = e.target.files?.[0]; if (file?.name.endsWith('.zip')) setZipFile(file); else if (file) alert('Only .zip archives are supported.'); }; const handleSubmit = (e) => { e.preventDefault(); if (inputType === 'url') { if (!repoUrl.trim()) return; onSubmit({ type: 'url', url: repoUrl.trim(), token, apiKey: apiKey.trim() }); } else { if (!zipFile) return; onSubmit({ type: 'zip', file: zipFile, apiKey: apiKey.trim() }); } }; const canSubmit = inputType === 'url' ? !!repoUrl.trim() : !!zipFile; return (
Analyze repositories, map architecture, extract APIs, and build a semantic knowledge base ready for AI agents โ no setup required.