Enhance tags
This commit is contained in:
@ -8,16 +8,18 @@ export default async function PortfolioTagsEditPage({ params }: { params: { id:
|
||||
id,
|
||||
},
|
||||
include: {
|
||||
categories: true
|
||||
categories: true,
|
||||
aliases: true
|
||||
}
|
||||
})
|
||||
|
||||
const categories = await prisma.artCategory.findMany({ include: { tags: true }, orderBy: { sortIndex: "asc" } });
|
||||
const tags = await prisma.artTag.findMany({ orderBy: { sortIndex: "asc" } });
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold mb-4">Edit Tag</h1>
|
||||
{tag && <EditTagForm tag={tag} categories={categories} />}
|
||||
{tag && <EditTagForm tag={tag} categories={categories} allTags={tags} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -3,11 +3,12 @@ import { prisma } from "@/lib/prisma";
|
||||
|
||||
export default async function PortfolioTagsNewPage() {
|
||||
const categories = await prisma.artCategory.findMany({ include: { tags: true }, orderBy: { sortIndex: "asc" } });
|
||||
const tags = await prisma.artTag.findMany({ orderBy: { sortIndex: "asc" } });
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold mb-4">New Tag</h1>
|
||||
<NewTagForm categories={categories} />
|
||||
<NewTagForm categories={categories} allTags={tags} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -1,10 +1,18 @@
|
||||
import ItemList from "@/components/lists/ItemList";
|
||||
import TagTable from "@/components/tags/TagTable";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { PlusCircleIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export default async function PortfolioTagsPage() {
|
||||
const items = await prisma.artTag.findMany({})
|
||||
export default async function ArtTagsPage() {
|
||||
const items = await prisma.artTag.findMany({
|
||||
include: {
|
||||
parent: { select: { id: true, name: true } },
|
||||
aliases: { select: { alias: true } },
|
||||
categories: { select: { id: true, name: true } },
|
||||
_count: { select: { artworks: true } },
|
||||
},
|
||||
orderBy: [{ sortIndex: "asc" }, { name: "asc" }],
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
@ -14,7 +22,11 @@ export default async function PortfolioTagsPage() {
|
||||
<PlusCircleIcon className="h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all text-primary-foreground" /> Add new tag
|
||||
</Link>
|
||||
</div>
|
||||
{items && items.length > 0 ? <ItemList items={items} type="tags" /> : <p>There are no tags yet. Consider adding some!</p>}
|
||||
{items.length > 0 ? (
|
||||
<TagTable tags={items} />
|
||||
) : (
|
||||
<p>There are no tags yet. Consider adding some!</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user