Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(content): name the page type filtering the Plan's list while its section is closed (#1344)
Cihan652f8cd692a0
diff --git a/web/messages/en.json b/web/messages/en.jsonindex fa8458e1c..36ddf1a82 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -3118,6 +3118,8 @@"collapsed": "{types, plural, one {# page type} other {# page types}} · {gaps, plural, =0 {no gap} one {# gap} other {# gaps}}","show": "Show","hide": "Hide",+ "filteredBy": "Priority list filtered to {type}",+ "clearFilter": "Clear","aiShare": "Share of AI citations","yourShare": "Your pages' mix","shares": "{ai}% · {yours}%",diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/plan/_plan-insights.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/plan/_plan-insights.tsxindex ad7bcbef5..3e4e1031c 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/plan/_plan-insights.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/plan/_plan-insights.tsx@@ -2,7 +2,7 @@import { useId, useState } from 'react';import { useTranslations } from 'next-intl';-import { ChevronDown, Sparkles } from 'lucide-react';+import { ChevronDown, Sparkles, X } from 'lucide-react';import { Link } from '@/i18n/navigation';import type { PageType } from '@/lib/content/drafts';import type { MixRow, PlanResults } from '@/lib/content/plan-mix';@@ -88,7 +88,9 @@ function MixBars({* citations (light bar) and the type's share of the brand's own cited pages* (dark bar), two mixes of 100 each drawn to one scale, with a gap flagged* in amber. A row- * filters the priority list to its type; clicking it again clears it.+ * filters the priority list to its type; clicking it again clears it. While+ * the section is closed, a line under its bar names the type filtering the+ * list and clears it.*/export function PageTypeMix({rows,@@ -139,6 +141,20 @@ export function PageTypeMix({</span></button></h2>+ {/* Closed, the rows that filter the list are out of sight: say which one does. */}+ {!open && selected && (+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 border-t px-4 py-2 text-xs text-muted-foreground">+ <span>{t('filteredBy', { type: tTypes(selected) })}</span>+ <button+ type="button"+ onClick={() => onSelect(null)}+ className="inline-flex items-center gap-1 rounded font-medium text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"+ >+ <X aria-hidden className="h-3.5 w-3.5" />+ {t('clearFilter')}+ </button>+ </div>+ )}<div id={bodyId} className={cn('border-t', !open && 'hidden')}>{rows.length > 0 && (<div className="flex flex-wrap items-center justify-end gap-3 px-4 pt-2.5 pb-1 text-xs text-muted-foreground">diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.test.tsxindex 505ad9888..6c6d3407e 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.test.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.test.tsx@@ -341,6 +341,27 @@ describe('the Content plan', () => {expect(rowTexts()).toHaveLength(3);});+ it('names the type filtering the list while the section is closed, and clears it', async () => {+ await renderPage();+ const section = () =>+ container.querySelector<HTMLElement>('section[aria-labelledby="plan-mix-title"]')!;+ const bar = () => section().querySelector<HTMLButtonElement>('h2 button')!;+ await act(async () => bar().click());+ await act(async () => section().querySelector<HTMLButtonElement>('li button')!.click());+ // Open, the pressed row says it; no line under the bar.+ expect(section().textContent).not.toContain('Priority list filtered to');+ await act(async () => bar().click());+ expect(bar().getAttribute('aria-expanded')).toBe('false');+ expect(section().textContent).toContain('Priority list filtered to How-to guide');+ expect(rowTexts()).toHaveLength(2);+ const clear = [...section().querySelectorAll<HTMLButtonElement>('button')].find(+ (b) => b.textContent === 'Clear',+ )!;+ await act(async () => clear.click());+ expect(rowTexts()).toHaveLength(3);+ expect(section().textContent).not.toContain('Priority list filtered to');+ });+it('asks for Google Analytics to show what AI visitors did', async () => {getContentPlanInsights.mockResolvedValue({...INSIGHTS,