import { __ } from "@wordpress/i18n";
import React from "react";
import { I } from "../../analytics/components/common/icons";
import { Badge, Card } from "../../analytics/components/common/ui";
import { FauxBtn } from "./primitives";
/**
* Inert mock of Pro's Content Gaps screen
* (betterdocs-pro/react-src/admin/content-intelligence/views/GapsView.js):
* the explainer banner, then one card per detected topic carrying its
* provenance + confidence badges, the demand meter, the reader queries that
* evidence it, and the AI-drafted article suggestion.
*/
// 5-segment demand meter, same construction as Pro's.
function DemandMeter( { value } ) {
const filled = Math.round( ( Math.max( 0, Math.min( 100, value ) ) / 100 ) * 5 );
return (
{ [ 0, 1, 2, 3, 4 ].map( ( i ) => (
) ) }
);
}
/* Invented gaps of the kind this module actually surfaces: a question readers
ask in several different wordings that no article answers. */
const GAPS = [
{
semantic: true,
confidence: __( "High confidence", "betterdocs" ),
color: "green",
topic: "SSO login errors",
volume: 384,
phrasings: 6,
demand: 94,
queries: [ "sso login error", "saml authentication failed", "okta sign in loop", "single sign-on not working" ],
suggested: "Troubleshooting SSO and SAML Sign-In Errors",
outline: "1. Check the identity provider metadata\n2. Match the ACS URL and entity ID\n3. Read the SAML response\n4. Common Okta and Azure AD failures"
},
{
semantic: true,
confidence: __( "Medium confidence", "betterdocs" ),
color: "amber",
topic: "Exporting a knowledge base to PDF",
volume: 211,
phrasings: 4,
demand: 68,
queries: [ "export docs to pdf", "print whole knowledge base", "offline documentation download" ],
suggested: "Exporting Your Knowledge Base as a PDF Handbook",
outline: ""
},
{
semantic: false,
confidence: __( "Medium confidence", "betterdocs" ),
color: "amber",
topic: "Webhook retry behaviour",
volume: 96,
phrasings: 3,
demand: 52,
queries: [ "webhook retry policy", "failed webhook delivery", "webhook timeout" ],
suggested: "",
outline: ""
}
];
function GapCard( { gap } ) {
return (
{ gap.semantic
? { __( "AI-detected", "betterdocs" ) }
: { __( "Search analytics", "betterdocs" ) } }
{ gap.confidence }
{ gap.topic }
{ gap.volume } { __( "unanswered searches", "betterdocs" ) }
{ " ยท " }{ gap.phrasings } { __( "phrasings", "betterdocs" ) }
} />
{ __( "Sample reader queries", "betterdocs" ) }
{ gap.queries.map( ( q, i ) => { q } ) }
{ gap.suggested ? (
<>
{ __( "Suggested doc", "betterdocs" ) }
{ gap.suggested }
{ gap.outline &&
{ gap.outline } }
>
) : (
}>
{ __( "Draft title with AI", "betterdocs" ) }
{ __( "Uses your API key", "betterdocs" ) }
) }
);
}
export default function GapsMock() {
return (
{ __( "Topics readers want that your docs don't cover", "betterdocs" ) }
{ __( "Clustered from searches that came back empty, visits that bounced, and what readers said in feedback. Every topic is re-checked against your existing docs before it is listed.", "betterdocs" ) }
}>{ __( "Analyze now", "betterdocs" ) }
{ GAPS.map( ( g, i ) => ) }
);
}