Repository navigation
Description
Problem
Each row on the All Prompts tab (web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx) has an edit (pencil) button — but it just links to the top of /dashboard/brands/[id]/prompts, with no reference to the prompt that was clicked. The user has to find the same prompt again in a different list to change anything. Editing where you see the list is the same baseline expectation that motivated #460's Add prompt dialog.
Fix
Replace the pencil link with an Edit Prompt dialog, the sibling of the Add Prompt dialog from #483:
- Fields pre-filled from the row's prompt: text, topic (Select over the brand's topics), the grouped Platform & Models picker (plan-filtered,
chatgpt-shoppinghidden unless the brand opted in — same rules as the Add dialog), and an active/paused toggle. - A Delete button inside the dialog with an inline confirm step, calling the existing
deletePrompt. - Save calls the existing
updatePrompt(id, { text, category, platforms, models, isActive })(web/src/lib/actions/prompt.ts) — it already handles topic resolution, plan filtering and shopping stripping, so no backend changes are needed. - On success: close, refresh the list, toast.
Reuse, don't fork
The Add Prompt dialog (#483) already contains the exact form pieces (text input, topic select, grouped platform/model picker with badge chips). Extract the shared parts into a common component (or a shared form body) rather than copy-pasting — the two dialogs must not drift apart.
Role gate
The pencil currently renders for every role. Hide it (like the Add button) for members without write access — canManage from useUserRole.
Behavior note
Editing the text keeps the prompt's id, so its tracking history stays attached — this matches the existing behavior of the brand page's inline text editing. No migration or data handling needed.
Acceptance criteria
- Clicking the pencil opens the dialog pre-filled with the prompt's current text, topic, platforms/models, and active state; saving updates the row in place.
- The prompt can be deleted from the dialog after an explicit confirm; the row disappears from the list.
- Platform/model options follow the same plan/shopping visibility rules as the Add dialog; saving with no engine selected is blocked.
- Members without write access see no pencil button.
- Shared form pieces are factored out of the Add dialog, not duplicated.
yarn lint,yarn typecheck,yarn format:checkpass fromweb/.
Getting started
Depends on #483 (the Add Prompt dialog whose form pieces this reuses) — start after it merges. See CONTRIBUTING.md for setup. Comment here to claim the issue before opening a PR.
Activity
feat(prompts): edit/delete a prompt in place via a dialog (#484) (#487)