| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- "use client";
- import { UploadForm } from "../components/uploadForm";
- import { FilesTable } from "../components/filesTable";
- import { useState } from "react";
- interface FileData {
- id: string;
- filename: string;
- mimetype: string;
- size: number;
- createdAt: string;
- updatedAt: string;
- }
- export default function FilesPage() {
- const [, setNewFile] = useState<FileData | null>(null);
- const handleFileUploaded = (file: FileData) => {
- // This will trigger the FilesTable to add the new file
- setNewFile(file);
- };
- return (
- <div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
- <main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
-
- <h1 className="text-3xl font-bold text-center sm:text-left">
- File Management
- </h1>
-
- <p className="text-sm text-center sm:text-left max-w-[600px]">
- Upload and manage your media files here. Select files to upload them to the server.
- </p>
- <div className="flex flex-col gap-4 items-center sm:items-start">
- <h2 className="text-xl font-semibold">Upload Files</h2>
- <UploadForm onFileUploaded={handleFileUploaded} />
- </div>
- <div className="w-full max-w-6xl">
- <h2 className="text-2xl font-semibold mb-4">Files in Database</h2>
- <FilesTable onFileAdded={handleFileUploaded} />
- </div>
- </main>
- </div>
- );
- }
|