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): add an Added column and shorten the tracked prompts' column tips (#1111)
Cihand22c844a5545
diff --git a/docs/guides/prompts.mdx b/docs/guides/prompts.mdxindex 86a720d3d..36e8dc530 100644--- a/docs/guides/prompts.mdx+++ b/docs/guides/prompts.mdx@@ -26,7 +26,7 @@ Each row in **Tracked Prompts** has a status:- **Active** — tracked on its schedule.- **Paused** — kept, but not tracked.-The table opens on Active + New. The **Status** filter, or the cards above the table, show one status or all of them. **Track** on a suggestion in the Visibility page's Opportunities opens Tracked Prompts in a new tab, with the new prompts on top.+The table opens on Active + New. The **Status** filter, or the cards above the table, show one status or all of them. The **Added** column shows when each prompt was added; click it to sort by it. **Track** on a suggestion in the Visibility page's Opportunities opens Tracked Prompts in a new tab, with the new prompts on top.## Performancediff --git a/web/messages/en.json b/web/messages/en.jsonindex fa2e6dd62..5ca9c8ab7 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -2961,6 +2961,22 @@"stoppedDescription": "Deleting stopped at an error. {kept, plural, one {The other prompt is} other {The other # prompts are}} back in the list, so you can try again.","notDeleted": "{kept} of {total} {total, plural, one {prompt} other {prompts}} couldn't be deleted."},+ "columns": {+ "added": "Added",+ "tips": {+ "status": "New: added in the last 24 hours. Active: being tracked. Paused: not tracked.",+ "work": "Your content work on this prompt.",+ "visibility": "Score from 0 to 100 over the {range}: mentions 60%, citations 25%, position 15%.",+ "mentions": "How often AI answers named your brand over the {range}.",+ "citations": "How often AI answers cited your pages over the {range}.",+ "positions": "Where AI answers name your brand, on average, over the {range}. Lower is better.",+ "volume": "Estimated monthly AI searches for this prompt.",+ "competition": "Google Ads competition for its keywords: Low, Medium or High.",+ "runs": "AI answers collected over the {range}. One run is one AI platform answering this prompt once.",+ "added": "When this prompt was added.",+ "lastRun": "When this prompt was last checked."+ }+ },"performance": {"label": "Performance","title": "Where your brand is named in this prompt's AI answers: Best in the first third of the brands listed, Good in the middle, Late in the last third, Missing in fewer than half the answers. Late and Missing list the furthest behind first.",diff --git a/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsxindex e687d5b3b..de9fac7fa 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx@@ -180,9 +180,15 @@ import {} from '@/lib/prompt-bulk-actions';import { toCsv } from '@/lib/csv';import { formatRelative } from '@/lib/format-relative';-import { compareNullsLast, type SortDir } from './prompt-sort';+import {+ compareNullsLast,+ isAllPromptsSortKey,+ promptSortValue,+ type AllPromptsSortKey,+ type SortDir,+} from './prompt-sort';import { BulkActionBar } from './_bulk-action-bar';-import { formatCompactNumber, formatNumber } from '@/lib/format';+import { formatCompactNumber, formatDate, formatNumber } from '@/lib/format';import { usePagination, TablePager } from '@/components/table-pager';import { PromptPositionsSheet } from '@/components/prompts/prompt-positions-sheet';import {@@ -254,29 +260,6 @@ function ColHead({// ─── Sortable column header (All Prompts) ─────────────────────────────────────-type AllPromptsSortKey =- | 'visibility'- | 'mentions'- | 'citations'- | 'position'- | 'volume'- | 'runs'- | 'lastRun';--const ALL_PROMPTS_SORT_KEYS: AllPromptsSortKey[] = [- 'visibility',- 'mentions',- 'citations',- 'position',- 'volume',- 'runs',- 'lastRun',-];--function isAllPromptsSortKey(value: string | null): value is AllPromptsSortKey {- return value !== null && (ALL_PROMPTS_SORT_KEYS as string[]).includes(value);-}-/*** Clickable header that toggles asc⇄desc for its column and marks the active* sort with a chevron. The InfoTip lives outside the button so hovering /@@ -2708,6 +2691,8 @@ function AllPromptsTab({const tDelete = useTranslations('prompts.bulkDelete');const tPerformance = useTranslations('prompts.performance');const tStatus = useTranslations('prompts.status');+ const tColumns = useTranslations('prompts.columns');+ const tTips = useTranslations('prompts.columns.tips');const now = useNow({ updateInterval: 60_000 }).getTime();// Rows deleted from the row menu or the bulk bar, hidden at once and// deleted for real after the Undo window (PROMPT-006). There is no soft@@ -3268,26 +3253,13 @@ function AllPromptsTab({);}- const valueOf = (p: Prompt): number | null => {- const vis = visibility[p.id];- const vol = volumeByPromptId.get(p.id);- switch (activeSort) {- case 'visibility':- return vis ? (vis.score ?? 0) : null;- case 'mentions':- return vis ? vis.totalMentions : null;- case 'citations':- return vis ? vis.totalCitations : null;- case 'position':- return positions[p.id]?.avg ?? null;- case 'volume':- return vol ? vol.estAiVolume : null;- case 'runs':- return vis ? vis.runs : null;- case 'lastRun':- return vis?.lastRunAt ? new Date(vis.lastRunAt).getTime() : null;- }- };+ const valueOf = (p: Prompt): number | null =>+ promptSortValue(activeSort, {+ createdAt: p.createdAt,+ visibility: visibility[p.id],+ position: positions[p.id],+ volume: volumeByPromptId.get(p.id),+ });const sorted = list.sort((a, b) => compareNullsLast(valueOf(a), valueOf(b), dir));// Until a column is picked, prompts added within the last day lead: Track@@ -3518,16 +3490,15 @@ function AllPromptsTab({)}</TableHead><TableHead>Topic</TableHead>- <TableHead className="text-center">Status</TableHead>- <ColHead- className="text-center"- tooltip="Your workflow state for this prompt — has content work been done for it yet?"- >+ <ColHead className="text-center" tooltip={tTips('status')}>+ Status+ </ColHead>+ <ColHead className="text-center" tooltip={tTips('work')}>Work</ColHead><SortableHeadclassName="text-right"- tooltip={`AI Visibility Score (0-100) for this prompt over the ${rangeLabel}: how often answers mention the brand (60%), cite its site (25%) and how early it's named (15%). Hover a value for the components.`}+ tooltip={tTips('visibility', { range: rangeLabel })}sortKey="visibility"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3537,7 +3508,7 @@ function AllPromptsTab({</SortableHead><SortableHeadclassName="text-right"- tooltip={`Total times the brand was mentioned across AI answers for this prompt over the ${rangeLabel}.`}+ tooltip={tTips('mentions', { range: rangeLabel })}sortKey="mentions"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3547,7 +3518,7 @@ function AllPromptsTab({</SortableHead><SortableHeadclassName="text-right"- tooltip={`Total times your pages were cited in AI answers for this prompt over the ${rangeLabel}.`}+ tooltip={tTips('citations', { range: rangeLabel })}sortKey="citations"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3557,7 +3528,7 @@ function AllPromptsTab({</SortableHead><SortableHeadclassName="pl-8"- tooltip={`Average position the brand is named at in AI answers over the ${rangeLabel}, with the change against the previous period of the same length. Hover a value for each platform; the chart button opens the details.`}+ tooltip={tTips('positions', { range: rangeLabel })}sortKey="position"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3567,7 +3538,7 @@ function AllPromptsTab({</SortableHead><SortableHeadclassName="text-right"- tooltip="Estimated monthly AI prompt volume, from keyword analysis. Empty until analysed."+ tooltip={tTips('volume')}sortKey="volume"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3575,15 +3546,12 @@ function AllPromptsTab({>Volume</SortableHead>- <ColHead- className="text-center"- tooltip="Based on Google Ads competition for related keywords (LOW / MEDIUM / HIGH). A proxy for topic difficulty."- >+ <ColHead className="text-center" tooltip={tTips('competition')}>Competition</ColHead><SortableHeadclassName="text-right"- tooltip={`Number of tracking runs for this prompt over the ${rangeLabel} (one per platform per day).`}+ tooltip={tTips('runs', { range: rangeLabel })}sortKey="runs"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3593,7 +3561,17 @@ function AllPromptsTab({</SortableHead><SortableHeadclassName="text-right"- tooltip="Most recent tracking run for this prompt."+ tooltip={tTips('added')}+ sortKey="added"+ activeSort={latenessOrder ? null : activeSort}+ dir={dir}+ onSort={handleSort}+ >+ {tColumns('added')}+ </SortableHead>+ <SortableHead+ className="text-right"+ tooltip={tTips('lastRun')}sortKey="lastRun"activeSort={latenessOrder ? null : activeSort}dir={dir}@@ -3775,6 +3753,15 @@ function AllPromptsTab({<span className="text-xs text-muted-foreground">—</span>)}</TableCell>+ <TableCell+ className="text-right text-xs whitespace-nowrap text-muted-foreground"+ title={new Date(p.createdAt).toLocaleString('en-US', {+ dateStyle: 'medium',+ timeStyle: 'short',+ })}+ >+ {formatDate(p.createdAt)}+ </TableCell><TableCell className="text-right text-xs text-muted-foreground">{formatRelative(vis?.lastRunAt, tCommon)}</TableCell>diff --git a/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.test.ts b/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.test.tsindex 295ee507f..3673d4ea5 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.test.ts+++ b/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { compareNullsLast } from './prompt-sort';+import { compareNullsLast, isAllPromptsSortKey, promptSortValue } from './prompt-sort';describe('compareNullsLast', () => {it('sorts non-null values ascending', () => {@@ -26,3 +26,49 @@ describe('compareNullsLast', () => {expect(compareNullsLast(null, null, 'desc')).toBe(0);});});++describe('promptSortValue', () => {+ const row = {+ createdAt: '2026-10-17T08:00:00.000Z',+ visibility: {+ score: null,+ totalMentions: 9,+ totalCitations: 1,+ runs: 21,+ lastRunAt: '2026-10-17T10:00:00.000Z',+ },+ position: { avg: 1.5 },+ volume: { estAiVolume: 1200 },+ };++ it('sorts Added by when the prompt was added, for every prompt', () => {+ expect(promptSortValue('added', row)).toBe(Date.parse('2026-10-17T08:00:00.000Z'));+ expect(promptSortValue('added', { createdAt: '2026-10-01T00:00:00.000Z' })).toBe(+ Date.parse('2026-10-01T00:00:00.000Z'),+ );+ });++ it("reads each column's figure, a score with no runs counting as 0", () => {+ expect(promptSortValue('visibility', row)).toBe(0);+ expect(promptSortValue('mentions', row)).toBe(9);+ expect(promptSortValue('citations', row)).toBe(1);+ expect(promptSortValue('position', row)).toBe(1.5);+ expect(promptSortValue('volume', row)).toBe(1200);+ expect(promptSortValue('runs', row)).toBe(21);+ expect(promptSortValue('lastRun', row)).toBe(Date.parse('2026-10-17T10:00:00.000Z'));+ });++ it('leaves a prompt with no figures empty, so it sorts last', () => {+ const bare = { createdAt: row.createdAt };+ for (const key of ['visibility', 'position', 'volume', 'runs', 'lastRun'] as const) {+ expect(promptSortValue(key, bare)).toBeNull();+ }+ });++ it('knows the sort keys the URL may carry', () => {+ expect(isAllPromptsSortKey('added')).toBe(true);+ expect(isAllPromptsSortKey('lastRun')).toBe(true);+ expect(isAllPromptsSortKey('created')).toBe(false);+ expect(isAllPromptsSortKey(null)).toBe(false);+ });+});diff --git a/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.ts b/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.tsindex b58151124..721e974aa 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.ts+++ b/web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.ts@@ -16,3 +16,66 @@ export function compareNullsLast(av: number | null, bv: number | null, dir: Sortconst factor = dir === 'asc' ? 1 : -1;return av < bv ? -factor : factor;}++/** The All Prompts table's sortable columns, as the URL's ?sort= names them. */+export type AllPromptsSortKey =+ | 'visibility'+ | 'mentions'+ | 'citations'+ | 'position'+ | 'volume'+ | 'runs'+ | 'added'+ | 'lastRun';++export const ALL_PROMPTS_SORT_KEYS: AllPromptsSortKey[] = [+ 'visibility',+ 'mentions',+ 'citations',+ 'position',+ 'volume',+ 'runs',+ 'added',+ 'lastRun',+];++export function isAllPromptsSortKey(value: string | null): value is AllPromptsSortKey {+ return value !== null && (ALL_PROMPTS_SORT_KEYS as string[]).includes(value);+}++/** What a row's sort reads: when the prompt was added, and the figures loaded beside it. */+export interface PromptSortRow {+ createdAt: string;+ visibility?: {+ score: number | null;+ totalMentions: number;+ totalCitations: number;+ runs: number;+ lastRunAt: string;+ };+ position?: { avg: number | null };+ volume?: { estAiVolume: number };+}++/** A row's value in a column; null when it has none, so it sorts last. */+export function promptSortValue(key: AllPromptsSortKey, row: PromptSortRow): number | null {+ const vis = row.visibility;+ switch (key) {+ case 'visibility':+ return vis ? (vis.score ?? 0) : null;+ case 'mentions':+ return vis ? vis.totalMentions : null;+ case 'citations':+ return vis ? vis.totalCitations : null;+ case 'position':+ return row.position?.avg ?? null;+ case 'volume':+ return row.volume ? row.volume.estAiVolume : null;+ case 'runs':+ return vis ? vis.runs : null;+ case 'added':+ return Date.parse(row.createdAt);+ case 'lastRun':+ return vis?.lastRunAt ? new Date(vis.lastRunAt).getTime() : null;+ }+}