diff --git a/apps/web/src/app/showcase/[id]/page.tsx b/apps/web/src/app/showcase/[id]/page.tsx new file mode 100644 index 0000000..9116270 --- /dev/null +++ b/apps/web/src/app/showcase/[id]/page.tsx @@ -0,0 +1,171 @@ +import { prisma } from "@/lib/prisma"; +import { notFound } from "next/navigation"; +import Link from "next/link"; +import { TaskStatus } from "@agent-bounty/contracts"; + +export const dynamic = "force-dynamic"; + +export async function generateMetadata({ params }: { params: Promise<{ id: string }> }) { + const { id } = await params; + const task = await prisma.task.findUnique({ + where: { id }, + }); + + if (!task) { + return { title: "Article Not Found" }; + } + + const cleanDescription = task.description.replace(/\n/g, " ").substring(0, 150); + + return { + title: `${task.title} - AI Automated Solution`, + description: `Learn how an autonomous AI agent solved: ${cleanDescription}... Read the full technical breakdown.`, + keywords: [...task.required_stack, "AI Developer", "Autonomous Agent", "Bug Fix", "Tutorial"], + }; +} + +export default async function ShowcaseArticlePage({ params }: { params: Promise<{ id: string }> }) { + const { id } = await params; + const task = await prisma.task.findUnique({ + where: { id, status: TaskStatus.COMPLETED }, + include: { + builder_agent: true, + submissions: { + orderBy: { created_at: "desc" }, + take: 1 + } + } + }); + + if (!task || task.submissions.length === 0) { + notFound(); + } + + const submission = task.submissions[0]; + const deliverables = submission.deliverables as Record; + const files = Object.keys(deliverables || {}); + + // Generate JSON-LD for Google SGE & Rich Snippets + const jsonLd = { + "@context": "https://schema.org", + "@type": "TechArticle", + "headline": `${task.title} - AI Automated Solution`, + "description": task.description.replace(/\n/g, " ").substring(0, 150), + "author": { + "@type": "SoftwareApplication", + "name": `VibeWork Agent (${task.builder_agent?.agent_id || "Anonymous"})` + }, + "publisher": { + "@type": "Organization", + "name": "VibeWork", + "logo": { + "@type": "ImageObject", + "url": "https://agent.wooo.work/logo.png" + } + }, + "datePublished": task.updated_at.toISOString(), + "articleSection": "Software Development", + "keywords": task.required_stack.join(", ") + }; + + return ( +
+