Repository navigation
feat(prompts): give suggestions their own tab and show what feeds them - #727
Merged
Merged
Conversation
Suggestions lived in a collapsible card that was collapsed by default, so most people never saw them: the strip read "expand for AI prompt ideas" and that was the whole invitation. They are now a tab of their own, alongside All Prompts, Query Fan-out and Insights. A flat fourth tab rather than tabs inside a tab. The alternative nests two levels of navigation on one page, and the four panels are peers — each is a different view of the same brand's prompts. The collapse machinery goes with the card. Fetching on mount is safe now because the component only mounts when the tab is open, and the tab click is the user asking for it. That is the constraint the collapsed card existed to respect: as an always-mounted card its request was the first entry in Next's serialised server-action queue, and every hiccup in it stalled the prompt table behind it. Moving it behind a tab keeps that property. The data-source panel replaces the quiet one-line hint #659 asked for. That issue predates Analytics being a suggestion source, and a muted link is the wrong weight for what is now the difference between suggestions built on estimates and suggestions built on the brand's own demand and behaviour. It distinguishes four states, because connected-but-unmapped is the one that silently produces nothing and deserves its own wording rather than a green tick. Nothing renders when Composio is unconfigured — a self-host cannot complete the flow — or when every source is already feeding, since the suggestion rows carry their own badges. The date range control hides on this tab. Suggestions are regenerated on demand with a 48-hour life and carry no date dimension, so a range there would change nothing, exactly as on Insights. Deep links written before the tab existed still work: the Insights recommendation row now points at ?tab=suggestions, and a bookmark carrying the old #prompt-opportunities anchor opens the tab rather than landing on All Prompts with nothing to scroll to. Closes #659
…esign The first pass diverged from the mockup on the point that mattered most: it promoted suggestions to a fourth top-level tab instead of splitting the Prompts tab into Tracked Prompts and Prompt Suggestions. Those two are views of one roster — the date range, Add prompt and Export all belong to both — so a segmented control inside the tab is the right shape, and the top-level tabs go back to three. The connect panel becomes the promo cell plus a card per source, and the list becomes numbered rows with the source as its own column. Every row carries Ansvisor Agents, joined by a data source badge when the suggestion was mined from the brand's own Search Console or Analytics — two badges is the honest reading, since the data and the phrasing come from different places. Source filter, search, New and Clear All land as drawn. Clear All dismisses what is listed rather than everything stored: dismissing a Search Console or Analytics row keeps that query or page out of the pool for thirty days, so clearing a filtered view must not silently suppress rows the user never saw. The date range stays visible on this tab. It scopes the tracked view, which is the other half of the same panel. DataForSEO is still absent from the panel. It is our own API key, used to enrich Search Console candidates with competition data — not a customer connection and not a suggestion source, so listing it under "your data is secure and never shared" would misdescribe both it and the two that are.
…lace Three cards, as drawn. DataForSEO is ours rather than the customer's — our key, enriching Search Console candidates with competition and volume data — so it reports a state and offers no button: "Enabled" when the deployment has credentials, absent when it does not. A new status endpoint answers that, declared above the :provider routes which would otherwise claim the path and reject it as an unknown provider. It returns a boolean and never the credentials. The panel no longer hides itself once every source is connected. It is the standing answer to "what is behind these suggestions", not a prompt to act, and a reader who connected Search Console last month should still see that it is the one doing the work. Dismissing it remains the way to hide it, and that choice is still remembered. Rows can now carry a DataForSEO badge too, but only where the row actually holds its contribution — the competition index it returned for that query. A badge on a row it never touched would be decoration claiming to be provenance, which is the opposite of what the source column is for.
The cards showed generic lucide glyphs where the provider's own mark belongs. They now load an SVG from web/public, matching how platform logos already work on this codebase, and fall back to the previous icon when the file is absent — so a deployment missing an asset shows something sensible rather than a broken image. The three files are not in this commit: they are third-party marks, and the right versions are the ones each vendor publishes rather than something redrawn from a screenshot. Drop them in as web/public/google-search-console.svg, google-analytics.svg and dataforseo.svg and they appear with no code change.
The data-source cards already reference these paths and fall back to a generic icon when they are missing; with the files present the cards show each provider's own mark.
The data-source panel appeared well after the suggestions it sits above, because resolving each provider's state called the live status endpoint, which asks Composio and re-syncs our row. Measured at 493ms and 389ms for the two providers, plus a brand-mapping query each. The panel now reads the row that status check maintains, together with the brand's property mapping, in two database queries — 468ms to 100ms on the same connection, and no Composio round trip at all. The env booleans come from one lightweight endpoint that replaces the DataForSEO-only one added earlier in this branch; it reports all three integrations and never touches Composio either. The trade-off is stale state: a connection revoked on Google's side still reads as connected here until Settings runs its authoritative check and rewrites the row. For a panel that describes what feeds suggestions, a briefly stale "connected" is a better failure than a second of blank space on every visit — and Settings, where connections are actually managed, still resolves live.
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 suggestions lived in a collapsible card, collapsed by default, so most people never saw them — the strip read "expand for AI prompt ideas" and that was the whole invitation. They now get a tab of their own, and a panel showing which data sources feed them.
A flat fourth tab —
All Prompts · Suggestions · Query Fan-out · Insights— rather than tabs nested inside a tab. The four panels are peers: each is a different view of the same brand's prompts.The collapse machinery is gone, and that is safe
The card was collapsed by default for a real reason, not for looks: as an always-mounted card its request became the first entry in Next's serialised server-action queue, and every hiccup in it stalled the prompt table's own fetch behind it — the "table spins forever" bug.
Fetching on mount is fine now because the component only mounts when the tab is open, and the tab click is the user asking for it. The comment in the file says so, so nobody moves it back above a tab boundary later.
The data-source panel replaces #659's one-liner
That issue asked for a muted inline hint. It predates Analytics becoming a suggestion source (#705), and a quiet link is the wrong weight for what is now the difference between suggestions built on estimates and suggestions built on the brand's own demand and behaviour.
Four states, because they mean different things:
Connected-but-unmapped is the state that silently produces nothing, which is why it gets its own copy rather than a green tick. The whole panel hides once every source is feeding — the suggestion rows already carry their own source badges, so a panel repeating that is noise. It is dismissable, and the dismissal is remembered.
Both buttons deep-link to the existing Settings → Integrations flow rather than reimplementing it.
Also
?tab=suggestions, and a bookmark carrying the old#prompt-opportunitiesanchor opens the tab instead of landing on All Prompts with nothing to scroll to.Not included, deliberately
The mockup this came from also had a source filter and a search box over the suggestion list. Suggestions are capped at 8 per brand — the live distribution is 8 for eleven brands, 7 for two, 6 and 4 for one each. Filtering and searching six rows is more chrome than content. Worth revisiting if the cap ever rises.
DataForSEO was also shown as a connectable source. It is our own API key used to enrich Search Console candidates with competition data, not a customer connection and not a suggestion source — listing it beside GSC and Analytics under "your data is secure" would misrepresent both.
Related issue
Closes #659
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#prompt-opportunitiesdirectly — the Suggestions tab opens.yarn typecheck,yarn lint(6 pre-existing warnings, 0 errors),yarn format:checkandyarn buildpass locally.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)