Skip to content

refactor(citations): make the source scope a segmented control beside the table it scopes - #748

Merged
gkhngyk merged 1 commit into
mainfrom
feature/citations-source-scope-segmented
Aug 20, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/citations-source-scope-segmented

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

The own/competitor/third-party filter on Citations was a dropdown at the end of the page's filter bar. It is now a segmented control inside the Top Sources card, next to the tables it actually scopes.

Two things were wrong with where it sat.

It was the only control in the bar with no label. Topic, Prompt, Platform and Region each name themselves above the input. This one leaned on a Sources placeholder that its own default value covered up — so the bar ended in a box reading "All", with nothing on screen saying all of what. It also carried none of the sizing its neighbours share (h-8 w-40 text-xs), so it rendered taller and in a larger type than the rest of the row.

It does not scope the page. The KPI cards count every citation whatever it says, and Competitor Gaps and Source Types read the same data regardless — it narrows the Domains and URLs tables and nothing else. Sitting among the page-wide filters it claimed a reach it never had.

It now renders as a segmented control shaped like the date-range control, so the two read as the same kind of choice.

One deliberate deviation from the mockup

The design shows the control standing above all four tabs. It renders only on Domains and URLs — the two it applies to — because a control sitting over Competitor Gaps that does nothing when clicked is worse than the alternative. The cost is that the tab row shifts up by about 40px when you switch to Gaps or Source Types. Happy to make it always-visible if the mockup should be followed literally; it is a one-line change.

Also removed

Related issue

None — follow-up on the source filters merged in #742.

Type of change

  • refactor — Code change that neither fixes a bug nor adds a feature

How to test

  1. Open Citations. The filter bar now ends at Region; there is no unlabelled dropdown after it.
  2. In the Top Sources card, the scope now reads as four buttons above the tabs, with All selected.
  3. Click Brand, Competitors, Third-Party on the Domains tab — the table narrows as before. Same on URLs.
  4. Switch to Competitor Gaps or Source Types — the buttons are not shown, since neither tab is affected by them.
  5. Open a domain's detail page (/dashboard/citations/url) — its filter bar is unchanged, and never showed this control.

Known inconsistency, left alone

The tab counts (Domains (4300), URLs (11169)) are unfiltered totals, so picking Competitors leaves the heading unchanged while the table shrinks. Moving the control next to the tabs makes that more visible, but the fix is not obvious: the URL table is capped at 2,000 rows while the true unique-URL count is far higher, so switching the label to the filtered row count would trade one wrong number for another. Worth deciding separately.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/)
  • 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

… the table it scopes

The own/competitor/third-party filter was a dropdown at the end of the page's
filter bar, which misplaced it twice over.

It was the only control there with no label. Every other filter — Topic,
Prompt, Platform, Region — names itself above the input; this one leaned on a
"Sources" placeholder that its own default value ("All") covered up, so the bar
ended in a box reading "All" with nothing on screen saying all of what. It also
carried none of the sizing the others share, so it rendered taller and in a
larger type than its neighbours.

And it does not scope the page. The KPIs count every citation whatever it says,
and Competitor Gaps and Source Types ignore it outright — it narrows the Domains
and URLs tables and nothing else. Sitting among the page-wide filters it claimed
a reach it never had.

It now renders as a segmented control inside the Top Sources card, above the two
tabs it applies to and hidden on the two it does not, shaped like the date-range
control so the two read as the same kind of choice.

Also drops the `showCategoryToggles` prop, which existed only to hide this
dropdown on the single-URL page, and the unused Button import left behind by
#742.
@gkhngyk
gkhngyk merged commit bafae3f into main Aug 20, 2026
6 checks passed
@gkhngyk
gkhngyk deleted the feature/citations-source-scope-segmented branch August 20, 2026 13:16
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.

1 participant