import { createClient } from "@/lib/supabase-server"
import { CategoryForm } from "@/components/dashboard/category-form"
import { notFound } from "next/navigation"

export default async function EditCategoryPage({ params }: { params: { id: string } }) {
    const supabase = createClient()
    const { data: category } = await supabase
        .from('categories')
        .select('*')
        .eq('id', params.id)
        .single()

    if (!category) {
        notFound()
    }

    return (
        <div className="flex-1 space-y-4 p-8 pt-6">
            <CategoryForm initialData={category} />
        </div>
    )
}
