import { AppSidebar } from "@/components/app-sidebar"; import { NavActions } from "@/components/nav-actions"; import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage, } from "@/components/ui/breadcrumb"; import { Separator } from "@/components/ui/separator"; import { SidebarInset, SidebarProvider, SidebarTrigger, } from "@/components/ui/sidebar"; import { createClient } from "@/utils/supabase/server"; import { redirect } from "next/navigation"; export default async function Page() { const supabase = await createClient(); const { data: { user }, } = await supabase.auth.getUser(); if (!user) { return redirect("/login"); } const { data: documents, error } = await supabase .from("documents") .select("*") .eq("owner", user.id) .order("created_at", { ascending: false }); if (error) { console.error("Failed to fetch documents:", error); // Optionally handle the error, e.g., show a message to the user return (

Failed to load documents.

); } return ( { return { name: d.file_name, url: `/dashboard/documents/${d.id}`, emoji: "📄", }; })} />
Select a document...
); }