sanity-plugin-seo-copilot 0.1.1 → 0.2.0

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.
@@ -1,76 +1,80 @@
1
- import { useState } from "react";
2
- import type { KeywordPlacement } from "../lib/types";
3
-
4
- interface PlacementIndicatorsProps {
5
- placement?: KeywordPlacement;
6
- }
7
-
8
- const indicators = [
9
- { key: "inBody" as const, letter: "B", tooltip: "Keyword in body" },
10
- { key: "inTitle" as const, letter: "T", tooltip: "Keyword in title" },
11
- { key: "inMetaDescription" as const, letter: "D", tooltip: "Keyword in meta description" },
12
- { key: "inImages" as const, letter: "I", tooltip: "Keyword in image names" },
13
- { key: "inUrl" as const, letter: "U", tooltip: "Keyword in URL" },
14
- ];
15
-
16
- function IndicatorDot({ letter, active, tooltip }: { letter: string; active: boolean; tooltip: string }) {
17
- const [hovered, setHovered] = useState(false);
18
-
19
- return (
20
- <span
21
- onMouseEnter={() => setHovered(true)}
22
- onMouseLeave={() => setHovered(false)}
23
- style={{
24
- position: "relative",
25
- display: "inline-flex",
26
- alignItems: "center",
27
- justifyContent: "center",
28
- width: 16,
29
- height: 16,
30
- borderRadius: "50%",
31
- fontSize: 8,
32
- fontWeight: 700,
33
- lineHeight: 1,
34
- cursor: "default",
35
- flexShrink: 0,
36
- background: active ? "#16a34a" : "transparent",
37
- color: active ? "#ffffff" : "#d1d5db",
38
- border: active ? "none" : "1.5px solid #d1d5db",
39
- transition: "all 150ms",
40
- }}
41
- >
42
- {letter}
43
- {hovered && (
44
- <span style={{
45
- position: "absolute",
46
- bottom: "100%",
47
- left: "50%",
48
- transform: "translateX(-50%)",
49
- marginBottom: 4,
50
- padding: "2px 6px",
51
- borderRadius: 4,
52
- background: "#1f2937",
53
- color: "#ffffff",
54
- fontSize: 10,
55
- whiteSpace: "nowrap",
56
- pointerEvents: "none",
57
- zIndex: 10,
58
- }}>
59
- {tooltip}
60
- </span>
61
- )}
62
- </span>
63
- );
64
- }
65
-
66
- export function PlacementIndicators({ placement }: PlacementIndicatorsProps) {
67
- if (!placement) return null;
68
-
69
- return (
70
- <div style={{ display: "flex", alignItems: "center", gap: 2 }}>
71
- {indicators.map(({ key, letter, tooltip }) => (
72
- <IndicatorDot key={key} letter={letter} active={placement[key]} tooltip={tooltip} />
73
- ))}
74
- </div>
75
- );
76
- }
1
+ import { useState } from "react";
2
+ import type { KeywordPlacement } from "../lib/types";
3
+
4
+ interface PlacementIndicatorsProps {
5
+ placement?: KeywordPlacement;
6
+ }
7
+
8
+ const indicators = [
9
+ { key: "inBody" as const, letter: "B", tooltip: "Keyword in body" },
10
+ { key: "inTitle" as const, letter: "T", tooltip: "Keyword in title" },
11
+ { key: "inMetaDescription" as const, letter: "D", tooltip: "Keyword in meta description" },
12
+ { key: "inImages" as const, letter: "I", tooltip: "Keyword in image names" },
13
+ { key: "inUrl" as const, letter: "U", tooltip: "Keyword in URL" },
14
+ ];
15
+
16
+ function IndicatorDot({ letter, active, tooltip }: { letter: string; active: boolean; tooltip: string }) {
17
+ const [hovered, setHovered] = useState(false);
18
+
19
+ return (
20
+ <span
21
+ onMouseEnter={() => setHovered(true)}
22
+ onMouseLeave={() => setHovered(false)}
23
+ style={{
24
+ position: "relative",
25
+ display: "inline-flex",
26
+ alignItems: "center",
27
+ justifyContent: "center",
28
+ width: 16,
29
+ height: 16,
30
+ borderRadius: "50%",
31
+ fontSize: 8,
32
+ fontWeight: 700,
33
+ lineHeight: 1,
34
+ cursor: "default",
35
+ flexShrink: 0,
36
+ // Inactive = a solid WHITE disc (was a near-invisible faint-grey ring on
37
+ // transparent) so each indicator reads clearly on the warm panel; a light
38
+ // edge + soft lift keep it defined even on a white card. Active = green.
39
+ background: active ? "#16a34a" : "#ffffff",
40
+ color: active ? "#ffffff" : "#94a3b8",
41
+ border: active ? "none" : "1.5px solid #cbd5e1",
42
+ boxShadow: active ? "none" : "0 1px 2px rgba(0,0,0,0.07)",
43
+ transition: "all 150ms",
44
+ }}
45
+ >
46
+ {letter}
47
+ {hovered && (
48
+ <span style={{
49
+ position: "absolute",
50
+ bottom: "100%",
51
+ left: "50%",
52
+ transform: "translateX(-50%)",
53
+ marginBottom: 4,
54
+ padding: "2px 6px",
55
+ borderRadius: 4,
56
+ background: "#1f2937",
57
+ color: "#ffffff",
58
+ fontSize: 10,
59
+ whiteSpace: "nowrap",
60
+ pointerEvents: "none",
61
+ zIndex: 10,
62
+ }}>
63
+ {tooltip}
64
+ </span>
65
+ )}
66
+ </span>
67
+ );
68
+ }
69
+
70
+ export function PlacementIndicators({ placement }: PlacementIndicatorsProps) {
71
+ if (!placement) return null;
72
+
73
+ return (
74
+ <div style={{ display: "flex", alignItems: "center", gap: 2 }}>
75
+ {indicators.map(({ key, letter, tooltip }) => (
76
+ <IndicatorDot key={key} letter={letter} active={placement[key]} tooltip={tooltip} />
77
+ ))}
78
+ </div>
79
+ );
80
+ }