Repository navigation
feat(prompts): add locations to many prompts at once, priced before saving, with more countries (PROMPT-015, part 3) - #1657
Merged
Conversation
…columns, and share them with the brand (PROMPT-015, part 1) PROMPT-015a. A Columns panel beside the table's search: - show or hide every column but Prompt, and reorder them by dragging or with the arrows; - saved per person and brand (00363 prompt_table_views, RLS); - an admin or manager can share their columns with everyone on the brand, who see them until they change their own; - Reset goes back to the brand's view, or the default. Nobody who never opens Columns sees a change: the default is today's columns in today's order. The table builds its header and cells by column id, unchanged inside. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Locations view (PROMPT-015, part 2) PROMPT-015b. A Table | Locations switch above Tracked Prompts: - Locations shows each prompt in each location the brand tracks, side by side: Visibility, Position, Mentions or Citations; an average row; a Gap column (best minus worst location); and three cards: the weakest and strongest location and the prompt that differs most between them. - Cells use Brand Visibility's Topics vs competitors shades (HEAT_SHADES, moved beside heatShade). A cell opens the prompt's Positions panel on that location; a location the prompt isn't tracked in offers + Track (its Edit dialog for now). - The Columns panel can add "<metric> · <location>" columns to the table. - getPromptLocationMatrix reads each location with the table's own reads (visibility summaries, position sums), side by side, so a location's numbers equal the table filtered to it. No migration. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… brand (PROMPT-015, part 1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…PT-015, part 2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aving, with more countries (PROMPT-015, part 3) PROMPT-015c. Track in more locations, from the Locations view's + Add location or a cell's + Track: - pick countries or US states (LocationPicker), and the prompts to ask there: the one clicked, the selected, a topic, or all shown; - Plan usage shows used → after of the plan's prompt locations before anything is saved, with the same arithmetic the save enforces (planBulkLocationChange, bulkUpdatePromptLocations); - past the limit the dialog says what the choice needs and what is left, with the plan's way out (Starter: upgrade or a custom plan; Growth: a custom plan; Enterprise: raise the limit), and Save stays off. Prompts can be tracked in about 50 countries (TRACKING_COUNTRIES), not 18; a brand's own region keeps the shorter list that volumes and audits read. PromptLimitActions moves to its own file (a page can't export it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…OMPT-015, part 2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ound of reads (PROMPT-015, part 2) The user's bar: data within 1–2 s of a choice. Measured locally (dev, hosted dev DB) the matrix read took 1.4–1.8 s. - getPromptLocationMatrix starts every read at once: the plan's engines no longer wait in front of the locations' reads. - A matrix read stays a minute in the browser (loadLocationMatrix), so going Table ↔ Locations, or back to a location column, reads nothing again; switching the metric was already in the browser. - The Locations button reads ahead on hover or focus, so the view opens on data already there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-locations # Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx
…their own view with the brand (PROMPT-015, part 1) Someone looking at the brand's shared view without one of their own changed it with every click: a member got "Only admins and managers can share" errors, and a manager hiding one column changed it for everyone. Changes now update the brand's view only after an admin or manager shared their own, which sharing now also saves as theirs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…able (PROMPT-015, part 1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ations-view # Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/prompts/_columns-panel.test.tsx # web/src/app/[locale]/(dashboard)/dashboard/prompts/_columns-panel.tsx
… and each location once a minute (PROMPT-015, part 2) Up to twelve locations ran two heavy aggregates each, all at once, on every open, every read-ahead on hover and every new location column. The server now runs at most three of them at a time, the page sends one read at a time, read-ahead included, and each location's figures are kept for a minute on their own, so a new location column reads only its location. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed, resumed, deleted or edited (PROMPT-015, part 2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-locations # Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx
…o longer shown, not to every prompt (PROMPT-015, part 3) Track in more locations opened from a Locations view cell fell back to every prompt shown when the cell's prompt had left the rows. It now targets none, says to choose the prompts, and keeps the save button off until a scope is picked. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a promise (PROMPT-015, part 2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
10 of 12 tasks
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
…le-columns # Conflicts: # supabase/schema.sql
# Conflicts: # supabase/schema.sql
Collaborator
Author
|
Merged main forward (8356ba3) through the stack; no new conflicts on this branch. Typecheck and lint pass on the chain tip. |
9 of 12 tasks
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
Nothing blocks the merge. No migration. Item 1 is about release order: merge it together with #1659 (part 5).
What I checked
- Own diff.
8cb4811d..518770c1(#1656's head to this one):_add-locations-dialog.tsxand its tests,PromptLimitActionsmoved to its own file, the Locations view's + Add location and + Track,TRACKING_COUNTRIESinprompt-options.ts,region.tsand the location picker,en.jsonand the guide. The whole stack up to here merges on 8356ba3 with onlysupabase/schema.sqlconflicting (from #1655). - Plan cap, server side. The dialog saves through the existing
bulkUpdatePromptLocations. It re-reads each prompt's locations under the caller's RLS, measures the change withplanBulkLocationChange(paused prompts take no room), checks it against the organization's usage and plan (locationLimitMessage), and writes in oneapply_prompt_locationscall. The dialog's preview runs the same arithmetic, so what it shows is what the save checks. A client that skips the dialog still hits the cap. - Targets. From a cell whose prompt is no longer shown, the dialog targets no prompt and keeps Save off (cbc56ce, tested). The other scopes are the selection, one topic, or every row the filters keep.
- Countries.
isValidLocationandregionLabelnow take about 50 countries. A brand's own region still uses the 18 inREGIONS, which volumes and audits read. The API takes any two-letter country (server/src/lib/locations.js), so the new codes reach the engines as they are. - Copy. Plural and select forms in
addLocations.*are well-formed, and the over-limit text names what's needed, what's left, and the plan's way out. - Tests and checks. The PR's tests pass (
_add-locations-dialog,prompt-locations,region, the location picker, and the prompts folder: 17 files, 142 tests). Webtscis clean. eslint and prettier are clean on the touched files. On the stack merged into 8356ba3 (schema.sql aside), webtscis clean and the same tests plus the insights folder pass (22 files, 171 tests).
Follow-ups
- Not every engine answers from every new country. This PR offers all ~50 countries for every engine. 00364 (#1659) says the provider supports a different set per engine, and asking an engine in an unsupported country fails. Until #1659 is merged and 00364 is applied, a prompt added in such a country fails for that engine on every daily run. Merge the stack through #1659 together, and apply 00364 before the next daily run. The comment at
prompt-options.ts:26-28("more markets every tracking engine answers from") should say the same. - Save is on while plan usage loads.
_add-locations-dialog.tsx:112treats an unread quota (still loading, or the read failed) as unlimited, so Save is enabled and no over-limit warning shows. The server still refuses past the cap, so nothing gets through, but the person sees the refusal only after Save. Keep Save off until the quota is read, and say so if the read fails. - Already listed in the description: the read-only guard (#1599) on + Add location and + Track, and a confirm step with "≈N runs a day" for big adds.
Rollout
None of its own. Needs #1655's 00363, and see item 1 for #1659.
9 tasks done
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
PROMPT-015, part 3 of 6: add locations to many prompts at once, with the plan usage shown before saving, and more countries.
Stacked on #1656. This PR's own change is its commits after part 2's.
Track in more locations, opened from the Locations view's + Add location or from a cell's + Track:
planBulkLocationChange,bulkUpdatePromptLocations); the server checks the limit again.More countries: prompts can be tracked in about 50 countries (
TRACKING_COUNTRIES), up from 18. A brand's own region keeps the shorter list that volumes and audits read.PromptLimitActionsmoves to its own file, because a page can't export it.Where people see it: Prompts › Tracked Prompts › Locations › + Add location, or + Track in a cell.
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
cd web && npx vitest run src/app/[locale]/(dashboard)/dashboard/prompts/_add-locations-dialog.test.tsx src/lib/prompt-locations.test.tsBrowser check: local, 1024 px.
Related issue
PROMPT-015 (location matrix and custom columns), spec and mockup in Drive › Prompt. No GitHub issue.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks at the top of the stack (part 6, 29f649d):
npm test: 248 files, 3,364 tests passed;vitest(453 files, 4,403 tests) and build: all pass;schema.sqlmatchesbuild-schema.sh.A pre-push review found 9 issues; all are fixed in this stack (the
fix(...)commits). Migrations 00363 and 00364 are applied on the dev database.Follow-ups, not in this stack:
writeUrlParamsfor the layout switch (keeps the hash);removePromptTableViewshould say when nothing was removed;en.json;processTrackingJobtest for country skips.🤖 Generated with Claude Code