Repository navigation
feat(prompts): Add prompt dialog on the All Prompts tab - #483
Merged
Merged
Conversation
The main Prompts page told users to add prompts in several places but offered no way to do it there — creation lived only under Brands → [brand] → Prompts. The All Prompts tab header (and the empty state, previously a dead end) now open a quick-add dialog for the active brand. The new addPromptToBrand action mirrors trackFanoutQuery's promote flow: earliest prompt set, platforms/models derived from its most recent active prompt, and user-facing failures (plan limit, no prompt set) returned as a value so the real message renders in the dialog instead of production's masked digest (#427). On success the list refreshes and a toast notes the prompt joins the next tracking run. The button is role-gated to admin/manager via useUserRole().canManage.
The quick-add dialog now mirrors the brand page's Add Prompt card instead of deriving everything server-side: a Topic select (defaulting to the brand's first topic) and the grouped Platform & Models picker (plan-filtered, chatgpt-shopping hidden unless the brand opted in), with all allowed engines pre-selected and removable as badges. addPromptToBrand now takes the caller's category/platform/model choices, and creates the brand's first prompt set on the fly instead of erroring when none exists. Topics are fetched lazily on dialog open only.
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The main Prompts page — the primary prompt surface in the sidebar — told users to add prompts in several places but offered no way to do it there; creation lived only under Brands → [brand] → Prompts. This adds an Add prompt button to the All Prompts tab header and to the empty state (previously a dead end), opening a dialog for the active brand.
The dialog mirrors the brand page's Add Prompt card mechanism:
chatgpt-shoppinghidden unless the brand opted in (feat(shopping): org-level "Shopping mode" toggle + ChatGPT Shopping platform + Insights isolation #155). All allowed engines are pre-selected and removable as badges, matching the brand page's defaults.addPromptToBrandaction returns user-facing failures as a value (thetrackFanoutQuerypattern) instead of throwing — production masks thrown server-action errors into a useless digest message (Query fan-out: long hang then production-masked server error surfaced raw in the UI #427), so the real "plan limit reached" text now reaches the user.addPromptToSet(same validation, plan filtering, shopping stripping, topic resolution). Target is the brand's earliest prompt set, created on the fly when the brand has none yet.useUserRole().canManage).Related issue
Closes #460
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
/dashboard/prompts?tab=all, click Add prompt in the header: the dialog opens with the brand's topics and all plan-allowed engines pre-selected.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)