import { __ } from "@wordpress/i18n";
import React from "react";
import { I } from "../common/icons";
import { AreaChart, Donut, HBar } from "../common/charts";
import { Card, KpiCard, Avatar, authorFromName, cn, fmt } from "../common/ui";
import { countryFlag } from "../common/geo";
/* Static, illustrative sample data for the locked-module previews. Nothing here
is fetched — it exists only to render a convincing, design-accurate picture
of each Pro module behind the lock panel. */
const LABELS = [ "1", "3", "5", "7", "9", "11", "13", "15", "17", "19", "21", "23", "25", "27" ];
const wave = ( base, amp, n = LABELS.length ) =>
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 ) );
const feelingIcon = ( f ) => f === "sad"
?
: f === "comment"
?
: ;
/* ── Overview (Free-locked) ──────────────────────────────────────────── */
export function OverviewMock() {
const arts = [
{ t: "Getting Started with BetterDocs", v: 4820, u: 3110 },
{ t: "How to Create Your First Knowledge Base", v: 3760, u: 2540 },
{ t: "Configuring Live Search", v: 2980, u: 2010 },
{ t: "Setting Up the FAQ Builder", v: 2210, u: 1640 },
{ t: "Customizing the Knowledge Base Layout", v: 1870, u: 1290 },
{ t: "Troubleshooting Permalink Issues", v: 1490, u: 1120 },
{ t: "Importing Docs from Other Tools", v: 1130, u: 870 }
];
const queries = [
{ q: "installation", c: 486 },
{ q: "shortcode", c: 372 },
{ q: "live search", c: 291 },
{ q: "faq", c: 244 },
{ q: "elementor", c: 188 },
{ q: "permalink", c: 141 },
{ q: "import", c: 97 }
];
const recent = [
{ f: "happy", t: "Getting Started with BetterDocs", d: "2026-06-28" },
{ f: "sad", t: "Configuring Live Search", d: "2026-06-27" },
{ f: "happy", t: "Setting Up the FAQ Builder", d: "2026-06-26" },
{ f: "happy", t: "Importing Docs from Other Tools", d: "2026-06-25" }
];
return (
} color="#00b884" />
} color="#3B82F6" />
} color="#F59E0B" />
} color="#8B5CF6" />
| # |
{ __( "Doc", "betterdocs" ) } |
{ __( "Views", "betterdocs" ) } |
{ __( "Unique", "betterdocs" ) } |
{ arts.map( ( a, i ) => (
| { i + 1 } |
{ a.t } |
{ fmt( a.v ) } |
{ fmt( a.u ) } |
) ) }
| { __( "Query", "betterdocs" ) } | { __( "Count", "betterdocs" ) } |
{ queries.map( ( q, i ) => (
| { q.q } |
{ fmt( q.c ) } |
) ) }
{ recent.map( ( f, i ) => (
) ) }
);
}
/* ── Article Performance ─────────────────────────────────────────────── */
export function ArticlesMock() {
const rows = [
{ t: "Getting Started with BetterDocs", v: 4820, u: 3110, h: 92 },
{ t: "How to Create Your First Knowledge Base", v: 3760, u: 2540, h: 88 },
{ t: "Configuring Live Search", v: 2980, u: 2010, h: 81 },
{ t: "Setting Up the FAQ Builder", v: 2210, u: 1640, h: 76 },
{ t: "Troubleshooting Permalink Issues", v: 1490, u: 1120, h: 64 }
];
return (
} color="#00b884" />
} color="#3B82F6" />
} color="#F59E0B" />
} color="#8B5CF6" />
| { __( "Doc", "betterdocs" ) } |
{ __( "Views", "betterdocs" ) } |
{ __( "Unique", "betterdocs" ) } |
{ __( "Helpful", "betterdocs" ) } |
{ rows.map( ( r, i ) => (
{ r.t } |
{ fmt( r.v ) } |
{ fmt( r.u ) } |
= 80 ? "green" : r.h >= 65 ? "amber" : "red" ) }>{ r.h }% |
) ) }
);
}
/* ── Search Analytics ────────────────────────────────────────────────── */
export function SearchMock() {
const zero = [
{ q: "export to pdf", n: 142 },
{ q: "white label branding", n: 98 },
{ q: "multi language docs", n: 76 },
{ q: "slack integration", n: 54 },
{ q: "api rate limits", n: 31 }
];
return (
} color="#00b884" />
} color="#3B82F6" />
} color="#EF4444" />
| { __( "Query", "betterdocs" ) } | { __( "Searches", "betterdocs" ) } |
{ zero.map( ( r, i ) => (
| { r.q } |
{ fmt( r.n ) } |
) ) }
);
}
/* ── Reader Engagement ───────────────────────────────────────────────── */
export function EngagementMock() {
const countries = [
{ code: "US", v: 4280 }, { code: "GB", v: 2140 }, { code: "DE", v: 1620 },
{ code: "IN", v: 1390 }, { code: "CA", v: 980 }, { code: "AU", v: 720 }
];
const langs = [ { l: "English (en)", p: 68 }, { l: "Spanish (es)", p: 12 }, { l: "German (de)", p: 9 }, { l: "French (fr)", p: 6 } ];
return (
( { name: `${ countryFlag( c.code ) } ${ c.code }`, value: c.v } ) ) } format={ fmt } />
( { name: x.l, value: x.p } ) ) } max={ 100 } color="#3B82F6" format={ ( v ) => `${ v }%` } />
);
}
/* ── Feedback Inbox ──────────────────────────────────────────────────── */
export function FeedbackMock() {
const feed = [
{ f: "happy", t: "Getting Started with BetterDocs", note: __( "Clear and to the point — solved my issue.", "betterdocs" ), d: "2026-05-28" },
{ f: "sad", t: "Configuring Live Search", note: __( "Couldn't find how to change the result limit.", "betterdocs" ), d: "2026-05-27" },
{ f: "comment", t: "Setting Up the FAQ Builder", note: __( "Would love drag-and-drop reordering here.", "betterdocs" ), d: "2026-05-27" },
{ f: "happy", t: "How to Create Your First KB", note: __( "The screenshots made this really easy.", "betterdocs" ), d: "2026-05-26" },
{ f: "sad", t: "Troubleshooting Permalinks", note: __( "Still 404ing after flushing rewrites.", "betterdocs" ), d: "2026-05-25" }
];
return (
} color="#00b884" />
} color="#EF4444" />
} color="#3B82F6" />
{ feed.map( ( f, i ) => (
{ feelingIcon( f.f ) }
{ f.d }
) ) }
);
}
/* ── Link Health ─────────────────────────────────────────────────────── */
export function LinksMock() {
const links = [
{ u: "/docs/getting-started", l: "https://old.example.com/setup", s: 404 },
{ u: "/docs/live-search", l: "http://legacy.site/search-api", s: 301 },
{ u: "/docs/faq-builder", l: "https://cdn.broken.io/img/diagram.png", s: 404 },
{ u: "/docs/permalinks", l: "https://example.org/moved-page", s: 302 }
];
const badge = ( s ) => s >= 400 ? "red" : "amber";
return (
} color="#EF4444" />
} color="#F59E0B" />
} color="#00b884" />
| { __( "Doc", "betterdocs" ) } |
{ __( "Link", "betterdocs" ) } |
{ __( "Status", "betterdocs" ) } |
{ links.map( ( r, i ) => (
{ r.u } |
{ r.l } |
{ r.s } |
) ) }
);
}
/* ── Author Performance ──────────────────────────────────────────────── */
export function AuthorsMock() {
const authors = [
{ n: "Sarah Chen", a: 24, v: 18400, h: 91 },
{ n: "Marcus Reid", a: 18, v: 13250, h: 86 },
{ n: "Aisha Khan", a: 15, v: 9870, h: 83 },
{ n: "Tom Becker", a: 11, v: 6420, h: 74 }
];
return (
| { __( "Author", "betterdocs" ) } |
{ __( "Docs", "betterdocs" ) } |
{ __( "Views", "betterdocs" ) } |
{ __( "Helpful", "betterdocs" ) } |
{ authors.map( ( r, i ) => (
|
|
{ r.a } |
{ fmt( r.v ) } |
= 80 ? "green" : "amber" ) }>{ r.h }% |
) ) }
);
}
/* ── AI Traffic ──────────────────────────────────────────────────────── */
export function AiTrafficMock() {
const agents = [
{ n: "ChatGPT", v: 4820, c: "#10a37f" },
{ n: "Claude", v: 3110, c: "#d97757" },
{ n: "Perplexity", v: 2240, c: "#20808d" },
{ n: "Gemini", v: 1680, c: "#4285f4" },
{ n: "Bing AI", v: 940, c: "#0078d4" }
];
const pages = [
{ t: "Getting Started with BetterDocs", a: "ChatGPT", f: 1840, h: 920 },
{ t: "How to Create Your First Knowledge Base", a: "Claude", f: 1320, h: 1510 },
{ t: "Configuring Live Search", a: "Perplexity", f: 980, h: 740 },
{ t: "Setting Up the FAQ Builder", a: "ChatGPT", f: 760, h: 1180 },
{ t: "Troubleshooting Permalink Issues", a: "Gemini", f: 540, h: 1320 }
];
return (
} color="#00b884" />
} color="#8B5CF6" />
} color="#3B82F6" />
} color="#F59E0B" />
( { value: a.v, color: a.c } ) ) } />
( { name: a.n, value: a.v, color: a.c } ) ) } format={ fmt } />
| { __( "Doc", "betterdocs" ) } |
{ __( "Top agent", "betterdocs" ) } |
{ __( "AI fetches", "betterdocs" ) } |
{ __( "Human", "betterdocs" ) } |
{ pages.map( ( r, i ) => (
{ r.t } |
{ r.a } |
{ fmt( r.f ) } |
{ fmt( r.h ) } |
) ) }
);
}
/* ── Analytics Settings ──────────────────────────────────────────────── */
function MockToggle( { on } ) {
return (
);
}
export function SettingsMock() {
const rows = [
{ l: __( "Cookieless tracking", "betterdocs" ), d: __( "Measure visits without setting cookies.", "betterdocs" ), on: true },
{ l: __( "MaxMind GeoIP", "betterdocs" ), d: __( "Resolve reader country from IP.", "betterdocs" ), on: true },
{ l: __( "GA4 forwarding", "betterdocs" ), d: __( "Mirror events to Google Analytics 4.", "betterdocs" ), on: false },
{ l: __( "Bot exclusion", "betterdocs" ), d: __( "Filter known crawlers from analytics.", "betterdocs" ), on: true }
];
return (
{ rows.map( ( r, i ) => (
) ) }
{ __( "Data retention", "betterdocs" ) }
{ __( "How long to keep raw analytics events.", "betterdocs" ) }
{ __( "365 days", "betterdocs" ) }
);
}