File size: 667 Bytes
20ec4ad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import { useEffect, useState } from "react";
export default function FilesPanel() {
const [files, setFiles] = useState<string[]>([]);
useEffect(() => {
fetch("/api/list-files")
.then((r) => r.json())
.then((j) => setFiles(j.files))
.catch(() => setFiles([]));
}, []);
return (
<div className="h-full overflow-auto bg-gray-900 text-gray-200 p-4">
<h2 className="text-lg font-semibold mb-2">Arquivos</h2>
<ul className="space-y-1">
{files.map((f) => (
<li key={f} className="px-2 py-1 hover:bg-gray-800 rounded cursor-pointer">
{f}
</li>
))}
</ul>
</div>
);
}
|