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
feat(prompts): open the positions panel for a tracked prompt the brand isn't named in (#1089)
Cihan41cf79e3b386
diff --git a/web/messages/en.json b/web/messages/en.jsonindex 3f7e8f222..d13f84834 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -2339,7 +2339,11 @@"citedIn": "In {cited} of {answers, plural, one {# answer} other {# answers}} · {citations, plural, one {# citation} other {# citations}}","mentionedInPeriod": "In {mentioned} of {answers, plural, one {# answer} other {# answers}} in this period · {mentions, plural, one {# mention} other {# mentions}}","citedInPeriod": "In {cited} of {answers, plural, one {# answer} other {# answers}} in this period · {citations, plural, one {# citation} other {# citations}}",- "includedOnly": "Answer counts cover the platforms your plan includes."+ "includedOnly": "Answer counts cover the platforms your plan includes.",+ "notMentioned": "Not mentioned",+ "notMentionedTitle": "Not mentioned in any of {count, plural, one {# answer} other {# answers}} in this period",+ "citedOnly": "Cited only",+ "citedOnlyTitle": "Cited in {cited} of {count, plural, one {# answer} other {# answers}} in this period, named in none"},"title": "Prompt Volumes","description": "Discover query volumes and trends across AI platforms.",diff --git a/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsxindex 88bdad4e6..d4c70e1e0 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx@@ -95,6 +95,8 @@ import {import { cn } from '@/lib/utils';import {compareLateness,+ opensPositionsPanel,+ positionCellKind,type PlatformDot,type PlatformDotState,type PromptPositionCell,@@ -2364,9 +2366,33 @@ export default function PromptsPage() {/*** Average position with its trend against the previous period; hovering it- * lists each platform, which is what the "Late or missing" filter reads.+ * lists each platform, which is what the "Late or missing" filter reads. A+ * prompt that was tracked but never named reads "Not mentioned", not the "—"+ * of a prompt with no answers.*/-function PositionValue({ cell }: { cell: PromptPositionCell | undefined }) {+function PositionValue({+ cell,+ vis,+}: {+ cell: PromptPositionCell | undefined;+ vis: PromptVisibilitySummary | undefined;+}) {+ const t = useTranslations('prompts.positions');+ const kind = positionCellKind(cell, vis);+ if (kind === 'notMentioned' || kind === 'citedOnly') {+ return (+ <span+ className="text-xs text-muted-foreground"+ title={+ kind === 'citedOnly'+ ? t('citedOnlyTitle', { cited: vis?.citationAnswers ?? 0, count: vis?.runs ?? 0 })+ : t('notMentionedTitle', { count: vis?.runs ?? 0 })+ }+ >+ {t(kind)}+ </span>+ );+ }if (!cell || cell.avg === null) {return <span className="text-xs text-muted-foreground">—</span>;}@@ -3513,10 +3539,11 @@ function AllPromptsTab({{/* Fixed widths so the value, dots and See line up on every row. */}<div className="inline-flex items-center gap-2"><div className="w-[5.5rem] whitespace-nowrap">- <PositionValue cell={positions[p.id]} />+ <PositionValue cell={positions[p.id]} vis={vis} /></div><div className="w-6">- {vis && (vis.mentionAnswers > 0 || vis.citationAnswers > 0) && (+ {/* Whenever it has answers: a prompt never named is the one to open. */}+ {opensPositionsPanel(vis) && (<Buttontype="button"size="icon-xs"diff --git a/web/src/lib/prompt-position-summary.test.ts b/web/src/lib/prompt-position-summary.test.tsindex 7d66ece4f..e8264b4ea 100644--- a/web/src/lib/prompt-position-summary.test.ts+++ b/web/src/lib/prompt-position-summary.test.ts@@ -9,6 +9,8 @@ import { describe, expect, test } from 'vitest';import {buildPositionCell,compareLateness,+ opensPositionsPanel,+ positionCellKind,previousWindow,type PlatformDotState,type PromptPositionCell,@@ -211,3 +213,42 @@ describe('previousWindow', () => {});});});++describe('positionCellKind', () => {+ const counts = (runs: number, mentionAnswers: number, citationAnswers = 0) => ({+ runs,+ mentionAnswers,+ citationAnswers,+ });++ test('shows the average once there is one', () => {+ expect(positionCellKind({ avg: 2.5 }, counts(4, 3))).toBe('average');+ });++ test('says "Not mentioned" for a prompt tracked in the window but never named', () => {+ expect(positionCellKind({ avg: null }, counts(3, 0))).toBe('notMentioned');+ expect(positionCellKind(undefined, counts(1, 0))).toBe('notMentioned');+ });++ test('says "Cited only" when its pages were cited though it was never named', () => {+ expect(positionCellKind({ avg: null }, counts(5, 0, 3))).toBe('citedOnly');+ });++ test('keeps "—" without answers, or with mentions whose positions are not stored', () => {+ expect(positionCellKind(undefined, undefined)).toBe('none');+ expect(positionCellKind({ avg: null }, counts(0, 0))).toBe('none');+ expect(positionCellKind({ avg: null }, counts(4, 2))).toBe('none');+ });+});++describe('opensPositionsPanel', () => {+ test('offers the panel whenever the prompt has answers in the window, named or not', () => {+ expect(opensPositionsPanel({ runs: 3, mentionAnswers: 0, citationAnswers: 0 })).toBe(true);+ expect(opensPositionsPanel({ runs: 3, mentionAnswers: 2, citationAnswers: 1 })).toBe(true);+ });++ test('offers none without answers', () => {+ expect(opensPositionsPanel({ runs: 0, mentionAnswers: 0, citationAnswers: 0 })).toBe(false);+ expect(opensPositionsPanel(undefined)).toBe(false);+ });+});diff --git a/web/src/lib/prompt-position-summary.ts b/web/src/lib/prompt-position-summary.tsindex fbb9bb15b..3794025cc 100644--- a/web/src/lib/prompt-position-summary.ts+++ b/web/src/lib/prompt-position-summary.ts@@ -110,6 +110,39 @@ export function buildPositionCell(};}+/** What the Prompts table reads of a prompt's answers in the window. */+interface AnswerCounts {+ runs: number;+ mentionAnswers: number;+ citationAnswers: number;+}++/**+ * What the Prompts table's Positions cell shows: the average; for a prompt+ * tracked in the window but never named, "Cited only" when its pages were+ * cited and "Not mentioned" when not, as the panel's legend reads; or "—"+ * for one with no answers (or answers whose positions aren't stored).+ */+export function positionCellKind(+ cell: Pick<PromptPositionCell, 'avg'> | undefined,+ answers: AnswerCounts | undefined,+): 'average' | 'citedOnly' | 'notMentioned' | 'none' {+ if (cell && cell.avg !== null) return 'average';+ if (answers && answers.runs > 0 && answers.mentionAnswers === 0) {+ return answers.citationAnswers > 0 ? 'citedOnly' : 'notMentioned';+ }+ return 'none';+}++/**+ * Whether the row offers its positions panel: whenever the prompt has answers+ * in the window, so one never named can still be opened (to its "Not+ * mentioned" platforms and Improve).+ */+export function opensPositionsPanel(answers: AnswerCounts | undefined): boolean {+ return !!answers && answers.runs > 0;+}+/*** Orders prompts furthest behind first, for the "Late or missing" filter.* Nearly every tracked prompt is late or missing somewhere, so the filter