Repository navigation
Description
Description
Content opportunities are generated per prompt: every row in content_opportunities carries a prompt_id, and nearly all rows have one set. The Content page, however, can only filter by status, impact and type, plus a free-text search over title and description. On larger brands the list runs to 100+ opportunities spread across 20–30 prompts, so answering "what should I write to show up for this prompt?" means scrolling or guessing search terms.
Proposed change
Add a Prompt filter to the Content page's filter bar, next to the existing Status / Impact / Type selects.
Server: server/src/routes/content.js: GET /api/content/brand/:brandId already reads status, impact, type and q from the query string. Accept a prompt_id parameter the same way and add it to the query as an equality filter.
Web:
web/src/lib/actions/content.ts: addpromptIdto thegetOpportunitiesfilters and pass it through asprompt_id.web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx: add apromptFilterstate alongsidestatusFilter/impactFilter/typeFilter. Include it in the reload key and in the "filters active" check so Clear resets it.- Persist the selection in the URL as
?prompt=<id>so the filtered view can be linked to from other pages.
UX details:
- Only list prompts that have at least one opportunity. Show the prompt text, truncated, and ideally its opportunity count.
- Hide the filter when a brand's opportunities span fewer than two prompts, since it would have nothing to narrow.
- Brands can have 30+ prompts, so a searchable picker works better than a long plain list.
- If you use the shared
Select, passitems={[{ value, label }]}on the root. Without it, the trigger shows the raw id instead of the prompt text.
How to test
- Open
/dashboard/contentfor a brand with opportunities across several prompts. - Pick a prompt: only its opportunities are listed, and the count and pagination reflect the filtered set.
- Reload the page: the
?prompt=selection is kept. - Clear filters: the full list comes back.
Run yarn build from web/ and yarn test from server/ before opening the PR. Branch and commit conventions are in CONTRIBUTING.md.
Activity
feat(content): filter opportunities by prompt
feat(content): filter opportunities by prompt (ansvisor#854)