Skip to content

feat(content): show the related prompt's observed query fan-outs in the opportunity's Source Data #392

Closed

Description

@gkhngyk

Problem

The content opportunity detail page (/dashboard/content/[id]) shows a Source Data card with the related prompt, est. AI volume, intent, and keywords. What it doesn't show is the prompt's observed query fan-out — the sub-queries answer engines actually ran while answering that prompt (captured in prompt_results.search_queries, see #332/#333).

For a content writer this is first-hand demand signal: keywords are estimates, fan-outs are what the engines actually searched. A brief that covers those sub-queries has a much better shot at being cited.

Proposal

In the Source Data card (web/src/app/[locale]/(dashboard)/dashboard/content/[id]/page.tsx, ~line 247), below the existing Keywords chips (~line 285), add an "Observed fan-out queries" block listing the sub-queries engines ran for this opportunity's prompt.

Data

  • The opportunity already carries promptId (web/src/types/index.ts, populated by server/src/routes/content.js).
  • Query prompt_results for search_queries filtered by brand_id + prompt_id over a rolling window (30d, matching the fan-out tab default), then aggregate exactly like getQueryFanout does in web/src/lib/actions/fanout.ts: normalize whitespace/case, dedupe per answer, count distinct answers per sub-query.
  • A small server action (e.g. getPromptFanout(brandId, promptId)) is enough — or extend fanout.ts with the promptId filter.

UI

  • Render as chips or a compact list (query + times-searched count), consistent with the Keywords block above it.
  • Hide the block entirely when there's no fan-out data — only some engines emit search_queries, so many prompts will have none.

Out of scope (for now)

  • Feeding fan-outs into brief generation (the LLM prompt in server/src/routes/content.js) — worth considering later, but this issue is display-only.

Acceptance criteria

  • Source Data card shows the related prompt's observed fan-out sub-queries (with how often each was searched) when data exists
  • Block is hidden when the prompt has no captured fan-outs
  • Aggregation matches the Query Fan-out tab's semantics (normalization + per-answer dedup)
  • No layout regression in the Source Data card when the block is absent

Activity

  1. added
    enhancement
    good first issue
    on Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions