import Link from "next/link"; import { notFound } from "next/navigation"; import { ArrowLeft, Trash2 } from "lucide-react"; import { getTagCategoryBySlug, listTagsInCategory, listAllTags } from "@/lib/db/queries"; import { deleteTagCategory, renameTagCategory } from "@/app/actions/tagCategories"; import { EntityRenameInline } from "@/components/entities/EntityRenameInline"; import { CategoryTagAssigner } from "@/components/categories/CategoryTagAssigner"; import { CategoryCoverPanel } from "@/components/categories/CategoryCoverPanel"; export const dynamic = "force-dynamic"; export default async function CategoryDetailPage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const cat = getTagCategoryBySlug(decodeURIComponent(slug)); if (!cat) notFound(); const tags = listTagsInCategory(cat.id); // All tags, with their current category, so the assigner can let the // user reassign uncategorised or differently-categorised tags into // this one. const allTags = listAllTags("az"); const remove = async () => { "use server"; await deleteTagCategory(cat.id); }; const rename = async (name: string) => { "use server"; return await renameTagCategory(cat.id, name); }; return (
{cat.description}
}{tags.length} tag{tags.length === 1 ? "" : "s"} in this category