Repository navigation
Description
Problem
The Insights KPI row (Visibility Score / Mentions / Citations / Positive Sentiment) gives no hint of the denominator behind those numbers — how many tracked prompts actually produced the data — and the plan's prompt quota is invisible outside Settings. Internal feedback asked for a prompt card in the KPI row with the quota and an upgrade path.
A naive "total tracked prompts" card was considered and rejected: every card in that row recomputes when the date preset changes (24h/7d/30d/…), and a static account-state number sitting between them breaks the row's "these numbers describe the selected period" contract — the same class of inconsistency the citations mismatch taught us to avoid.
Design (period-aware)
Add a Tracked Prompts card between Visibility Score and Mentions in web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx:
- Main value follows the date filter: the number of distinct prompts that produced results in the selected range —
count(distinct prompt_id)overprompt_resultsfor the brand + range. On 24h this may read 38 while the brand has 45 active prompts; that is informative ("your 24h view covers 38 prompts so far"), not a bug. - Sub-line shows the org quota:
45 / 50 prompts— current state, deliberately not period-scoped (quotas are "now" facts; only the main value must react to the filter). Notes:- The limit must be the effective one — read via
getOrgPlan, which merges Enterpriseplan_overrides, not the static plan config. maxPromptsis org-wide (getOrgPromptCountinweb/src/lib/actions/prompt.tscounts prompts across all brands), so word the sub-line accordingly (e.g. "45/50 across your organization" in the tooltip).- Unlimited plans: hide the quota fraction, show just the active-prompt count.
- The limit must be the effective one — read via
- Click behavior: the card navigates to
/dashboard/prompts(same pattern as the Citations card →/dashboard/citations). When org usage is at ≥90% of the quota, the sub-line shows an Upgrade link that navigates to Settings — withstopPropagationso the nested link doesn't trigger the card's navigation. - Layout: the row is currently
grid grid-cols-2 gap-4 sm:grid-cols-4; five cards need something likesm:grid-cols-3 xl:grid-cols-5— check both breakpoints and the mobile 2-column flow. - Tooltip on the card title explaining the metric ("Distinct prompts that produced tracked results in the selected period"), matching the other cards' tooltip pattern.
Acceptance criteria
- Changing the date preset updates the Tracked Prompts value together with the other four cards; the quota sub-line stays constant.
- Quota reflects
plan_overridesfor Enterprise orgs; unlimited plans show no fraction and never show Upgrade. - Upgrade link appears only at ≥90% usage, goes to Settings, and does not trigger the card's Prompts navigation.
- KPI grid renders cleanly at mobile / sm / xl widths with five cards.
Activity
feat(insights): period-aware Tracked Prompts KPI card with plan quota (…
feat(insights): Topic & Prompt Opportunities teaser cards (#459) (#479)