Skip to content

feat(prompts): edit/delete a prompt in place via a dialog - #487

Merged
gkhngyk merged 1 commit into
mainfrom
feature/edit-prompt-dialog
Jul 20, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/edit-prompt-dialog

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the pencil link on the All Prompts tab — which only jumped to the top of the brand's prompts page with no reference to the clicked row — with an Edit Prompt dialog, the sibling of the Add Prompt dialog from #483:

  • Pre-filled from the row: text, topic (Select over the brand's topics, fetched lazily on open), the grouped plan-filtered Platform & Models picker (chatgpt-shopping hidden unless the brand opted in), and an active/paused checkbox.
  • Saving calls the existing updatePrompt — topic resolution, plan filtering and shopping stripping all happen server-side, so no backend changes. Editing keeps the prompt id, so tracking history stays attached.
  • Delete lives inside the dialog behind an inline confirm step that spells out the cascade ("Delete this prompt and its tracking history?"), calling the existing deletePrompt.
  • On success: close, toast, list refresh.

Reuse, not a fork: the shared form body (text input, topic select, engine picker with badge chips) is extracted out of the Add Prompt dialog into PromptFormFields, and the plan/shopping-scoped engine lists into useAllowedEngines. Both dialogs render the same component, so they can't drift apart.

Role gate: the Edit column (header + pencil) now renders only for roles with write access (canManage), matching the Add button; the card subtitle no longer claims the tab is read-only for managers.

Related issue

Closes #484

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. On Prompts → All Prompts as an admin/manager, click the pencil on any row — the dialog opens pre-filled with that prompt's text, topic, platforms/models and active state.
  2. Change the text and topic, save — the row updates in place and a toast confirms; past results remain on the prompt's detail page.
  3. Remove all engines via the badge chips — Save is disabled until at least one is selected.
  4. Uncheck Active, save — the row's status badge flips to Paused.
  5. Click Delete — an inline confirm appears; confirming removes the row from the list.
  6. As a member (read-only role), the Edit column and pencil are gone entirely.
  7. Regression: the Add prompt button/dialog still works as before (same shared form).

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

Replace the pencil link on the All Prompts tab (which jumped to the top of
the brand page) with an Edit Prompt dialog pre-filled from the row: text,
topic, the grouped plan-filtered Platform & Models picker and an active
toggle. Delete lives inside the dialog behind an inline confirm step.

The shared form body (text input, topic select, engine picker with badge
chips) and the plan/shopping-scoped engine lists are extracted out of the
Add Prompt dialog into PromptFormFields + useAllowedEngines so the two
dialogs cannot drift apart. The pencil column now renders only for roles
with write access, matching the Add button.
@gkhngyk
gkhngyk merged commit 0022142 into main Jul 20, 2026
5 checks passed
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.

Prompts: edit/delete a prompt in place via a dialog instead of jumping to the brand page

1 participant