import Link from "next/link"; import { listAllTags, listAllTagCategories, type TagSort } from "@/lib/db/queries"; import { createTagAction } from "@/app/actions/tags"; import { Tag, Plus, ArrowDownAZ, Hash } from "lucide-react"; import { cn } from "@/lib/utils"; import { TagImportButton } from "@/components/tag/TagImportButton"; import { TagsList } from "@/components/tag/TagsList"; export const dynamic = "force-dynamic"; export default async function TagsPage({ searchParams, }: { searchParams: Promise>; }) { const sp = await searchParams; const sort: TagSort = sp.sort === "count" ? "count" : "az"; const tags = listAllTags(sort); const categories = listAllTagCategories("az"); return (

Tags

{tags.length} total

A-Z Count
t.name)} existingCategoryNames={categories.map((c) => c.name)} />
{tags.length === 0 ? (

No tags yet. Create one above or add from any image.

) : ( ({ id: t.id, name: t.name, count: t.count, categoryId: t.categoryId, categoryName: t.categoryName, categoryColor: t.categoryColor, }))} sort={sort} /> )}
); }