PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / admin / analytics / components / modules / previews.js

previews.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/admin/analytics/components/modules/previews.js

451 lines 27.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from "@wordpress/i18n";
2 import React from "react";
3 import { I } from "../common/icons";
4 import { AreaChart, Donut, HBar } from "../common/charts";
5 import { Card, KpiCard, Avatar, authorFromName, cn, fmt } from "../common/ui";
6 import { countryFlag } from "../common/geo";
7
8 /* Static, illustrative sample data for the locked-module previews. Nothing here
9 is fetched — it exists only to render a convincing, design-accurate picture
10 of each Pro module behind the lock panel. */
11
12 const LABELS = [ "1", "3", "5", "7", "9", "11", "13", "15", "17", "19", "21", "23", "25", "27" ];
13 const wave = ( base, amp, n = LABELS.length ) =>
14 Array.from( { length: n }, ( _, i ) => Math.round( base + amp * ( Math.sin( i / 1.7 ) * 0.6 + Math.sin( i / 3.3 ) * 0.4 ) + amp * 0.5 ) );
15
16 const feelingIcon = ( f ) => f === "sad"
17 ? <span className="bda-feed-ico dislike"><I.ThumbsDown size={ 13 } /></span>
18 : f === "comment"
19 ? <span className="bda-feed-ico" style={ { background: "#eff6ff", color: "#2563eb" } }><I.MessageCircle size={ 13 } /></span>
20 : <span className="bda-feed-ico like"><I.ThumbsUp size={ 13 } /></span>;
21
22 /* ── Overview (Free-locked) ──────────────────────────────────────────── */
23 export function OverviewMock() {
24 const arts = [
25 { t: "Getting Started with BetterDocs", v: 4820, u: 3110 },
26 { t: "How to Create Your First Knowledge Base", v: 3760, u: 2540 },
27 { t: "Configuring Live Search", v: 2980, u: 2010 },
28 { t: "Setting Up the FAQ Builder", v: 2210, u: 1640 },
29 { t: "Customizing the Knowledge Base Layout", v: 1870, u: 1290 },
30 { t: "Troubleshooting Permalink Issues", v: 1490, u: 1120 },
31 { t: "Importing Docs from Other Tools", v: 1130, u: 870 }
32 ];
33 const queries = [
34 { q: "installation", c: 486 },
35 { q: "shortcode", c: 372 },
36 { q: "live search", c: 291 },
37 { q: "faq", c: 244 },
38 { q: "elementor", c: 188 },
39 { q: "permalink", c: 141 },
40 { q: "import", c: 97 }
41 ];
42 const recent = [
43 { f: "happy", t: "Getting Started with BetterDocs", d: "2026-06-28" },
44 { f: "sad", t: "Configuring Live Search", d: "2026-06-27" },
45 { f: "happy", t: "Setting Up the FAQ Builder", d: "2026-06-26" },
46 { f: "happy", t: "Importing Docs from Other Tools", d: "2026-06-25" }
47 ];
48 return (
49 <div className="bda-stack">
50 <div className="bda-kpi-grid">
51 <KpiCard label={ __( "Total Views", "betterdocs" ) } value="48.2K" spark={ wave( 1200, 320 ) } delta={ 12.4 } dir={ 1 } icon={ <I.Eye size={ 14 } /> } color="#00b884" />
52 <KpiCard label={ __( "Unique Readers", "betterdocs" ) } value="31.5K" spark={ wave( 900, 240 ) } delta={ 8.1 } dir={ 1 } icon={ <I.Users size={ 14 } /> } color="#3B82F6" />
53 <KpiCard label={ __( "Searches", "betterdocs" ) } value="6.4K" spark={ wave( 220, 70 ) } delta={ 5.2 } dir={ 1 } icon={ <I.Search size={ 14 } /> } color="#F59E0B" />
54 <KpiCard label={ __( "Reactions", "betterdocs" ) } value="1.2K" spark={ wave( 60, 18 ) } delta={ 3.6 } dir={ 1 } icon={ <I.ThumbsUp size={ 14 } /> } color="#8B5CF6" />
55 </div>
56 <div className="bda-grid12">
57 <div className="bda-col8">
58 <Card padded={ false } title={ __( "Top 10 Docs", "betterdocs" ) }>
59 <table className="bda-table bda-table--fixed">
60 <thead><tr>
61 <th style={ { width: 48 } }>#</th>
62 <th>{ __( "Doc", "betterdocs" ) }</th>
63 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Views", "betterdocs" ) }</th>
64 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Unique", "betterdocs" ) }</th>
65 </tr></thead>
66 <tbody>
67 { arts.map( ( a, i ) => (
68 <tr key={ i }>
69 <td><span className={ cn( "bda-rank", i < 3 && "top" ) }>{ i + 1 }</span></td>
70 <td><div className="bda-title-cell">{ a.t }</div></td>
71 <td className="bda-t-right bda-num bda-strong">{ fmt( a.v ) }</td>
72 <td className="bda-t-right bda-num">{ fmt( a.u ) }</td>
73 </tr>
74 ) ) }
75 </tbody>
76 </table>
77 </Card>
78 <Card padded title={ __( "Search Trends", "betterdocs" ) }>
79 <AreaChart labels={ LABELS } series={ [
80 { name: __( "Searches", "betterdocs" ), data: wave( 220, 80 ), color: "#F59E0B" },
81 { name: __( "Zero-results", "betterdocs" ), data: wave( 40, 24 ), color: "#EF4444" }
82 ] } height={ 200 } />
83 </Card>
84 </div>
85 <div className="bda-col4">
86 <Card padded={ false } title={ __( "Top Search Queries", "betterdocs" ) }>
87 <table className="bda-table">
88 <thead><tr><th>{ __( "Query", "betterdocs" ) }</th><th className="bda-t-right">{ __( "Count", "betterdocs" ) }</th></tr></thead>
89 <tbody>
90 { queries.map( ( q, i ) => (
91 <tr key={ i }>
92 <td><span className="bda-strong" style={ { fontWeight: 500 } }>{ q.q }</span></td>
93 <td className="bda-t-right bda-num">{ fmt( q.c ) }</td>
94 </tr>
95 ) ) }
96 </tbody>
97 </table>
98 </Card>
99 <Card title={ __( "Recent Feedback", "betterdocs" ) }>
100 <div style={ { display: "flex", flexDirection: "column", gap: 12 } }>
101 { recent.map( ( f, i ) => (
102 <div key={ i } style={ { display: "flex", gap: 10 } }>
103 { feelingIcon( f.f ) }
104 <div style={ { minWidth: 0 } }>
105 <div className="bda-title-cell" style={ { fontSize: 12.5 } }>{ f.t }</div>
106 <div style={ { fontSize: 11.5, color: "var(--text-color-500)", marginTop: 2 } }>{ f.d }</div>
107 </div>
108 </div>
109 ) ) }
110 </div>
111 </Card>
112 </div>
113 </div>
114 </div>
115 );
116 }
117
118 /* ── Article Performance ─────────────────────────────────────────────── */
119 export function ArticlesMock() {
120 const rows = [
121 { t: "Getting Started with BetterDocs", v: 4820, u: 3110, h: 92 },
122 { t: "How to Create Your First Knowledge Base", v: 3760, u: 2540, h: 88 },
123 { t: "Configuring Live Search", v: 2980, u: 2010, h: 81 },
124 { t: "Setting Up the FAQ Builder", v: 2210, u: 1640, h: 76 },
125 { t: "Troubleshooting Permalink Issues", v: 1490, u: 1120, h: 64 }
126 ];
127 return (
128 <div className="bda-stack">
129 <div className="bda-kpi-grid">
130 <KpiCard label={ __( "Total Views", "betterdocs" ) } value="48.2K" spark={ wave( 1200, 320 ) } delta={ 12.4 } dir={ 1 } icon={ <I.Eye size={ 14 } /> } color="#00b884" />
131 <KpiCard label={ __( "Unique Readers", "betterdocs" ) } value="31.5K" spark={ wave( 900, 240 ) } delta={ 8.1 } dir={ 1 } icon={ <I.Users size={ 14 } /> } color="#3B82F6" />
132 <KpiCard label={ __( "Avg. Read Time", "betterdocs" ) } value="2m 48s" spark={ wave( 160, 30 ) } delta={ -2.3 } dir={ -1 } icon={ <I.Clock size={ 14 } /> } color="#F59E0B" />
133 <KpiCard label={ __( "Helpfulness", "betterdocs" ) } value="84%" spark={ wave( 80, 8 ) } delta={ 3.6 } dir={ 1 } icon={ <I.ThumbsUp size={ 14 } /> } color="#8B5CF6" />
134 </div>
135 <Card padded title={ __( "Views Over Time", "betterdocs" ) }>
136 <AreaChart labels={ LABELS } series={ [ { name: __( "Views", "betterdocs" ), data: wave( 1200, 360 ), color: "#00b884" } ] } height={ 220 } />
137 </Card>
138 <Card padded={ false } title={ __( "Per-Doc Breakdown", "betterdocs" ) }>
139 <table className="bda-table bda-table--fixed">
140 <thead><tr>
141 <th>{ __( "Doc", "betterdocs" ) }</th>
142 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Views", "betterdocs" ) }</th>
143 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Unique", "betterdocs" ) }</th>
144 <th className="bda-t-right" style={ { width: 110 } }>{ __( "Helpful", "betterdocs" ) }</th>
145 </tr></thead>
146 <tbody>
147 { rows.map( ( r, i ) => (
148 <tr key={ i }>
149 <td><div className="bda-title-cell">{ r.t }</div></td>
150 <td className="bda-t-right bda-num bda-strong">{ fmt( r.v ) }</td>
151 <td className="bda-t-right bda-num">{ fmt( r.u ) }</td>
152 <td className="bda-t-right"><span className={ cn( "bda-badge", r.h >= 80 ? "green" : r.h >= 65 ? "amber" : "red" ) }>{ r.h }%</span></td>
153 </tr>
154 ) ) }
155 </tbody>
156 </table>
157 </Card>
158 </div>
159 );
160 }
161
162 /* ── Search Analytics ────────────────────────────────────────────────── */
163 export function SearchMock() {
164 const zero = [
165 { q: "export to pdf", n: 142 },
166 { q: "white label branding", n: 98 },
167 { q: "multi language docs", n: 76 },
168 { q: "slack integration", n: 54 },
169 { q: "api rate limits", n: 31 }
170 ];
171 return (
172 <div className="bda-stack">
173 <div className="bda-kpi-grid cols-3">
174 <KpiCard label={ __( "Total Searches", "betterdocs" ) } value="12.4K" spark={ wave( 400, 120 ) } delta={ 18.2 } dir={ 1 } icon={ <I.Search size={ 14 } /> } color="#00b884" />
175 <KpiCard label={ __( "Unique Queries", "betterdocs" ) } value="3.8K" spark={ wave( 120, 40 ) } delta={ 6.5 } dir={ 1 } icon={ <I.TrendingUp size={ 14 } /> } color="#3B82F6" />
176 <KpiCard label={ __( "Zero-Result Rate", "betterdocs" ) } value="9.7%" spark={ wave( 40, 10 ) } delta={ -4.1 } dir={ -1 } icon={ <I.AlertCircle size={ 14 } /> } color="#EF4444" />
177 </div>
178 <Card padded title={ __( "Searches vs. Zero-Results", "betterdocs" ) }>
179 <AreaChart labels={ LABELS } height={ 220 } series={ [
180 { name: __( "Searches", "betterdocs" ), data: wave( 420, 130 ), color: "#00b884" },
181 { name: __( "Zero-results", "betterdocs" ), data: wave( 70, 28 ), color: "#EF4444" }
182 ] } />
183 </Card>
184 <Card padded={ false } title={ __( "Top Zero-Result Queries", "betterdocs" ) }>
185 <table className="bda-table">
186 <thead><tr><th>{ __( "Query", "betterdocs" ) }</th><th className="bda-t-right">{ __( "Searches", "betterdocs" ) }</th></tr></thead>
187 <tbody>
188 { zero.map( ( r, i ) => (
189 <tr key={ i }>
190 <td><span className="bda-strong" style={ { fontWeight: 500 } }>{ r.q }</span></td>
191 <td className="bda-t-right bda-num">{ fmt( r.n ) }</td>
192 </tr>
193 ) ) }
194 </tbody>
195 </table>
196 </Card>
197 </div>
198 );
199 }
200
201 /* ── Reader Engagement ───────────────────────────────────────────────── */
202 export function EngagementMock() {
203 const countries = [
204 { code: "US", v: 4280 }, { code: "GB", v: 2140 }, { code: "DE", v: 1620 },
205 { code: "IN", v: 1390 }, { code: "CA", v: 980 }, { code: "AU", v: 720 }
206 ];
207 const langs = [ { l: "English (en)", p: 68 }, { l: "Spanish (es)", p: 12 }, { l: "German (de)", p: 9 }, { l: "French (fr)", p: 6 } ];
208 return (
209 <div className="bda-stack">
210 <div className="bda-grid12">
211 <div className="bda-col4">
212 <Card padded title={ __( "Devices", "betterdocs" ) }>
213 <div style={ { display: "flex", justifyContent: "center", padding: "8px 0" } }>
214 <Donut size={ 180 } thickness={ 26 } centerValue="62%" centerLabel={ __( "Desktop", "betterdocs" ) } segments={ [
215 { value: 62, color: "#00b884" }, { value: 30, color: "#3B82F6" }, { value: 8, color: "#F59E0B" }
216 ] } />
217 </div>
218 </Card>
219 </div>
220 <div className="bda-col8">
221 <Card padded title={ __( "Top Countries", "betterdocs" ) }>
222 <HBar items={ countries.map( ( c ) => ( { name: `${ countryFlag( c.code ) } ${ c.code }`, value: c.v } ) ) } format={ fmt } />
223 </Card>
224 <Card padded title={ __( "Languages", "betterdocs" ) }>
225 <HBar items={ langs.map( ( x ) => ( { name: x.l, value: x.p } ) ) } max={ 100 } color="#3B82F6" format={ ( v ) => `${ v }%` } />
226 </Card>
227 </div>
228 </div>
229 </div>
230 );
231 }
232
233 /* ── Feedback Inbox ──────────────────────────────────────────────────── */
234 export function FeedbackMock() {
235 const feed = [
236 { f: "happy", t: "Getting Started with BetterDocs", note: __( "Clear and to the point — solved my issue.", "betterdocs" ), d: "2026-05-28" },
237 { f: "sad", t: "Configuring Live Search", note: __( "Couldn't find how to change the result limit.", "betterdocs" ), d: "2026-05-27" },
238 { f: "comment", t: "Setting Up the FAQ Builder", note: __( "Would love drag-and-drop reordering here.", "betterdocs" ), d: "2026-05-27" },
239 { f: "happy", t: "How to Create Your First KB", note: __( "The screenshots made this really easy.", "betterdocs" ), d: "2026-05-26" },
240 { f: "sad", t: "Troubleshooting Permalinks", note: __( "Still 404ing after flushing rewrites.", "betterdocs" ), d: "2026-05-25" }
241 ];
242 return (
243 <div className="bda-stack">
244 <div className="bda-kpi-grid cols-3">
245 <KpiCard label={ __( "Likes", "betterdocs" ) } value="1,284" delta={ 9.2 } dir={ 1 } icon={ <I.ThumbsUp size={ 14 } /> } color="#00b884" />
246 <KpiCard label={ __( "Dislikes", "betterdocs" ) } value="146" delta={ -3.4 } dir={ -1 } icon={ <I.ThumbsDown size={ 14 } /> } color="#EF4444" />
247 <KpiCard label={ __( "Comments", "betterdocs" ) } value="372" delta={ 14.0 } dir={ 1 } icon={ <I.MessageCircle size={ 14 } /> } color="#3B82F6" />
248 </div>
249 <Card padded={ false } title={ __( "Recent Feedback", "betterdocs" ) }>
250 <div className="bda-feed">
251 { feed.map( ( f, i ) => (
252 <div key={ i } className="bda-feed-row">
253 { feelingIcon( f.f ) }
254 <div style={ { minWidth: 0, flex: 1 } }>
255 <div className="bda-title-cell">{ f.t }</div>
256 <div style={ { fontSize: 12.5, color: "var(--text-color-850)", marginTop: 3 } }>{ f.note }</div>
257 </div>
258 <div style={ { fontSize: 11.5, color: "var(--text-color-500)", whiteSpace: "nowrap" } }>{ f.d }</div>
259 </div>
260 ) ) }
261 </div>
262 </Card>
263 </div>
264 );
265 }
266
267 /* ── Link Health ─────────────────────────────────────────────────────── */
268 export function LinksMock() {
269 const links = [
270 { u: "/docs/getting-started", l: "https://old.example.com/setup", s: 404 },
271 { u: "/docs/live-search", l: "http://legacy.site/search-api", s: 301 },
272 { u: "/docs/faq-builder", l: "https://cdn.broken.io/img/diagram.png", s: 404 },
273 { u: "/docs/permalinks", l: "https://example.org/moved-page", s: 302 }
274 ];
275 const badge = ( s ) => s >= 400 ? "red" : "amber";
276 return (
277 <div className="bda-stack">
278 <div className="bda-kpi-grid cols-3">
279 <KpiCard label={ __( "Broken Links", "betterdocs" ) } value="18" delta={ -22.0 } dir={ -1 } icon={ <I.AlertTriangle size={ 14 } /> } color="#EF4444" />
280 <KpiCard label={ __( "Redirects", "betterdocs" ) } value="42" delta={ 1.2 } dir={ 1 } icon={ <I.Link size={ 14 } /> } color="#F59E0B" />
281 <KpiCard label={ __( "Links Checked", "betterdocs" ) } value="1,906" delta={ 5.8 } dir={ 1 } icon={ <I.Check size={ 14 } /> } color="#00b884" />
282 </div>
283 <Card padded={ false } title={ __( "Broken & Redirected Links", "betterdocs" ) }>
284 <table className="bda-table bda-table--fixed">
285 <thead><tr>
286 <th>{ __( "Doc", "betterdocs" ) }</th>
287 <th>{ __( "Link", "betterdocs" ) }</th>
288 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Status", "betterdocs" ) }</th>
289 </tr></thead>
290 <tbody>
291 { links.map( ( r, i ) => (
292 <tr key={ i }>
293 <td><div className="bda-title-cell">{ r.u }</div></td>
294 <td><div className="bda-title-cell" style={ { color: "var(--text-color-600)" } }>{ r.l }</div></td>
295 <td className="bda-t-right"><span className={ cn( "bda-badge", badge( r.s ) ) }>{ r.s }</span></td>
296 </tr>
297 ) ) }
298 </tbody>
299 </table>
300 </Card>
301 </div>
302 );
303 }
304
305 /* ── Author Performance ──────────────────────────────────────────────── */
306 export function AuthorsMock() {
307 const authors = [
308 { n: "Sarah Chen", a: 24, v: 18400, h: 91 },
309 { n: "Marcus Reid", a: 18, v: 13250, h: 86 },
310 { n: "Aisha Khan", a: 15, v: 9870, h: 83 },
311 { n: "Tom Becker", a: 11, v: 6420, h: 74 }
312 ];
313 return (
314 <div className="bda-stack">
315 <Card padded={ false } title={ __( "Contribution & Reception", "betterdocs" ) }>
316 <table className="bda-table bda-table--fixed">
317 <thead><tr>
318 <th>{ __( "Author", "betterdocs" ) }</th>
319 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Docs", "betterdocs" ) }</th>
320 <th className="bda-t-right" style={ { width: 100 } }>{ __( "Views", "betterdocs" ) }</th>
321 <th className="bda-t-right" style={ { width: 110 } }>{ __( "Helpful", "betterdocs" ) }</th>
322 </tr></thead>
323 <tbody>
324 { authors.map( ( r, i ) => (
325 <tr key={ i }>
326 <td>
327 <div style={ { display: "flex", alignItems: "center", gap: 10 } }>
328 <Avatar author={ authorFromName( r.n ) } size={ 26 } />
329 <span className="bda-strong">{ r.n }</span>
330 </div>
331 </td>
332 <td className="bda-t-right bda-num">{ r.a }</td>
333 <td className="bda-t-right bda-num bda-strong">{ fmt( r.v ) }</td>
334 <td className="bda-t-right"><span className={ cn( "bda-badge", r.h >= 80 ? "green" : "amber" ) }>{ r.h }%</span></td>
335 </tr>
336 ) ) }
337 </tbody>
338 </table>
339 </Card>
340 </div>
341 );
342 }
343
344 /* ── AI Traffic ──────────────────────────────────────────────────────── */
345 export function AiTrafficMock() {
346 const agents = [
347 { n: "ChatGPT", v: 4820, c: "#10a37f" },
348 { n: "Claude", v: 3110, c: "#d97757" },
349 { n: "Perplexity", v: 2240, c: "#20808d" },
350 { n: "Gemini", v: 1680, c: "#4285f4" },
351 { n: "Bing AI", v: 940, c: "#0078d4" }
352 ];
353 const pages = [
354 { t: "Getting Started with BetterDocs", a: "ChatGPT", f: 1840, h: 920 },
355 { t: "How to Create Your First Knowledge Base", a: "Claude", f: 1320, h: 1510 },
356 { t: "Configuring Live Search", a: "Perplexity", f: 980, h: 740 },
357 { t: "Setting Up the FAQ Builder", a: "ChatGPT", f: 760, h: 1180 },
358 { t: "Troubleshooting Permalink Issues", a: "Gemini", f: 540, h: 1320 }
359 ];
360 return (
361 <div className="bda-stack">
362 <div className="bda-kpi-grid">
363 <KpiCard label={ __( "AI Fetches", "betterdocs" ) } value="12.8K" spark={ wave( 380, 140 ) } delta={ 31.2 } dir={ 1 } icon={ <I.TrendingUp size={ 14 } /> } color="#00b884" />
364 <KpiCard label={ __( "AI Agents", "betterdocs" ) } value="15" spark={ wave( 12, 4 ) } delta={ 25.0 } dir={ 1 } icon={ <I.Users size={ 14 } /> } color="#8B5CF6" />
365 <KpiCard label={ __( "AI : Human", "betterdocs" ) } value="0.45" spark={ wave( 40, 12 ) } delta={ 18.4 } dir={ 1 } icon={ <I.PieChart size={ 14 } /> } color="#3B82F6" />
366 <KpiCard label={ __( "Visibility Score", "betterdocs" ) } value="87" spark={ wave( 80, 6 ) } delta={ 4.0 } dir={ 1 } icon={ <I.ChartLine size={ 14 } /> } color="#F59E0B" />
367 </div>
368 <div className="bda-grid12">
369 <div className="bda-col4">
370 <Card padded title={ __( "Agent Distribution", "betterdocs" ) }>
371 <div style={ { display: "flex", justifyContent: "center", padding: "8px 0" } }>
372 <Donut size={ 180 } thickness={ 26 } centerValue="31%" centerLabel={ __( "AI share", "betterdocs" ) }
373 segments={ agents.map( ( a ) => ( { value: a.v, color: a.c } ) ) } />
374 </div>
375 </Card>
376 </div>
377 <div className="bda-col8">
378 <Card padded title={ __( "Top Agents", "betterdocs" ) }>
379 <HBar items={ agents.map( ( a ) => ( { name: a.n, value: a.v, color: a.c } ) ) } format={ fmt } />
380 </Card>
381 </div>
382 </div>
383 <Card padded title={ __( "AI Traffic Over Time", "betterdocs" ) }>
384 <AreaChart labels={ LABELS } height={ 220 } series={ [
385 { name: __( "Human visits", "betterdocs" ), data: wave( 980, 220 ), color: "#CBD5E1" },
386 { name: __( "AI fetches", "betterdocs" ), data: wave( 420, 160 ), color: "#00b884" }
387 ] } />
388 </Card>
389 <Card padded={ false } title={ __( "Most-Fetched Docs by AI", "betterdocs" ) }>
390 <table className="bda-table bda-table--fixed">
391 <thead><tr>
392 <th>{ __( "Doc", "betterdocs" ) }</th>
393 <th style={ { width: 120 } }>{ __( "Top agent", "betterdocs" ) }</th>
394 <th className="bda-t-right" style={ { width: 100 } }>{ __( "AI fetches", "betterdocs" ) }</th>
395 <th className="bda-t-right" style={ { width: 90 } }>{ __( "Human", "betterdocs" ) }</th>
396 </tr></thead>
397 <tbody>
398 { pages.map( ( r, i ) => (
399 <tr key={ i }>
400 <td><div className="bda-title-cell">{ r.t }</div></td>
401 <td><span className="bda-strong" style={ { fontWeight: 500 } }>{ r.a }</span></td>
402 <td className="bda-t-right bda-num bda-strong">{ fmt( r.f ) }</td>
403 <td className="bda-t-right bda-num">{ fmt( r.h ) }</td>
404 </tr>
405 ) ) }
406 </tbody>
407 </table>
408 </Card>
409 </div>
410 );
411 }
412
413 /* ── Analytics Settings ──────────────────────────────────────────────── */
414 function MockToggle( { on } ) {
415 return (
416 <span className={ cn( "bda-mock-toggle", on && "on" ) }><span className="bda-mock-knob" /></span>
417 );
418 }
419 export function SettingsMock() {
420 const rows = [
421 { l: __( "Cookieless tracking", "betterdocs" ), d: __( "Measure visits without setting cookies.", "betterdocs" ), on: true },
422 { l: __( "MaxMind GeoIP", "betterdocs" ), d: __( "Resolve reader country from IP.", "betterdocs" ), on: true },
423 { l: __( "GA4 forwarding", "betterdocs" ), d: __( "Mirror events to Google Analytics 4.", "betterdocs" ), on: false },
424 { l: __( "Bot exclusion", "betterdocs" ), d: __( "Filter known crawlers from analytics.", "betterdocs" ), on: true }
425 ];
426 return (
427 <div className="bda-stack">
428 <Card padded title={ __( "Privacy & Integrations", "betterdocs" ) }>
429 <div style={ { display: "flex", flexDirection: "column" } }>
430 { rows.map( ( r, i ) => (
431 <div key={ i } className="bda-mock-setting">
432 <div style={ { minWidth: 0 } }>
433 <div className="bda-strong" style={ { fontSize: 13.5 } }>{ r.l }</div>
434 <div style={ { fontSize: 12.5, color: "var(--text-color-600)", marginTop: 2 } }>{ r.d }</div>
435 </div>
436 <MockToggle on={ r.on } />
437 </div>
438 ) ) }
439 <div className="bda-mock-setting">
440 <div style={ { minWidth: 0 } }>
441 <div className="bda-strong" style={ { fontSize: 13.5 } }>{ __( "Data retention", "betterdocs" ) }</div>
442 <div style={ { fontSize: 12.5, color: "var(--text-color-600)", marginTop: 2 } }>{ __( "How long to keep raw analytics events.", "betterdocs" ) }</div>
443 </div>
444 <span className="bda-badge slate">{ __( "365 days", "betterdocs" ) }</span>
445 </div>
446 </div>
447 </Card>
448 </div>
449 );
450 }
451