sanity-plugin-seo-copilot 0.2.5 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1310 -625
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1332 -647
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
- package/src/components/ChatPanel.tsx +5 -3
- package/src/components/FeedbackButton.tsx +6 -1
- package/src/components/KeywordPanel.tsx +179 -6
- package/src/components/OnboardingPopup.tsx +108 -0
- package/src/components/SEOCopilotPanel.tsx +160 -9
- package/src/components/ShimmerLoader.tsx +4 -0
- package/src/components/TabBar.tsx +3 -0
- package/src/components/styles.ts +8 -0
- package/src/components/tabs/AEOTab.tsx +4 -2
- package/src/components/tabs/LinkingTab.tsx +85 -8
- package/src/components/tabs/MetaTab.tsx +32 -119
- package/src/components/tabs/SummaryTab.tsx +19 -4
- package/src/components/tabs/TechnicalTab.tsx +118 -8
- package/src/hooks/useDocumentContent.ts +48 -47
- package/src/hooks/useKeywordAnalysis.ts +81 -48
- package/src/hooks/useSEOChat.ts +49 -9
- package/src/inspector.ts +0 -1
- package/src/lib/api.ts +30 -10
- package/src/lib/documentExtract.ts +268 -257
- package/src/lib/scoring.ts +42 -15
- package/src/lib/summary.ts +121 -41
- package/src/lib/utils.ts +35 -0
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-seo-copilot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "AI-powered SEO writing assistant for Sanity Studio",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity",
|
|
7
|
+
"sanity-plugin",
|
|
8
|
+
"seo",
|
|
9
|
+
"copilot"
|
|
10
|
+
],
|
|
6
11
|
"license": "UNLICENSED",
|
|
7
12
|
"author": "MJH Life Sciences",
|
|
8
13
|
"exports": {
|
|
@@ -231,20 +231,22 @@ export function ChatPanel({ messages, isStreaming, sendMessage, clearChat, docum
|
|
|
231
231
|
{messages.length > 0 && (
|
|
232
232
|
<button
|
|
233
233
|
onClick={clearChat}
|
|
234
|
-
onMouseEnter={() => setClearHovered(true)}
|
|
234
|
+
onMouseEnter={() => !isStreaming && setClearHovered(true)}
|
|
235
235
|
onMouseLeave={() => setClearHovered(false)}
|
|
236
236
|
title="Clear conversation"
|
|
237
237
|
aria-label="Clear conversation"
|
|
238
|
+
disabled={isStreaming}
|
|
238
239
|
style={{
|
|
239
240
|
background: "none",
|
|
240
241
|
border: "none",
|
|
241
|
-
cursor: "pointer",
|
|
242
|
+
cursor: isStreaming ? "not-allowed" : "pointer",
|
|
242
243
|
padding: 4,
|
|
243
244
|
display: "flex",
|
|
244
245
|
alignItems: "center",
|
|
245
|
-
color: clearHovered ? "#ef4444" : "#9ca3af",
|
|
246
|
+
color: isStreaming ? "#d1d5db" : clearHovered ? "#ef4444" : "#9ca3af",
|
|
246
247
|
transition: "color 150ms",
|
|
247
248
|
flexShrink: 0,
|
|
249
|
+
opacity: isStreaming ? 0.4 : 1,
|
|
248
250
|
}}
|
|
249
251
|
>
|
|
250
252
|
<svg width="14" height="14" viewBox="0 0 20 20" fill="currentColor">
|
|
@@ -19,6 +19,11 @@ export function FeedbackButton({ suggestionType, suggestionText, documentId, pub
|
|
|
19
19
|
const [submitted, setSubmitted] = useState(false);
|
|
20
20
|
const popupRef = useRef<HTMLDivElement>(null);
|
|
21
21
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
22
|
+
const submitTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
return () => { if (submitTimerRef.current) clearTimeout(submitTimerRef.current); };
|
|
26
|
+
}, []);
|
|
22
27
|
|
|
23
28
|
// Close popup on outside click
|
|
24
29
|
useEffect(() => {
|
|
@@ -90,7 +95,7 @@ export function FeedbackButton({ suggestionType, suggestionText, documentId, pub
|
|
|
90
95
|
} catch { /* silent */ }
|
|
91
96
|
}
|
|
92
97
|
setSubmitted(true);
|
|
93
|
-
setTimeout(() => {
|
|
98
|
+
submitTimerRef.current = setTimeout(() => {
|
|
94
99
|
setShowReasonPopup(false);
|
|
95
100
|
setReason("");
|
|
96
101
|
}, 1000);
|
|
@@ -18,6 +18,10 @@ interface KeywordPanelProps {
|
|
|
18
18
|
seedKeywords?: string[];
|
|
19
19
|
onSeedsChange?: (seeds: string[]) => void;
|
|
20
20
|
onSelectPrimary?: (term: string) => void;
|
|
21
|
+
// Optional secondary/supporting target keyword. Audits check the article against
|
|
22
|
+
// BOTH the primary and this secondary keyword. "" / undefined = none selected.
|
|
23
|
+
secondaryKeyword?: string;
|
|
24
|
+
onSelectSecondary?: (term: string) => void;
|
|
21
25
|
documentFields?: DocumentFields;
|
|
22
26
|
// Used as key for SuggestedKeywordsCard to remount on doc change (resets manualKeywords/extraKeywords/helpData)
|
|
23
27
|
documentId?: string;
|
|
@@ -109,12 +113,14 @@ function buildSuggestedKeywords(
|
|
|
109
113
|
const lowerText = documentText.toLowerCase();
|
|
110
114
|
|
|
111
115
|
for (const kw of supporting) {
|
|
116
|
+
if (kw == null || typeof kw.term !== "string") continue;
|
|
112
117
|
const actuallyInContent = lowerText.includes(kw.term.toLowerCase());
|
|
113
118
|
const livePlacement = computePlacementClient(kw.term, documentText, documentFields);
|
|
114
119
|
merged.push({ term: kw.term, volume: kw.volume ?? 0, inContent: actuallyInContent, placement: livePlacement });
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
for (const kw of missing) {
|
|
123
|
+
if (kw == null || typeof kw.term !== "string") continue;
|
|
118
124
|
const actuallyInContent = lowerText.includes(kw.term.toLowerCase());
|
|
119
125
|
const livePlacement = computePlacementClient(kw.term, documentText, documentFields);
|
|
120
126
|
merged.push({ term: kw.term, volume: kw.volume ?? 0, inContent: actuallyInContent, reason: kw.reason, placement: livePlacement });
|
|
@@ -173,7 +179,7 @@ function LightbulbButton({ onClick, isLoading }: { onClick: () => void; isLoadin
|
|
|
173
179
|
pointerEvents: "none",
|
|
174
180
|
zIndex: 10,
|
|
175
181
|
}}>
|
|
176
|
-
|
|
182
|
+
See suggestion
|
|
177
183
|
</span>
|
|
178
184
|
)}
|
|
179
185
|
</span>
|
|
@@ -424,6 +430,129 @@ function PrimaryKeywordSelector({
|
|
|
424
430
|
);
|
|
425
431
|
}
|
|
426
432
|
|
|
433
|
+
function SecondaryKeywordSelector({
|
|
434
|
+
options,
|
|
435
|
+
selectedTerm,
|
|
436
|
+
onSelect,
|
|
437
|
+
}: {
|
|
438
|
+
options: { term: string; volume: number | null }[];
|
|
439
|
+
selectedTerm: string;
|
|
440
|
+
onSelect: (term: string) => void;
|
|
441
|
+
}) {
|
|
442
|
+
const [customInputOpen, setCustomInputOpen] = useState(false);
|
|
443
|
+
const [customValue, setCustomValue] = useState("");
|
|
444
|
+
|
|
445
|
+
const handleCustomSubmit = () => {
|
|
446
|
+
const trimmed = customValue.trim();
|
|
447
|
+
if (trimmed) {
|
|
448
|
+
onSelect(trimmed);
|
|
449
|
+
setCustomValue("");
|
|
450
|
+
setCustomInputOpen(false);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
// The selected secondary may be a custom term not present in `options` - append it
|
|
455
|
+
// so the radio still shows as selected. Case-insensitive check so a filtered-out
|
|
456
|
+
// primary (removed via lowercase comparison) is not re-added here.
|
|
457
|
+
const opts = selectedTerm && !options.some((o) => o.term.toLowerCase() === selectedTerm.toLowerCase())
|
|
458
|
+
? [...options, { term: selectedTerm, volume: null }]
|
|
459
|
+
: options;
|
|
460
|
+
|
|
461
|
+
return (
|
|
462
|
+
<div style={cardStyle}>
|
|
463
|
+
<SectionHeader
|
|
464
|
+
label="Secondary Keyword"
|
|
465
|
+
iconColor={MJH_BLUE}
|
|
466
|
+
actionButton={
|
|
467
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
|
468
|
+
<span style={{ fontSize: 9, fontWeight: 700, letterSpacing: "0.05em", textTransform: "uppercase", color: "#9ca3af" }}>Optional</span>
|
|
469
|
+
<PencilButton onClick={() => setCustomInputOpen(!customInputOpen)} active={customInputOpen} />
|
|
470
|
+
</div>
|
|
471
|
+
}
|
|
472
|
+
/>
|
|
473
|
+
|
|
474
|
+
<div style={{ fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 8 }}>
|
|
475
|
+
Pick one more keyword to optimize for. Copilot then checks your title, meta, URL, headings, and images against both keywords.
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
{customInputOpen && (
|
|
479
|
+
<div style={{ marginBottom: 8, display: "flex", gap: 6 }}>
|
|
480
|
+
<input
|
|
481
|
+
type="text"
|
|
482
|
+
value={customValue}
|
|
483
|
+
onChange={(e) => setCustomValue(e.target.value)}
|
|
484
|
+
onKeyDown={(e) => { if (e.key === "Enter") handleCustomSubmit(); }}
|
|
485
|
+
placeholder="Type a custom secondary keyword"
|
|
486
|
+
autoFocus
|
|
487
|
+
style={{ flex: 1, padding: "5px 8px", fontSize: 12, borderRadius: 8, border: "1px solid #e5e7eb", outline: "none", fontFamily: "inherit" }}
|
|
488
|
+
/>
|
|
489
|
+
<button
|
|
490
|
+
onClick={handleCustomSubmit}
|
|
491
|
+
disabled={!customValue.trim()}
|
|
492
|
+
style={{
|
|
493
|
+
padding: "5px 10px", fontSize: 11, fontWeight: 600, borderRadius: 6, border: "none",
|
|
494
|
+
background: customValue.trim() ? MJH_BLUE : "#e5e7eb",
|
|
495
|
+
color: customValue.trim() ? "#ffffff" : "#9ca3af",
|
|
496
|
+
cursor: customValue.trim() ? "pointer" : "not-allowed",
|
|
497
|
+
}}
|
|
498
|
+
>
|
|
499
|
+
Set
|
|
500
|
+
</button>
|
|
501
|
+
</div>
|
|
502
|
+
)}
|
|
503
|
+
|
|
504
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
|
|
505
|
+
{/* None option - secondary is optional */}
|
|
506
|
+
<SecondaryOptionRow term="" label="None" selected={!selectedTerm} onSelect={() => onSelect("")} />
|
|
507
|
+
{opts.map((o) => (
|
|
508
|
+
<SecondaryOptionRow
|
|
509
|
+
key={o.term}
|
|
510
|
+
term={o.term}
|
|
511
|
+
label={o.term}
|
|
512
|
+
volume={o.volume}
|
|
513
|
+
selected={o.term === selectedTerm}
|
|
514
|
+
onSelect={() => onSelect(o.term)}
|
|
515
|
+
/>
|
|
516
|
+
))}
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function SecondaryOptionRow({ term, label, volume, selected, onSelect }: { term: string; label: string; volume?: number | null; selected: boolean; onSelect: () => void }) {
|
|
523
|
+
return (
|
|
524
|
+
<div
|
|
525
|
+
onClick={onSelect}
|
|
526
|
+
style={{
|
|
527
|
+
display: "flex",
|
|
528
|
+
alignItems: "center",
|
|
529
|
+
gap: 8,
|
|
530
|
+
padding: "6px 8px",
|
|
531
|
+
borderRadius: 8,
|
|
532
|
+
cursor: "pointer",
|
|
533
|
+
background: selected ? "rgba(0,93,172,0.06)" : "transparent",
|
|
534
|
+
border: selected ? "1px solid rgba(0,93,172,0.2)" : "1px solid transparent",
|
|
535
|
+
transition: "all 150ms",
|
|
536
|
+
}}
|
|
537
|
+
>
|
|
538
|
+
<div style={{
|
|
539
|
+
width: 14, height: 14, borderRadius: "50%",
|
|
540
|
+
border: selected ? "none" : "2px solid #d1d5db",
|
|
541
|
+
background: selected ? MJH_BLUE : "transparent",
|
|
542
|
+
flexShrink: 0, display: "flex", alignItems: "center", justifyContent: "center",
|
|
543
|
+
}}>
|
|
544
|
+
{selected && <div style={{ width: 6, height: 6, borderRadius: "50%", background: "#ffffff" }} />}
|
|
545
|
+
</div>
|
|
546
|
+
<span style={{ fontSize: 12, fontWeight: selected ? 600 : 400, color: term ? (selected ? "#00468a" : "#374151") : "#6b7280", flex: 1, minWidth: 0 }}>
|
|
547
|
+
{label}
|
|
548
|
+
</span>
|
|
549
|
+
{volume != null && (
|
|
550
|
+
<span style={{ fontSize: 11, fontWeight: 600, color: "#1f2937" }}>{volume === 0 ? "N/A" : `${abbrevVol(volume)}/mo`}</span>
|
|
551
|
+
)}
|
|
552
|
+
</div>
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
|
|
427
556
|
const PLACEMENT_FILTERS: { key: PlacementKey; label: string; letter: string }[] = [
|
|
428
557
|
{ key: "inBody", label: "Body", letter: "B" },
|
|
429
558
|
{ key: "inTitle", label: "Title", letter: "T" },
|
|
@@ -438,8 +567,8 @@ function computePlacementClient(term: string, content: string, fields?: Document
|
|
|
438
567
|
const lower = term.toLowerCase();
|
|
439
568
|
return {
|
|
440
569
|
inBody: content.toLowerCase().includes(lower),
|
|
441
|
-
inTitle: fields?.title
|
|
442
|
-
inMetaDescription: fields?.metaDescription
|
|
570
|
+
inTitle: typeof fields?.title === 'string' ? fields.title.toLowerCase().includes(lower) : false,
|
|
571
|
+
inMetaDescription: typeof fields?.metaDescription === 'string' ? fields.metaDescription.toLowerCase().includes(lower) : false,
|
|
443
572
|
inImages: fields?.imageNames?.some((name: string) => name.toLowerCase().includes(lower)) ?? false,
|
|
444
573
|
inUrl: fields?.slug?.toLowerCase().includes(lower) ?? false,
|
|
445
574
|
};
|
|
@@ -523,7 +652,9 @@ function SuggestedKeywordsCard({
|
|
|
523
652
|
const res = await fetch(`${apiUrl}/api/seo-copilot/keyword-help`, {
|
|
524
653
|
method: "POST",
|
|
525
654
|
headers: { "Content-Type": "application/json" },
|
|
526
|
-
|
|
655
|
+
// Clip to 5,000 chars: the backend only reads the first 4,000 anyway, so sending
|
|
656
|
+
// the full article needlessly bloats the request on long pieces.
|
|
657
|
+
body: JSON.stringify({ keyword: term, content: text.slice(0, 5000), publication, previousSuggestions }),
|
|
527
658
|
});
|
|
528
659
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
529
660
|
const data = await res.json();
|
|
@@ -900,6 +1031,8 @@ export function KeywordPanel({
|
|
|
900
1031
|
seedKeywords = [],
|
|
901
1032
|
onSeedsChange,
|
|
902
1033
|
onSelectPrimary,
|
|
1034
|
+
secondaryKeyword = "",
|
|
1035
|
+
onSelectSecondary,
|
|
903
1036
|
documentFields,
|
|
904
1037
|
documentId,
|
|
905
1038
|
externalAnalysis,
|
|
@@ -935,9 +1068,12 @@ export function KeywordPanel({
|
|
|
935
1068
|
// Auto-update selected term when analysis refreshes (unless user manually picked a different one)
|
|
936
1069
|
useEffect(() => {
|
|
937
1070
|
if (defaultSelectedTerm && defaultSelectedTerm !== prevDefaultRef.current) {
|
|
938
|
-
// Only auto-update if user's current selection was the old default (
|
|
939
|
-
|
|
1071
|
+
// Only auto-update if the user's current selection was the old default (no manual override).
|
|
1072
|
+
// Snapshot the old ref value BEFORE mutating it - the setState updater is queued and runs
|
|
1073
|
+
// after this effect body, so it must compare against the old default, not the new one.
|
|
1074
|
+
const oldDefault = prevDefaultRef.current;
|
|
940
1075
|
prevDefaultRef.current = defaultSelectedTerm;
|
|
1076
|
+
setSelectedPrimaryTerm((prev) => (prev === oldDefault ? defaultSelectedTerm : prev));
|
|
941
1077
|
}
|
|
942
1078
|
}, [defaultSelectedTerm]);
|
|
943
1079
|
|
|
@@ -994,8 +1130,36 @@ export function KeywordPanel({
|
|
|
994
1130
|
? selectedPrimaryTerm
|
|
995
1131
|
: candidates[0]?.term ?? "";
|
|
996
1132
|
|
|
1133
|
+
// Secondary options = same candidate pool as primary + supporting keywords, deduped,
|
|
1134
|
+
// with the currently-active primary filtered out so editors can't pick the same keyword twice.
|
|
1135
|
+
const activeTermLower = activeTerm.toLowerCase();
|
|
1136
|
+
const secondaryOptions: { term: string; volume: number | null }[] = [];
|
|
1137
|
+
const seenSecondary = new Set<string>();
|
|
1138
|
+
for (const c of candidates) {
|
|
1139
|
+
const key = c.term.toLowerCase();
|
|
1140
|
+
if (key === activeTermLower) continue;
|
|
1141
|
+
if (!seenSecondary.has(key)) { seenSecondary.add(key); secondaryOptions.push({ term: c.term, volume: c.volume }); }
|
|
1142
|
+
}
|
|
1143
|
+
for (const kw of suggestedKeywords) {
|
|
1144
|
+
const key = kw.term.toLowerCase();
|
|
1145
|
+
if (key === activeTermLower) continue;
|
|
1146
|
+
if (!seenSecondary.has(key)) { seenSecondary.add(key); secondaryOptions.push({ term: kw.term, volume: kw.volume }); }
|
|
1147
|
+
}
|
|
1148
|
+
|
|
997
1149
|
return (
|
|
998
1150
|
<div style={{ padding: 12, display: "flex", flexDirection: "column", gap: 12 }}>
|
|
1151
|
+
{/* On-page instructions: the two-keyword target process */}
|
|
1152
|
+
<div style={{
|
|
1153
|
+
...cardStyle,
|
|
1154
|
+
padding: "11px 13px",
|
|
1155
|
+
background: "rgba(0,93,172,0.05)",
|
|
1156
|
+
boxShadow: "inset 0 0 0 1px rgba(0,93,172,0.12)",
|
|
1157
|
+
}}>
|
|
1158
|
+
<div style={{ fontSize: 11.5, color: "#1f2937", lineHeight: 1.55 }}>
|
|
1159
|
+
<strong style={{ color: "#00468a" }}>Choose your target keywords.</strong> Pick one <strong>Primary</strong> keyword (required) and, optionally, one <strong>Secondary</strong> keyword. Copilot optimizes the whole article - title, meta, URL, headings, and images - toward both.
|
|
1160
|
+
</div>
|
|
1161
|
+
</div>
|
|
1162
|
+
|
|
999
1163
|
{/* Desired Keywords */}
|
|
1000
1164
|
{onSeedsChange && (
|
|
1001
1165
|
<SeedKeywordInput seeds={seedKeywords} onSeedsChange={onSeedsChange} />
|
|
@@ -1009,6 +1173,15 @@ export function KeywordPanel({
|
|
|
1009
1173
|
publication={publication}
|
|
1010
1174
|
/>
|
|
1011
1175
|
|
|
1176
|
+
{/* Secondary Keyword Selector (optional) */}
|
|
1177
|
+
{onSelectSecondary && secondaryOptions.length > 0 && (
|
|
1178
|
+
<SecondaryKeywordSelector
|
|
1179
|
+
options={secondaryOptions}
|
|
1180
|
+
selectedTerm={secondaryKeyword}
|
|
1181
|
+
onSelect={(term: string) => onSelectSecondary(term)}
|
|
1182
|
+
/>
|
|
1183
|
+
)}
|
|
1184
|
+
|
|
1012
1185
|
{/* Supporting Keywords */}
|
|
1013
1186
|
{suggestedKeywords.length > 0 && (
|
|
1014
1187
|
<SuggestedKeywordsCard
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { MJH_BLUE } from "./styles";
|
|
2
|
+
|
|
3
|
+
// Small (i) button that lives in the panel header next to the pop-out control. The
|
|
4
|
+
// first-run popup collapses into this; clicking it re-opens the popup.
|
|
5
|
+
export function OnboardingInfoButton({ onClick }: { onClick: () => void }) {
|
|
6
|
+
return (
|
|
7
|
+
<button
|
|
8
|
+
onClick={(e) => { e.stopPropagation(); onClick(); }}
|
|
9
|
+
onMouseDown={(e) => e.stopPropagation()}
|
|
10
|
+
style={{
|
|
11
|
+
background: "rgba(0,93,172,0.08)",
|
|
12
|
+
border: "none",
|
|
13
|
+
borderRadius: "50%",
|
|
14
|
+
width: 20,
|
|
15
|
+
height: 20,
|
|
16
|
+
cursor: "pointer",
|
|
17
|
+
padding: 0,
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
color: MJH_BLUE,
|
|
22
|
+
flexShrink: 0,
|
|
23
|
+
}}
|
|
24
|
+
title="How SEO Copilot works"
|
|
25
|
+
aria-label="How SEO Copilot works"
|
|
26
|
+
>
|
|
27
|
+
<svg width="13" height="13" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
28
|
+
<path fillRule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clipRule="evenodd" />
|
|
29
|
+
</svg>
|
|
30
|
+
</button>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// First-run onboarding popup. Amorphous MJH-blue glass. Clicking anywhere on the
|
|
35
|
+
// dimmed backdrop, the X, or "Got it" dismisses it (fades out to the info icon).
|
|
36
|
+
export function OnboardingCard({ onDismiss, closing }: { onDismiss: () => void; closing: boolean }) {
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
{/* Click-anywhere backdrop - very light so it doesn't feel like a hard modal. */}
|
|
40
|
+
<div
|
|
41
|
+
onClick={onDismiss}
|
|
42
|
+
style={{
|
|
43
|
+
position: "absolute",
|
|
44
|
+
inset: 0,
|
|
45
|
+
zIndex: 60,
|
|
46
|
+
background: "transparent",
|
|
47
|
+
cursor: "pointer",
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
<div
|
|
51
|
+
onClick={(e) => e.stopPropagation()}
|
|
52
|
+
style={{
|
|
53
|
+
position: "absolute",
|
|
54
|
+
top: 50,
|
|
55
|
+
right: 10,
|
|
56
|
+
left: 10,
|
|
57
|
+
maxWidth: 320,
|
|
58
|
+
marginLeft: "auto",
|
|
59
|
+
zIndex: 61,
|
|
60
|
+
borderRadius: 18,
|
|
61
|
+
padding: "14px 16px 16px",
|
|
62
|
+
// Amorphous blue glass
|
|
63
|
+
background: "linear-gradient(155deg, rgba(0,93,172,0.16), rgba(0,93,172,0.08))",
|
|
64
|
+
backdropFilter: "blur(20px) saturate(170%)",
|
|
65
|
+
WebkitBackdropFilter: "blur(20px) saturate(170%)",
|
|
66
|
+
boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.55), inset 1.5px 2px 1px -1px rgba(255,255,255,0.9), 0 10px 30px rgba(0,93,172,0.22), 0 2px 8px rgba(0,0,0,0.12)",
|
|
67
|
+
animation: `${closing ? "onboard-out" : "onboard-in"} ${closing ? 200 : 240}ms ease-out forwards`,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }}>
|
|
71
|
+
<span style={{ fontSize: 13, fontWeight: 800, color: "#00468a", letterSpacing: "-0.01em" }}>
|
|
72
|
+
Welcome to SEO Copilot
|
|
73
|
+
</span>
|
|
74
|
+
<button
|
|
75
|
+
onClick={onDismiss}
|
|
76
|
+
style={{ background: "none", border: "none", cursor: "pointer", padding: 2, display: "flex", color: "#00468a", opacity: 1 }}
|
|
77
|
+
title="Dismiss"
|
|
78
|
+
aria-label="Dismiss"
|
|
79
|
+
>
|
|
80
|
+
<svg width="14" height="14" viewBox="0 0 20 20" fill="currentColor">
|
|
81
|
+
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
|
|
82
|
+
</svg>
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
<div style={{ fontSize: 11.5, color: "#13335a", lineHeight: 1.6 }}>
|
|
86
|
+
Start on the <strong>Keywords</strong> tab. Choose one <strong>Primary</strong> keyword (required) and, optionally, one <strong>Secondary</strong> keyword. Copilot then optimizes its recommendations toward both.
|
|
87
|
+
</div>
|
|
88
|
+
<button
|
|
89
|
+
onClick={onDismiss}
|
|
90
|
+
style={{
|
|
91
|
+
marginTop: 12,
|
|
92
|
+
width: "100%",
|
|
93
|
+
padding: "7px 12px",
|
|
94
|
+
fontSize: 11.5,
|
|
95
|
+
fontWeight: 700,
|
|
96
|
+
color: "#ffffff",
|
|
97
|
+
background: MJH_BLUE,
|
|
98
|
+
border: "none",
|
|
99
|
+
borderRadius: 8,
|
|
100
|
+
cursor: "pointer",
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
Got it
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
}
|