diff --git a/app/campaigns/landing/page.tsx b/app/campaigns/landing/page.tsx new file mode 100644 index 0000000..0fda9ca --- /dev/null +++ b/app/campaigns/landing/page.tsx @@ -0,0 +1,31 @@ +import AgentPrompts from "../../components/campaign/AgentPrompts"; +import CampaignFilm from "../../components/campaign/CampaignFilm"; +import { getMetadata } from "../../services/metadataService"; +import { withBasePath } from "../../services/sitePath"; + +const title = "DocumentDB for coding agents - Build with one prompt"; +const description = "Give your coding agent one prompt and get a working app on an open-source document database built on PostgreSQL."; + +export const metadata = { + ...getMetadata({ title, description, path: "/campaigns/landing/" }), + robots: { index: false, follow: false }, +}; + +export default function LandingPage() { + const primary = { label: "Get it running", href: withBasePath("/docs/getting-started/") }; + const secondary = { label: "Choose your deployment", href: withBasePath("/packages/") }; + + return ( +
+ + + +
+ ); +} diff --git a/app/components/campaign/AgentPrompts.module.css b/app/components/campaign/AgentPrompts.module.css new file mode 100644 index 0000000..ca4034a --- /dev/null +++ b/app/components/campaign/AgentPrompts.module.css @@ -0,0 +1,422 @@ +.panel { + display: flex; + flex: 1; + flex-direction: column; + gap: 0.85rem; + min-width: 0; + min-height: 0; + max-height: 36rem; + color: #fff; +} + +.heading h1 { + margin: 0.35rem 0; + font-size: clamp(1.5rem, 3vw, 2.5rem); + font-weight: 600; + line-height: 1.1; + letter-spacing: -0.045em; +} + +.eyebrow { + font-size: 0.75rem; + color: #6ee7b7; +} + +.description, +.intro p { + font-size: 0.8125rem; + line-height: 1.5; + color: #cbd5e1; +} + +.tabs { + display: flex; + flex-shrink: 0; + gap: 0.5rem; +} + +.carouselNav { + display: flex; + flex-shrink: 0; + align-items: stretch; + gap: 0.35rem; +} + +.carouselNav .tabs { + flex: 1; + min-width: 0; +} + +.arrow, +.rotation { + display: grid; + flex-shrink: 0; + place-items: center; + border: 1px solid #374151; + border-radius: 0.5rem; + background: #111b26; + color: #bae6fd; + cursor: pointer; +} + +.arrow { + width: 1.75rem; +} + +.arrow svg { + width: 1rem; + height: 1rem; +} + +.actions { + display: flex; + align-items: center; + gap: 0.35rem; +} + +.rotation svg { + width: 0.75rem; + height: 0.75rem; + fill: currentColor; +} + +.tabs button { + flex: 1; + min-width: 0; + border: 1px solid #374151; + border-radius: 0.65rem; + background: rgba(23, 23, 23, 0.8); + padding: 0.65rem 0.5rem; + font-size: 0.8125rem; + font-weight: 600; + cursor: pointer; +} + +.tabs button[aria-selected="true"] { + border-color: #7dd3fc; + background: #7dd3fc; + color: #05070a; +} + +.panel button:focus-visible, +.panel a:focus-visible, +.prompt textarea:focus-visible { + outline: 2px solid #7dd3fc; + outline-offset: 2px; +} + +.sample { + display: flex; + flex: 1; + flex-direction: column; + min-height: 0; + overflow: hidden; + border: 1px solid rgba(125, 211, 252, 0.25); + border-radius: 1rem; + background: rgba(5, 10, 17, 0.9); + box-shadow: 0 20px 60px -35px rgba(14, 165, 233, 0.4); +} + +.intro { + flex-shrink: 0; + padding: 0.85rem 1rem; +} + +.intro h2 { + margin-bottom: 0.3rem; + font-size: 1rem; + font-weight: 600; + line-height: 1.3; +} + +.sample:has([aria-expanded="false"]) .intro { + display: none; +} + +.toolbar { + display: flex; + flex-shrink: 0; + align-items: center; + justify-content: space-between; + gap: 0.5rem; + border-block: 1px solid #263341; + padding: 0.45rem 0.75rem; +} + +.toolbar button { + border-radius: 0.5rem; + padding: 0.4rem 0.65rem; + font-size: 0.75rem; + font-weight: 600; + cursor: pointer; +} + +.fold { + display: flex; + align-items: center; + gap: 0.3rem; + border: 1px solid #7dd3fc; + background: #111b26; + color: #bae6fd; +} + +.fold:hover { + background: #1c3344; +} + +.fold svg { + width: 1rem; + height: 1rem; +} + +.copy { + background: #7dd3fc; + color: #05070a; +} + +.copy:hover { + background: #bae6fd; +} + +.prompt { + display: flex; + flex: 1; + min-height: 0; +} + +.summary { + flex: 1; + min-height: 0; + overflow: auto; + padding: 0.75rem 1rem; + font-size: 0.8125rem; + line-height: 1.6; + color: #cbd5e1; +} + +.summary p { + margin-bottom: 0.75rem; +} + +.summary a, +.intro a { + color: #7dd3fc; +} + +.summary a:hover, +.intro a:hover { + text-decoration: underline; +} + +.summary div:focus-visible { + outline: 2px solid #7dd3fc; + outline-offset: -2px; +} + +.prompt textarea { + width: 100%; + height: 100%; + min-height: 0; + resize: none; + border: 0; + background: transparent; + padding: 0.75rem 1rem; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + font-size: 0.75rem; + line-height: 1.65; + color: #a7f3d0; +} + +.links { + display: grid; + flex: 1; + grid-template-columns: repeat(2, minmax(0, 1fr)); + align-content: safe center; + gap: 0.65rem; + min-height: 0; + overflow: auto; + padding: 1rem; +} + +.carouselNav[hidden], +.prompt[hidden], +.summary[hidden], +.links[hidden] { + display: none; +} + +.links a { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.5rem; + border: 1px solid #374151; + border-radius: 0.65rem; + padding: 0.8rem; + font-size: 0.8125rem; + line-height: 1.4; + color: #bae6fd; +} + +.links a:hover { + border-color: #7dd3fc; + background: #111b26; +} + +.preview { + font-size: 0.625rem; + color: #94a3b8; +} + +.status { + flex-shrink: 0; + border-top: 1px solid #263341; + padding: 0.45rem 1rem; + font-size: 0.6875rem; + line-height: 1.4; + color: #a7f3d0; +} + +.error { + color: #fde68a; +} + +.resources { + display: flex; + flex-shrink: 0; + flex-wrap: wrap; + justify-content: space-between; + gap: 0.25rem 0.75rem; + font-size: 0.6875rem; + line-height: 1.5; + color: #94a3b8; +} + +.resources div { + display: flex; + gap: 0.75rem; +} + +.resources a { + color: #7dd3fc; +} + +@media (max-width: 1023px) { + .panel { + gap: 0.5rem; + max-height: none; + } + + .heading h1 { + font-size: 1.5rem; + } + + .intro { + padding: 0.6rem 0.75rem; + } + + .intro h2 { + font-size: 0.875rem; + } +} + +@media (max-width: 639px) { + .resources { + min-height: 2.3125rem; + } + + .description { + display: none; + } + + .links { + padding: 0.5rem; + gap: 0.35rem; + } + + .links a { + padding: 0.4rem; + font-size: 0.6875rem; + } + +} + +@media (max-height: 700px) { + .summary { + padding: 0.35rem 0.65rem; + } + + .panel { + gap: 0.4rem; + } + + .heading h1 { + font-size: 1.4rem; + } + + .description, + .intro p { + display: none; + } + + .intro, + .toolbar { + padding: 0.35rem 0.65rem; + } + + .tabs button, + .links a { + padding: 0.4rem; + } + + .intro h2 { + margin: 0; + font-size: 0.8125rem; + } + + .links { + padding: 0.5rem; + gap: 0.35rem; + } +} + +@media (max-height: 450px) { + .tabs button { + font-size: 0.6875rem; + } + + .summary { + font-size: 0.75rem; + line-height: 1.5; + } + + .panel { + gap: 0.25rem; + } + + .eyebrow, + .resources > span { + display: none; + } + + .heading h1 { + margin: 0; + font-size: 1.125rem; + } + + .prompt textarea { + padding: 0.35rem 0.65rem; + line-height: 1.5; + } + + .links a { + padding: 0.25rem; + font-size: 0.6875rem; + } + + .links { + grid-template-columns: repeat(4, minmax(0, 1fr)); + padding: 0.15rem; + gap: 0.25rem; + } +} diff --git a/app/components/campaign/AgentPrompts.tsx b/app/components/campaign/AgentPrompts.tsx new file mode 100644 index 0000000..8778c66 --- /dev/null +++ b/app/components/campaign/AgentPrompts.tsx @@ -0,0 +1,197 @@ +"use client"; + +import { useEffect, useRef, useState } from "react"; +import { agentKitUrl, galleryRevision, samplePrompts, SAMPLES_GALLERY_URL } from "./promptContent"; +import styles from "./AgentPrompts.module.css"; +import { withBasePath } from "../../services/sitePath"; + +type Link = { label: string; href: string }; +const slides = [{ id: "starter", label: "Starter" }, ...samplePrompts]; + +export default function AgentPrompts({ primary, secondary }: { primary: Link; secondary: Link }) { + const [selected, setSelected] = useState(0); + const [expanded, setExpanded] = useState(true); + const [feedback, setFeedback] = useState<{ id: string; error: boolean } | null>(null); + const [rotating, setRotating] = useState(true); + const [hovered, setHovered] = useState(false); + const [focused, setFocused] = useState(false); + const [visible, setVisible] = useState(true); + const buttons = useRef<(HTMLButtonElement | null)[]>([]); + const slide = slides[selected]; + const prompt = selected === 0 ? null : samplePrompts[selected - 1]; + const currentFeedback = prompt && feedback?.id === prompt.id ? feedback : null; + const rotationActive = rotating && !hovered && !focused && visible && expanded; + + useEffect(() => { + const motion = window.matchMedia("(prefers-reduced-motion: reduce)"); + const updateMotion = () => { if (motion.matches) setRotating(false); }; + const updateVisibility = () => setVisible(!document.hidden); + updateMotion(); + updateVisibility(); + motion.addEventListener("change", updateMotion); + document.addEventListener("visibilitychange", updateVisibility); + return () => { + motion.removeEventListener("change", updateMotion); + document.removeEventListener("visibilitychange", updateVisibility); + }; + }, []); + + useEffect(() => { + if (!rotationActive) return; + const timer = window.setTimeout(() => { + setSelected((index) => (index + 1) % slides.length); + setFeedback(null); + }, 10000); + return () => window.clearTimeout(timer); + }, [rotationActive, selected]); + + function selectSlide(index: number) { + setSelected((index + slides.length) % slides.length); + setFeedback(null); + } + + async function copyPrompt() { + if (!prompt) return; + try { + await navigator.clipboard.writeText(prompt.prompt); + } catch { + setFeedback({ id: prompt.id, error: true }); + return; + } + setFeedback({ id: prompt.id, error: false }); + } + + return ( +
setHovered(true)} onMouseLeave={() => setHovered(false)} + onFocusCapture={() => setFocused(true)} + onBlurCapture={(event) => { + if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false); + }}> +
+

Open source. Agent ready. Yours to run.

+

One prompt. A working app.

+

Start with the basics, or let your agent build a sample.

+
+ + + +
+
+ +
+ {expanded && } + {prompt && } +
+
+
+ {prompt ? <> +

{prompt.title}

+

{prompt.description}

+ : <> +

+ Why are there so many document databases? +

+

A familiar document model. More choice in how you run it.

+ } +
+