import { useState, useEffect, useRef } from "react"; export default function IgeldokuApp() { const [docs, setDocs] = useState([]); const [title, setTitle] = useState(""); const [author, setAuthor] = useState(""); const [file, setFile] = useState(null);   const fileInputRef = useRef(null);   const loadDocs = async () => {     const res = await fetch("/igeldoku/api/docs.php");     const data = await res.json();     setDocs(data);   }; useEffect(() => {     loadDocs(); }, []); const handleUpload = async () => { if (!title || !author || !file) return; const formData = new FormData(); formData.append("title", title);     formData.append("author", author);     formData.append("file", file);     await fetch("/igeldoku/api/upload.php", {       method: "POST",       body: formData     });     loadDocs();     setTitle("");     setAuthor(""); setFile(null); }; const downloadFile = (doc) => { window.open(`/igeldoku/api/download.php?file=${doc.fileName}`); }; return (

        INTEGRA Igel-Doku      

setTitle(e.target.value)}           style={{ display: "block", width: "100%", marginBottom: "10px", padding: "6px" }}         />         setAuthor(e.target.value)}           style={{ display: "block", width: "100%", marginBottom: "10px", padding: "6px" }}         />         setFile(e.target.files[0])}           style={{ display: "none" }}         />                           {file ? file.name : "Keine Datei ausgewählt"}                
                 
     
     
{docs.map((doc) => (
{doc.title}
             
{doc.author} - {new Date(doc.date).toLocaleString()}
           
            downloadFile(doc)}               style={{ padding: "4px 10px", cursor: "pointer" }}             >               Download                      
))}
); }