Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

site: add demo action and repository sidebar (#1826)

Allen Zhouf835ad57409d
diff --git a/apps/docs/app/[lang]/templates/[slug]/page.tsx b/apps/docs/app/[lang]/templates/[slug]/page.tsx
index 46a7acd49..03f5dadb1 100644
--- a/apps/docs/app/[lang]/templates/[slug]/page.tsx
+++ b/apps/docs/app/[lang]/templates/[slug]/page.tsx
@@ -100,6 +100,7 @@ const TemplateDetailPage = async ({ params }: { params: Promise<PageParams> }) =
<p className="max-w-[520px] text-copy-16 text-gray-900">{entry.description}</p>
<div className="mt-6">
<TemplateActions
+ demoHref={entry.demoHref}
setupPrompt={entry.setupPrompt}
sourceHref={entry.sourceHref}
template={entry.slug}
@@ -115,10 +116,46 @@ const TemplateDetailPage = async ({ params }: { params: Promise<PageParams> }) =
<FileViewer files={highlightedFiles} />
</section>
- <section aria-label="README" className="mt-16">
- <div className="max-w-[760px]">
+ <section
+ aria-label="Template documentation"
+ className="mt-16 grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem] lg:gap-12"
+ >
+ <div>
<TemplateReadme readme={entry.readme} sourceRevisionHref={entry.sourceRevisionHref} />
</div>
+ <aside className="order-first lg:order-none" aria-labelledby="github-heading">
+ <h2 className="m-0 text-heading-24 text-gray-1000" id="github-heading">
+ GitHub
+ </h2>
+ <dl className="mt-6 grid gap-6 sm:grid-cols-2 lg:grid-cols-1">
+ <div>
+ <dt className="font-medium text-gray-1000 text-label-14">Owner</dt>
+ <dd className="mt-2 text-copy-14">
+ <a
+ className="rounded-sm font-medium text-gray-900 underline decoration-gray-400 underline-offset-4 outline-none transition-colors hover:text-gray-1000 hover:decoration-gray-1000 focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none"
+ href={`https://github.com/${entry.githubOwner}`}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ {entry.githubOwner}
+ </a>
+ </dd>
+ </div>
+ <div>
+ <dt className="font-medium text-gray-1000 text-label-14">Repository</dt>
+ <dd className="mt-2 text-copy-14">
+ <a
+ className="break-words rounded-sm font-medium text-gray-900 underline decoration-gray-400 underline-offset-4 outline-none transition-colors hover:text-gray-1000 hover:decoration-gray-1000 focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none"
+ href={`https://github.com/${entry.githubOwner}/${entry.githubRepo}`}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ {entry.githubRepo}
+ </a>
+ </dd>
+ </div>
+ </dl>
+ </aside>
</section>
</main>
</>
diff --git a/apps/docs/app/[lang]/templates/[slug]/template-actions.tsx b/apps/docs/app/[lang]/templates/[slug]/template-actions.tsx
index ffd148f38..015ed334e 100644
--- a/apps/docs/app/[lang]/templates/[slug]/template-actions.tsx
+++ b/apps/docs/app/[lang]/templates/[slug]/template-actions.tsx
@@ -1,21 +1,37 @@
"use client";
-import { SiGithub } from "@icons-pack/react-simple-icons";
import { track } from "@vercel/analytics";
import { Button } from "@vercel/geistdocs/components/button";
-import { CheckIcon, CopyIcon } from "lucide-react";
+import { CheckIcon, CopyIcon, ExternalLinkIcon } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { analyticsEvents } from "@/lib/analytics/events";
interface TemplateActionsProps {
+ demoHref?: string;
setupPrompt: string;
sourceHref: string;
template: string;
}
-export const TemplateActions = ({ setupPrompt, sourceHref, template }: TemplateActionsProps) => {
+export const TemplateActions = ({
+ demoHref,
+ setupPrompt,
+ sourceHref,
+ template,
+}: TemplateActionsProps) => {
const [copied, setCopied] = useState(false);
const resetTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const secondaryAction = demoHref
+ ? {
+ event: analyticsEvents.templateDemoOpened,
+ href: demoHref,
+ label: "View Demo",
+ }
+ : {
+ event: analyticsEvents.templateSourceOpened,
+ href: sourceHref,
+ label: "View Source",
+ };
useEffect(
() => () => {
@@ -63,13 +79,13 @@ export const TemplateActions = ({ setupPrompt, sourceHref, template }: TemplateA
variant="outline"
>
<a
- href={sourceHref}
- onClick={() => track(analyticsEvents.templateSourceOpened, { template })}
+ href={secondaryAction.href}
+ onClick={() => track(secondaryAction.event, { template })}
rel="noopener noreferrer"
target="_blank"
>
- <SiGithub aria-hidden="true" className="size-4" />
- View GitHub
+ <ExternalLinkIcon aria-hidden="true" className="size-4" />
+ {secondaryAction.label}
</a>
</Button>
<span aria-live="polite" className="sr-only">
diff --git a/apps/docs/lib/analytics/events.ts b/apps/docs/lib/analytics/events.ts
index f408b4cbf..271227a97 100644
--- a/apps/docs/lib/analytics/events.ts
+++ b/apps/docs/lib/analytics/events.ts
@@ -13,6 +13,7 @@ export const analyticsEvents = {
templateFilterSelected: "Selected template filter",
templateOpened: "Opened template",
templatesSearched: "Searched templates",
+ templateDemoOpened: "Opened template demo",
templateSetupCopied: "Copied template setup prompt",
templateSourceOpened: "Opened template source",
} as const;
diff --git a/apps/docs/lib/templates/compose.test.ts b/apps/docs/lib/templates/compose.test.ts
index 945a64836..16785e17b 100644
--- a/apps/docs/lib/templates/compose.test.ts
+++ b/apps/docs/lib/templates/compose.test.ts
@@ -7,6 +7,7 @@ const manifestEntry: TemplateManifestEntry = {
slug: "example",
title: "Example agent template",
description: "An example template.",
+ demoHref: "https://example.vercel.app",
category: "Example",
integrations: ["HTTP API"],
model: "anthropic/claude-sonnet-5",
@@ -39,10 +40,13 @@ describe("composeTemplateEntries", () => {
expect(entry.slug).toBe("example");
expect(entry.title).toBe("Example agent template");
+ expect(entry.demoHref).toBe("https://example.vercel.app");
expect(entry.sourceRevision).toBe("0123456789abcdef0123456789abcdef01234567");
expect(entry.sourceRevisionHref).toBe(
"https://github.com/vercel-labs/example/tree/0123456789abcdef0123456789abcdef01234567",
);
+ expect(entry.githubOwner).toBe("vercel-labs");
+ expect(entry.githubRepo).toBe("example");
expect(entry.readme).toBe(generated.templates.example.readme);
expect(entry.files).toEqual(generated.templates.example.files);
expect(entry).not.toHaveProperty("github");
diff --git a/apps/docs/lib/templates/compose.ts b/apps/docs/lib/templates/compose.ts
index 5dd8d1ba5..929165ef1 100644
--- a/apps/docs/lib/templates/compose.ts
+++ b/apps/docs/lib/templates/compose.ts
@@ -13,11 +13,14 @@ export interface TemplateFile {
export interface TemplateEntry {
category: TemplateCategory;
+ demoHref?: string;
description: string;
files: TemplateFile[];
integrations: TemplateIntegration[];
model: string;
readme: string;
+ githubOwner: string;
+ githubRepo: string;
slug: string;
source: TemplateSource;
sourceHref: string;
@@ -95,6 +98,8 @@ export const composeTemplateEntries = (
return {
...curated,
files,
+ githubOwner: entry.github.owner,
+ githubRepo: entry.github.repo,
readme: data.readme,
sourceRevision: data.sourceRevision,
sourceRevisionHref,
diff --git a/apps/docs/lib/templates/manifest.ts b/apps/docs/lib/templates/manifest.ts
index e5cebaa07..cfec9fa0c 100644
--- a/apps/docs/lib/templates/manifest.ts
+++ b/apps/docs/lib/templates/manifest.ts
@@ -30,6 +30,7 @@ export interface TemplateManifestEntry {
slug: string;
title: string;
description: string;
+ demoHref?: string;
category: TemplateCategory;
integrations: TemplateIntegration[];
model: string;
@@ -49,19 +50,17 @@ export const templateManifest: TemplateManifestEntry[] = [
"Set up the eve chat template in my current workspace using https://github.com/vercel-labs/eve-chat-template/tree/main as the source. Copy the project files, install its dependencies, and follow the repository README to configure it. Preserve the existing project if the workspace is not empty, and tell me about any required environment variables or manual setup steps.",
description:
"A persisted Next.js chat template for eve, built with shadcn/ui, Tailwind CSS, Streamdown, Better Auth, Drizzle, Neon, and Upstash Redis.",
+ demoHref: "https://eve-chat-template.labs.vercel.dev",
sourceHref: "https://github.com/vercel-labs/eve-chat-template/tree/main",
category: "Chat",
model: "anthropic/claude-sonnet-5",
- integrations: ["Web chat", "Slack", "Linear", "Notion", "Sentry"],
+ integrations: ["Web chat", "Slack"],
source: "Vercel Templates",
github: { owner: "vercel-labs", repo: "eve-chat-template", ref: "main" },
files: [
"agent/agent.ts",
"agent/channels/eve.ts",
"agent/channels/slack.ts",
- "agent/connections/linear.ts",
- "agent/connections/notion.ts",
- "agent/connections/sentry.ts",
"agent/instructions.md",
"agent/skills/plan_a_trip.md",
"agent/tools/get_weather.ts",