/products (search), product pages with revisions, getting and staying on a revision, retracting; /products/:id/edit; /create and new revisions upload from the browser straight to the catalog with a token from the hub; /library; /catalogs (directory, registering with a once-shown key); /console/catalogs to approve or reject. Every page now sends a nonce-based CSP (proxy.ts), so product descriptions can't run scripts. buttonVariants now merges classes, so outline links get their border. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import Link from "next/link";
|
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
import { UploadForm } from "@/components/upload-form";
|
|
import { api, unwrap } from "@/lib/api";
|
|
|
|
/** Uploading to one of the approved catalogs: a new product, or with product, a new revision of it. */
|
|
export async function UploadCard({ title, product }: { title: string; product?: string }) {
|
|
const { catalogs } = await api.catalogs.get().then(unwrap);
|
|
const approved = catalogs.filter((c) => c.status === "approved").map((c) => ({ id: c.id, name: c.name }));
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>{title}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
{approved.length > 0 ? (
|
|
<UploadForm catalogs={approved} product={product} />
|
|
) : (
|
|
<p className="text-sm text-muted-foreground">
|
|
No catalogs to upload to yet. See{" "}
|
|
<Link href="/catalogs" className="text-foreground underline underline-offset-4">
|
|
catalogs
|
|
</Link>
|
|
.
|
|
</p>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|