Add tags to commssion types and custom types. Add button for example images to cards

This commit is contained in:
2026-02-02 17:00:03 +01:00
parent 93a327c634
commit c915df904d
25 changed files with 617 additions and 367 deletions

View File

@ -10,17 +10,19 @@ export default async function CommissionCustomCardEditPage({
}) {
const { id } = await params;
const [card, options, extras, images] = await Promise.all([
const [card, options, extras, images, tags] = await Promise.all([
prisma.commissionCustomCard.findUnique({
where: { id },
include: {
options: { orderBy: { sortIndex: "asc" } },
extras: { orderBy: { sortIndex: "asc" } },
tags: true,
},
}),
prisma.commissionOption.findMany({ orderBy: [{ sortIndex: "asc" }, { name: "asc" }] }),
prisma.commissionExtra.findMany({ orderBy: [{ sortIndex: "asc" }, { name: "asc" }] }),
listCommissionCustomCardImages(),
prisma.tag.findMany({ orderBy: [{ sortIndex: "asc" }, { name: "asc" }] }),
]);
if (!card) {
@ -37,6 +39,7 @@ export default async function CommissionCustomCardEditPage({
allOptions={options}
allExtras={extras}
images={images}
allTags={tags}
/>
</div>
);

View File

@ -3,10 +3,11 @@ import NewCustomCardForm from "@/components/commissions/customCards/NewCustomCar
import { prisma } from "@/lib/prisma";
export default async function CommissionCustomCardsNewPage() {
const [options, extras, images] = await Promise.all([
const [options, extras, images, tags] = await Promise.all([
prisma.commissionOption.findMany({ orderBy: [{ sortIndex: "asc" }, { name: "asc" }] }),
prisma.commissionExtra.findMany({ orderBy: [{ sortIndex: "asc" }, { name: "asc" }] }),
listCommissionCustomCardImages(),
prisma.tag.findMany({ orderBy: [{ sortIndex: "asc" }, { name: "asc" }] }),
]);
return (
@ -14,7 +15,7 @@ export default async function CommissionCustomCardsNewPage() {
<div className="flex gap-4 justify-between pb-8">
<h1 className="text-2xl font-bold mb-4">New Custom Commission Card</h1>
</div>
<NewCustomCardForm options={options} extras={extras} images={images} />
<NewCustomCardForm options={options} extras={extras} images={images} tags={tags} />
</div>
);
}

View File

@ -11,8 +11,12 @@ export default async function CommissionTypesEditPage({ params }: { params: { id
options: { include: { option: true }, orderBy: { sortIndex: "asc" } },
extras: { include: { extra: true }, orderBy: { sortIndex: "asc" } },
customInputs: { include: { customInput: true }, orderBy: { sortIndex: "asc" } },
tags: true,
},
})
const tags = await prisma.tag.findMany({
orderBy: [{ sortIndex: "asc" }, { name: "asc" }],
});
const options = await prisma.commissionOption.findMany({
orderBy: [{ sortIndex: "asc" }, { name: "asc" }],
});
@ -32,7 +36,12 @@ export default async function CommissionTypesEditPage({ params }: { params: { id
<div className="flex gap-4 justify-between pb-8">
<h1 className="text-2xl font-bold mb-4">Edit Commission Type</h1>
</div>
<EditTypeForm type={commissionType} allOptions={options} allExtras={extras} />
<EditTypeForm
type={commissionType}
allOptions={options}
allExtras={extras}
allTags={tags}
/>
</div>
);
}
}

View File

@ -2,6 +2,9 @@ import NewTypeForm from "@/components/commissions/types/NewTypeForm";
import { prisma } from "@/lib/prisma";
export default async function CommissionTypesNewPage() {
const tags = await prisma.tag.findMany({
orderBy: [{ sortIndex: "asc" }, { name: "asc" }],
});
const options = await prisma.commissionOption.findMany({
orderBy: [{ sortIndex: "asc" }, { name: "asc" }],
});
@ -17,8 +20,13 @@ export default async function CommissionTypesNewPage() {
<div className="flex gap-4 justify-between pb-8">
<h1 className="text-2xl font-bold mb-4">New Commission Type</h1>
</div>
<NewTypeForm options={options} extras={extras} customInputs={customInputs} />
<NewTypeForm
options={options}
extras={extras}
customInputs={customInputs}
tags={tags}
/>
</div>
);
}
}

View File

@ -24,4 +24,4 @@ export default async function CommissionTypesPage() {
{types && types.length > 0 ? <ListTypes types={types} /> : <p className="text-muted-foreground italic">No types found.</p>}
</div>
);
}
}

View File

@ -1,20 +1,9 @@
import { migrateArtworkTagJoin } from "@/actions/tags/migrateArtworkTagJoin";
import TagTabs from "@/components/tags/TagTabs";
import { Button } from "@/components/ui/button";
import { prisma } from "@/lib/prisma";
import { PlusCircleIcon } from "lucide-react";
import Link from "next/link";
async function migrateArtworkTagJoinCopy() {
"use server";
await migrateArtworkTagJoin();
}
async function migrateArtworkTagJoinDropOld() {
"use server";
await migrateArtworkTagJoin({ dropOld: true });
}
export default async function ArtTagsPage() {
const items = await prisma.tag.findMany({
include: {
@ -56,22 +45,10 @@ export default async function ArtTagsPage() {
<h1 className="text-2xl font-semibold tracking-tight sm:text-3xl">
Tags
</h1>
<p className="text-sm text-muted-foreground">
Manage tags, aliases, categories, and usage across artworks.
</p>
<p className="text-sm text-muted-foreground">Manage tags.</p>
</div>
<div className="flex flex-col gap-2 sm:flex-row sm:items-center">
<form action={migrateArtworkTagJoinCopy}>
<Button type="submit" variant="secondary" className="h-11">
Copy tag relations
</Button>
</form>
<form action={migrateArtworkTagJoinDropOld}>
<Button type="submit" variant="destructive" className="h-11">
Copy + drop old
</Button>
</form>
<Button asChild className="h-11 gap-2">
<Link href="/tags/new">
<PlusCircleIcon className="h-4 w-4" />
@ -79,17 +56,15 @@ export default async function ArtTagsPage() {
</Link>
</Button>
</div>
</header >
</header>
{
rows.length > 0 ? (
<TagTabs tags={rows} />
) : (
<p className="text-muted-foreground">
There are no tags yet. Consider adding some!
</p>
)
}
</div >
{rows.length > 0 ? (
<TagTabs tags={rows} />
) : (
<p className="text-muted-foreground">
There are no tags yet. Consider adding some!
</p>
)}
</div>
);
}