SPB Git
756 B · 7 lines tsx
1import { sql } from "@/db";2import { CollectionsEditor } from "@/components/admin/collections-editor";3export default async function Collections() {4  const cols = await sql`SELECT c.slug, c.title, c.description, c.published, (SELECT coalesce(jsonb_agg(jsonb_build_object('tool', t.slug, 'blurb', ci.blurb) ORDER BY ci.position), '[]') FROM collection_items ci JOIN tools t ON t.id=ci.tool_id WHERE ci.collection_id=c.id) AS items FROM collections c ORDER BY c.sort_order, c.title`;5  return <div><h1 className="display h1">Collections</h1><p className="mt-1 text-sm text-fg-2">Curated guides. Items are tool slugs with an optional blurb explaining why the tool is in the stack.</p><CollectionsEditor initial={JSON.parse(JSON.stringify(cols))} /></div>;6}7
Files · laptop-initial-20261102
Menu

Theme