Repository navigation
Description
Problem
The date range control looks and sits differently on Prompts than it does on Visibility and Citations. Three separate inconsistencies, not one:
| Visibility (Insights) | Citations | Prompts | |
|---|---|---|---|
| Options | 24h · 7d · 30d · 90d · All · Custom | 24h · 7d · 30d · 90d · All · Custom | 7d · 30d · 90d |
| Label | "Date Range" above the control | "Date Range" above the control | none |
| Placement | in the filter bar, first control, bottom-aligned with the other filters | same | top right, opposite the tab bar |
| Styling | flex rounded-md border overflow-hidden, buttons px-3 py-1.5 |
identical | rounded-md border p-0.5, buttons rounded-sm px-2.5 py-1, different inactive colour |
A user moving between the three pages meets the same concept in a different shape and a different place each time, and on Prompts cannot pick the windows the other two offer.
The underlying cause is worth fixing at the same time
Visibility and Citations are not merely similar — their markup is identical, and duplicated. The same segmented-button block, the same class strings, the same custom-range inputs, copy-pasted in two files:
- insights/page.tsx — the
{/* Date presets */}block - citations/filter-bar.tsx
- prompts/page.tsx — the third, divergent variant
So "make Prompts match" should not mean adding a third copy of the same CSS. Extract one DateRangeFilter component, adopt it in all three, and the inconsistency cannot come back the next time someone adds a page.
The decision this needs
Visual and placement parity is straightforward. The option set is not, and should be decided deliberately rather than by copying:
24h,7d,30d,90dmap cleanly onto what Prompts already does — the page takes adaysnumber and passes it togetPromptVisibilitySummaries.AllandCustomdo not. They are date ranges, and the Prompts data path currently accepts only a day count, so supporting them means threading a from/to range throughgetPromptsPageDataand the summaries query.
Recommended: adopt the shared component and the 24h/7d/30d/90d options now, and treat All/Custom on Prompts as a follow-up once the range plumbing is warranted. That gets full visual and positional consistency without a server-side change riding along in a design PR.
Also keep
The Insights tab on Prompts hides the range control on purpose — that tab shows keyword volume estimates, which have no date dimension, so a range there would be a control that changes nothing. That behaviour should survive the refactor.
Acceptance criteria
- One shared date range component, used by Visibility, Citations and Prompts; no page keeps its own copy of the markup.
- On all three pages the control carries the same label, the same styling, and the same position relative to the surrounding filters.
- Prompts offers
24h,7d,30d,90d; the existing URL sync (?range=) keeps working and the default stays 30 days. - Visibility and Citations behave exactly as they do today, including
AllandCustomand their custom from/to inputs. - The range control stays hidden on the Prompts Insights tab.
Activity
feat(web): one date range control across Visibility, Citations and Pr…