import { createClient } from "@/utils/supabase/server"; import Link from "next/link"; import { deletePost } from "./actions"; export default async function AdminPostsPage() { const supabase = await createClient(); const { data: posts } = await supabase .from("posts") .select("id, title, date, author, published, tags") .order("date", { ascending: false }); return (

Posts

New Post
{posts?.map((post) => ( ))}
Title Author Date Status Actions
{post.title}

{post.id}

{post.author} {new Date(post.date).toLocaleDateString()} {post.published ? ( Published ) : ( Draft )} Edit
{(!posts || posts.length === 0) && (

No posts found.

)}
); }