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
241 lines (227 loc) · 8.15 KB
/
Copy pathops-platform-cta.tsx
File metadata and controls
241 lines (227 loc) · 8.15 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
"use 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>
);
}
function Sparkles({ 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"
>
<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" />
<path d="M20 3v4" />
<path d="M22 5h-4" />
<path d="M4 17v2" />
<path d="M5 18H3" />
</svg>
);
}
const DEFAULT_SIGNUP_URL = "https://dashboard.operations.copilotkit.ai/";
const SIGNUP_URL =
process.env.NEXT_PUBLIC_INTELLIGENCE_SIGNUP_URL || DEFAULT_SIGNUP_URL;
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 {
const url = new URL(SIGNUP_URL);
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={`not-prose my-6 flex gap-3 rounded-lg border border-[var(--border)] bg-[var(--bg-elevated)] p-4 ${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"
// Inline color wins over .reference-content .not-prose a { color: inherit }
// in globals.css (which would otherwise drag this to the prose text color).
style={{ color: "var(--accent)" }}
className="inline-flex items-center gap-1 mt-2 text-sm font-medium hover:opacity-80 no-underline"
data-cta-surface={surface}
data-cta-variant={variant}
>
{ctaLabel}
<ArrowRight className="h-3.5 w-3.5" />
</a>
</div>
</div>
);
}
if (variant === "inline") {
return (
<div
className={`not-prose my-6 flex flex-col gap-3 rounded-lg border border-[var(--border)] bg-[var(--violet-light)] p-4 sm:flex-row sm:items-center sm:justify-between ${className ?? ""}`}
>
<div className="flex items-start gap-3">
<Sparkles className="h-5 w-5 text-[var(--accent)] mt-0.5 flex-shrink-0" />
<div>
<div className="font-semibold text-[var(--text)]">{title}</div>
{body ? (
<div className="text-sm text-[var(--text-muted)] leading-relaxed mt-0.5">
{body}
</div>
) : null}
</div>
</div>
<a
href={href}
target="_blank"
rel="noreferrer"
// Inline color wins over .reference-content .not-prose a { color: inherit }
// in globals.css (which would otherwise leave this dark on the violet button).
style={{ color: "#ffffff" }}
className="inline-flex items-center gap-1.5 whitespace-nowrap rounded-md bg-[var(--accent)] hover:opacity-90 text-sm font-medium px-4 py-2 no-underline transition-opacity"
data-cta-surface={surface}
data-cta-variant={variant}
>
{ctaLabel}
<ArrowRight className="h-4 w-4" />
</a>
</div>
);
}
if (variant === "tile") {
return (
<a
href={href}
target="_blank"
rel="noreferrer"
data-cta-surface={surface}
data-cta-variant={variant}
// Inline textDecoration wins over .reference-content a { text-decoration: underline }
// in globals.css. The Tailwind `no-underline` class loses on specificity here because
// `not-prose` is on the <a> itself, not an ancestor — so the descendant exception
// .reference-content .not-prose a doesn't apply.
style={{ textDecoration: "none" }}
className={`not-prose group flex items-start gap-3 rounded-lg border border-[var(--border)] bg-[var(--violet-light)] p-4 shadow-sm hover:border-[var(--accent)] transition-colors ${className ?? ""}`}
>
<Sparkles className="h-5 w-5 text-[var(--accent)] mt-0.5 flex-shrink-0" />
<div>
<div className="font-semibold text-[var(--text)] group-hover:text-[var(--accent)] mb-1">
{title}
</div>
{body ? (
<div className="text-sm text-[var(--text-muted)] leading-relaxed">
{body}
</div>
) : null}
</div>
</a>
);
}
// variant === "card" (default)
return (
<a
href={href}
target="_blank"
rel="noreferrer"
data-cta-surface={surface}
data-cta-variant={variant}
// See note on the tile variant — inline textDecoration is needed to defeat
// .reference-content a { text-decoration: underline } from globals.css.
style={{ textDecoration: "none" }}
className={`not-prose my-8 flex items-center justify-between gap-4 rounded-lg border border-[var(--border)] bg-[var(--violet-light)] p-5 shadow-sm hover:border-[var(--accent)] transition-colors ${className ?? ""}`}
>
<div className="flex items-start gap-3 min-w-0">
<Sparkles className="h-5 w-5 text-[var(--accent)] mt-0.5 flex-shrink-0" />
<div className="min-w-0">
<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>
</div>
<span className="inline-flex items-center gap-1.5 whitespace-nowrap text-sm font-medium text-[var(--accent)]">
{ctaLabel}
<ArrowRight className="h-4 w-4" />
</span>
</a>
);
}