Skip to content

feat(insights): Topic & Prompt Opportunities teaser cards - #479

Merged
gkhngyk merged 1 commit into
mainfrom
feature/insights-recommendations
Jul 18, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/insights-recommendations

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fills the space freed by the removed results tree (#458) with a Recommendations row at the bottom of the Insights page — the "so what, what should I do next?" step the page was missing:

  • Topic Opportunities — top 5 stored similar-topic clusters (keyword, prompt count, ~monthly AI volume).
  • Prompt Opportunities — top 5 stored prompt suggestions (text, topic, volume badges).

Design notes, per the issue spec:

  • Cheap reads only: both reads are composed server-side inside getInsightsData's existing Promise.all — zero additional client POSTs (the serialized-action-queue lesson from perf(insights): drop the full-table scan on load + use SQL limit/count instead of fetching all rows #313/fix(prompts): consolidate the page's first load into one server action #473) and no LLM call on the Insights load path. Each read degrades independently to an empty list on failure, so an aeo-server hiccup can never block the Insights page.
  • Empty state: cards with no stored data show a "Generate ideas →" CTA linking to the same target instead of rendering blank.
  • Visual contract: the row sits under its own "Recommendations" heading with an "independent of the date filters above" subtitle and no delta badges, so it can't be mistaken for period-scoped metrics (Insights: period-aware Tracked Prompts KPI card with plan quota and upgrade link #457 reasoning).
  • Navigation: Prompt Opportunities links to /dashboard/prompts#prompt-opportunities — the suggestions card lives on the default All Prompts tab and already expands + scrolls itself for that hash. Topic Opportunities links to /dashboard/prompts?tab=insights#topic-opportunities: the Similar Topics card now carries that id, and the Prompts page re-applies the hash after the Insights tab's volume data has rendered, so the scroll works on cold page loads too. The tab URL sync no longer strips location.hash when it rewrites the query string.

Related issue

Closes #459

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Open /dashboard/insights for a brand with volume analyses and stored prompt suggestions: a Recommendations section with the two cards renders below the Share of Voice row, up to 5 items each.
  2. See all on Prompt Opportunities lands on the Prompts page (All Prompts tab) with the suggestions card expanded and scrolled into view.
  3. See all on Topic Opportunities lands on the Prompts page with the Insights tab active and the Similar Topics card scrolled into view — also when pasting the URL into a fresh tab (cold load).
  4. Changing the date preset / filters re-renders the KPI row but the Recommendations items do not change.
  5. On a brand with no stored suggestions/volumes, the cards show the "Generate ideas →" CTA.
  6. Network tab: the Insights load still issues a single consolidated server action — no new requests.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Fills the space freed by the removed results tree (#458) with a
Recommendations row: top 5 stored similar-topic clusters and top 5 stored
prompt suggestions, each with a See all link into the Prompts page.

Both reads are assembled server-side inside getInsightsData's Promise.all
(no extra client POST, no LLM call) and degrade independently to an empty
list so a hiccup never blocks the Insights load. Empty cards show a
Generate ideas CTA instead of rendering blank. The section sits under its
own heading with no delta badges — it is stored account data, not
period-scoped (see #457).

Deep links: the suggestions card already handles #prompt-opportunities on
the default tab; the similar-topics card gets id=topic-opportunities and
the Prompts page re-applies the hash once the Insights tab's data has
rendered (a bare anchor can't scroll to a not-yet-mounted card). The tab
URL sync now preserves location.hash instead of stripping it.
@gkhngyk
gkhngyk merged commit e2f3ed1 into main Jul 18, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the feature/insights-recommendations branch July 18, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Insights: Topic & Prompt Opportunities teaser cards in place of the removed results tree

1 participant