import { getSchemas } from "@/lib/project-data";
// RSC: parses wasm4pm-compat-ts/bindings/zod_schemas.ts at render time.
// These are the TypeScript consumers of the Rust type surface.
export default async function SchemasPage() {
const schemas = await getSchemas();
return (
<div>
<h1 className="text-2xl font-bold text-zinc-100 mb-1">Zod TypeScript Schemas</h1>
<p className="text-sm text-zinc-500 mb-6">
{schemas.length} schemas auto-generated by{" "}
<span className="font-mono text-zinc-400">ggen</span> from the ontology
into{" "}
<span className="font-mono text-zinc-400">
wasm4pm-compat-ts/bindings/zod_schemas.ts
</span>
. These are the TypeScript consumers of the Rust type surface.
</p>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
{schemas.map((schema) => (
<div
key={schema.name}
className="border border-zinc-800 rounded p-3 bg-zinc-900"
>
<div className="font-mono text-sm text-blue-400 mb-2">
{schema.name}
<span className="text-zinc-600">Schema</span>
</div>
{schema.fields.length > 0 ? (
<div className="space-y-0.5">
{schema.fields.map((field) => (
<div
key={field}
className="font-mono text-xs text-zinc-500"
>
ยท {field}
</div>
))}
</div>
) : (
<div className="text-xs text-zinc-700 italic">no z.object fields</div>
)}
</div>
))}
</div>
</div>
);
}