import type { Metadata } from "next"; import { CatalogStatus, membership } from "@/components/catalogs"; import { PageHeader } from "@/components/status"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { api, getMe, unwrap, type Catalog } from "@/lib/api"; import { RegisterForm } from "./register-form"; export const metadata: Metadata = { title: "Catalogs" }; export default async function Catalogs() { const [me, { catalogs }] = await Promise.all([getMe(), api.catalogs.get().then(unwrap)]); const mine = catalogs.filter((c) => c.mine); const directory = catalogs.filter((c) => !c.mine && c.status === "approved"); return (
Servers that host community products. {mine.length > 0 && ( Yours )} Directory {directory.length === 0 ? (

No catalogs yet.

) : ( )}
{me && ( Register a catalog Run t5de-catalog, then register its address here. )}
); } function CatalogTable({ catalogs, showStatus = false }: { catalogs: Catalog[]; showStatus?: boolean }) { return ( Name Address Membership {showStatus && Visibility} {showStatus && Status} {catalogs.map((c) => ( {c.name} {c.url} {membership[c.membership] ?? c.membership} {showStatus && {c.visibility}} {showStatus && ( )} ))}
); }