forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathops-platform-cta.tsx
More file actions
254 lines (242 loc) · 9.82 KB
/
Copy pathops-platform-cta.tsx
File metadata and controls
254 lines (242 loc) · 9.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
"use client";
import { CopilotKitMark } from "@/components/copilotkit-mark";
import { getRuntimeConfig } from "@/lib/runtime-config.client";
// Icons inlined as SVG so this component avoids a lucide-react dep
// (shell-docs deliberately keeps icon usage minimal — see mdx-registry's
// emoji fallbacks for the broader icon-set decision).
function ArrowRight({ className }: { className?: string }) {
return (
<svg
className={className}
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M5 12h14" />
<path d="m12 5 7 7-7 7" />
</svg>
);
}
function Info({ className }: { className?: string }) {
return (
<svg
className={className}
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<circle cx="12" cy="12" r="10" />
<path d="M12 16v-4" />
<path d="M12 8h.01" />
</svg>
);
}
export type OpsPlatformCTAVariant = "tile" | "inline" | "card" | "info";
export interface OpsPlatformCTAProps {
/** Visual style: tile = full-width hero, inline = mid-page callout, card = footer */
variant?: OpsPlatformCTAVariant;
/** Headline shown to the user */
title: string;
/** Body copy under the headline */
body?: string;
/** Stable identifier for analytics, e.g. "docs:langgraph/quickstart:whats-next".
* Flows through to the destination URL as `utm_content` so dashboard-side
* analytics can attribute the click. Shell-docs does not yet ship a
* client-side PostHog capture; UTM is the source of truth here. */
surface: string;
/** Optional override for the link label. Defaults to "Get Intelligence free" */
ctaLabel?: string;
/** Optional className override for the outermost element */
className?: string;
}
function buildHref(surface: string): string {
// Signup URL is read at render time from the runtime config injected
// by the root layout — see signup-link.tsx and lib/runtime-config.ts
// for the full plumbing rationale. Keeps a single artifact retargetable
// across Railway envs without rebuild.
const signupUrl = getRuntimeConfig().intelligenceSignupUrl;
const url = new URL(signupUrl);
url.searchParams.set("utm_source", "docs");
url.searchParams.set("utm_medium", "cta");
url.searchParams.set("utm_campaign", "intelligence");
url.searchParams.set("utm_content", surface);
return url.toString();
}
export function OpsPlatformCTA({
variant = "card",
title,
body,
surface,
ctaLabel = "Get Intelligence free",
className,
}: OpsPlatformCTAProps) {
const href = buildHref(surface);
if (variant === "info") {
return (
<div
className={`shell-docs-radius-surface not-prose my-6 flex gap-3 border border-[var(--border)] bg-[var(--bg-elevated)] p-4 shadow-[var(--shadow-control)] ${className ?? ""}`}
>
<Info className="h-5 w-5 text-[var(--accent)] mt-0.5 flex-shrink-0" />
<div className="min-w-0 flex-1">
<div className="font-semibold text-[var(--text)]">{title}</div>
{body ? (
<div className="text-sm text-[var(--text-muted)] leading-relaxed mt-1">
{body}
</div>
) : null}
<a
href={href}
target="_blank"
rel="noreferrer"
// HubSpot's analytics tag rewrites the outbound href client-side;
// see suppressHydrationWarning note on the card variant below.
suppressHydrationWarning
className="shell-docs-cta-accent mt-2 inline-flex items-center gap-1 text-sm font-medium no-underline hover:opacity-80"
data-cta-surface={surface}
data-cta-variant={variant}
>
{ctaLabel}
<ArrowRight className="h-3.5 w-3.5" />
</a>
</div>
</div>
);
}
if (variant === "inline") {
// Compact sibling of the `card` variant. Same visual language — light
// bordered surface, an accent left-edge stripe as the brand signature, the
// CopilotKit kite as the authored stamp, and a real text-link CTA in
// `--accent`.
return (
<a
href={href}
target="_blank"
rel="noreferrer"
// See suppressHydrationWarning note on the card variant below.
suppressHydrationWarning
data-cta-surface={surface}
data-cta-variant={variant}
className={`shell-docs-cta-link shell-docs-radius-surface not-prose group relative my-6 flex flex-col gap-3 overflow-hidden border border-[var(--border)] bg-[var(--bg-surface)] p-4 pl-5 shadow-[var(--shadow-control)] transition-colors duration-150 hover:border-[var(--accent)] sm:flex-row sm:items-center sm:justify-between sm:gap-4 ${className ?? ""}`}
>
{/* 2px accent stripe — the structural brand signature. */}
<span
aria-hidden="true"
className="shell-docs-cta-stripe pointer-events-none absolute left-0 top-0 h-full w-[2px]"
/>
<div className="flex items-start gap-3 min-w-0">
<CopilotKitMark className="mt-0.5 h-5 w-[18px] flex-shrink-0" />
<div className="min-w-0">
<div className="text-[15px] font-semibold leading-snug text-[var(--text)]">
{title}
</div>
{body ? (
<div className="mt-1 text-[13.5px] leading-relaxed text-[var(--text-muted)]">
{body}
</div>
) : null}
</div>
</div>
<span className="shell-docs-cta-accent inline-flex items-center gap-1 whitespace-nowrap text-sm font-semibold">
{ctaLabel}
<ArrowRight className="h-3.5 w-3.5 transition-transform duration-150 group-hover:translate-x-0.5" />
</span>
</a>
);
}
if (variant === "tile") {
return (
<a
href={href}
target="_blank"
rel="noreferrer"
// See suppressHydrationWarning note on the card variant below.
suppressHydrationWarning
data-cta-surface={surface}
data-cta-variant={variant}
className={`shell-docs-cta-link shell-docs-radius-surface not-prose group flex items-start gap-3 border border-[var(--border)] bg-[var(--bg-surface)] p-4 shadow-[var(--shadow-control)] transition-colors duration-150 hover:border-[var(--accent)] ${className ?? ""}`}
>
<CopilotKitMark className="mt-0.5 h-5 w-[18px] flex-shrink-0" />
<div>
<div className="font-semibold text-[var(--text)] mb-1">{title}</div>
{body ? (
<div className="text-sm text-[var(--text-muted)] leading-relaxed">
{body}
</div>
) : null}
</div>
</a>
);
}
// variant === "card" (default)
//
// Professional inline docs CTA — Vercel/Linear/Stripe energy, not a marketing
// splash. Light bordered surface (`--bg-surface`), a 2px accent left-edge
// stripe as the brand signature, the CopilotKit kite as the authored stamp
// in the corner, typography-led structure, and a real text-link CTA in
// `--accent`. The whole tile is the anchor; the CTA text is the visible
// click target.
//
// Why this design and not a filled-accent slab:
// - The flat-purple-block + white-pill pattern is the AI-template cliché
// the user has flagged twice as "vibe coded".
// - Real product docs CTAs (Vercel sign-up nudges, Stripe console prompts,
// Linear billing callouts) are mostly monochrome and typography-led, with
// a single accent touchpoint.
// - The kite reads as authored brand, far more credibly than a generic
// sparkle icon.
// - The accent stripe is the same structural cue Linear uses on important
// inline notices — restrained but unmistakable.
//
return (
<a
href={href}
target="_blank"
rel="noreferrer"
// HubSpot's analytics tag rewrites the outbound href client-side to
// append `__hstc` / `__hssc` / `__hsfp` cross-domain tracking params,
// which trips React's hydration diff. Same fix lives on the nav-bar
// Intelligence CTA (mobile-top-nav.tsx + brand-nav.tsx).
suppressHydrationWarning
data-cta-surface={surface}
data-cta-variant={variant}
className={`shell-docs-cta-link shell-docs-radius-surface not-prose group relative my-8 flex flex-col items-stretch gap-4 overflow-hidden border border-[var(--border)] bg-[var(--bg-surface)] p-5 pl-6 shadow-[var(--shadow-control)] transition-colors duration-150 hover:border-[var(--accent)] sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:p-6 sm:pl-7 ${className ?? ""}`}
>
{/* 2px accent stripe — the structural brand signature. Positioned via the
parent's relative + overflow-hidden so the stripe sits flush against
the rounded corners without bleeding past them. */}
<span
aria-hidden="true"
className="shell-docs-cta-stripe pointer-events-none absolute left-0 top-0 h-full w-[2px]"
/>
<div className="flex items-start gap-4 min-w-0">
<CopilotKitMark className="mt-0.5 h-6 w-[22px] flex-shrink-0" />
<div className="min-w-0">
<div className="text-lg font-semibold leading-tight tracking-tight text-[var(--text)]">
{title}
</div>
{body ? (
<div className="mt-1.5 text-sm leading-relaxed text-[var(--text-muted)]">
{body}
</div>
) : null}
</div>
</div>
<span className="shell-docs-cta-accent inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap text-sm font-semibold">
{ctaLabel}
<ArrowRight className="h-4 w-4 transition-transform duration-150 group-hover:translate-x-0.5" />
</span>
</a>
);
}