Skip to content

Prompts: add an "Add prompt" action to the main Prompts page #460

Closed

Description

@gkhngyk

Problem

The main Prompts page (/dashboard/prompts?tab=all) — the primary prompt surface in the sidebar — tells users to add prompts in four different places ("No prompts yet - add prompts first", "Add prompts to your brand to start tracking their AI visibility", …) but offers no way to do it there. Creation lives only in Brands → [brand] → Prompts (web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/prompts/page.tsx), which requires knowing that prompts belong to prompt sets under a brand. "You can add where you see the list" is a baseline dashboard expectation.

Fix

Add an Add prompt button to the All Prompts tab header of web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx, opening a dialog for the active brand:

  • Dialog: prompt text (reuse the validation used by addPromptToSet), platform/model defaults derived like trackFanoutQuery does (web/src/lib/actions/fanout.ts): the brand's earliest prompt set, platforms/models from its most recent active prompt. The add dialog on the brands/[id]/prompts page is the styling reference — extract/share rather than fork if practical.
  • Plan-limit errors must come back as a value, not a throw. addPromptToSet throws PlanLimitError; in production every thrown server-action error reaches the client as the masked digest message (Query fan-out: long hang then production-masked server error surfaced raw in the UI #427). Call it through a wrapper that catches and returns { error } — trackFanoutQuery is the exact pattern to copy. Show the real message ("plan limit reached…") in the dialog.
  • Empty state: the All Prompts empty state ("Add prompts to your brand to start tracking…") gets the same button — it is currently a dead end.
  • After a successful add: close the dialog, refresh the list, and toast that the prompt will be picked up by the next tracking run (avoids "I added it but there's no data" confusion).
  • Respect the role gate: hide or disable the button for members without write access (canManage from useUserRole).

Acceptance criteria

  • An Add prompt button is visible on the All Prompts tab (header and empty state) for admin/manager roles and works for the active brand.
  • Hitting the plan's prompt limit shows the actual limit message inside the dialog — not a generic error.
  • The new prompt appears in the list immediately after adding, marked active.
  • Members without write access don't see (or can't use) the button.

Getting started

See CONTRIBUTING.md for setup. From web/, yarn lint, yarn typecheck and yarn format:check must pass. Comment here to claim the issue before opening a PR.

Activity

  1. added
    enhancement
    help wanted
    on Jul 17, 2026
  2. self-assigned this
    on Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions