Repository navigation
feat(citations): inline "+" to add a cited domain as a competitor from the Domains table - #329
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an inline per-domain action on the Citations → Domains table so users can promote a cited third‑party domain into a tracked competitor without navigating away, reusing the existing addCompetitor action and Dialog UI primitive.
Changes:
- Added a per-row “+” action (hidden for
youandcompetitorcategories) that opens a confirmation dialog and callsaddCompetitor. - Implemented a small name-derivation helper to prefill the competitor name from the domain.
- Refreshes citations data after a successful add so the row updates from “+” to the Competitor badge.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+740
to
+743
| <Label htmlFor="add-competitor-name">Name</Label> | ||
| <Input | ||
| id="add-competitor-name" | ||
| value={name} |
| <TableHead className="text-xs">Platforms</TableHead> | ||
| <TableHead className="text-xs">Usage</TableHead> | ||
| <TableHead className="text-right text-xs">Avg Citations</TableHead> | ||
| <TableHead className="w-[44px]" /> |
Comment on lines
+708
to
+710
| } catch (err) { | ||
| toast.error(err instanceof Error ? err.message : 'Failed to add competitor'); | ||
| } finally { |
…m the Domains table Each Domains-table row for a third-party domain (news / review / forum / social / editorial / institutional / other) now shows a "+" that opens a confirm dialog to track it as a competitor. Our own domain (category 'you') and already-tracked competitors show no action — the latter already render the Competitor badge. The dialog pre-fills an editable name derived from the domain (caranddriver.com -> "Caranddriver") and calls the existing addCompetitor action; on success it refreshes the citations data so the row flips from "+" to the Competitor badge. No new server code or endpoints.
gkhngyk
force-pushed
the
feature/citations-add-competitor
branch
from
July 2, 2026 14:14
dc71ece to
51e1560
Compare
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
On the Citations page Domains tab, each row now has an inline "+" to turn a cited domain into a tracked competitor without leaving for the Competitors page.
Per-row behavior (uses the
categorythe row already carries — no extra fetch):news/review/forum/social/editorial/institutional/other) → shows "+".category === 'you') → no action.category === 'competitor') → no action; the row already renders the Competitor badge.Add flow: the "+" opens a confirm dialog — title "Add
caranddriver.comas competitor?", an editable Name input pre-filled from the domain (caranddriver.com→ "Caranddriver"), Cancel / Add (Add disabled while the name is empty, spinner while saving). It calls the existingaddCompetitor(brandId, { name, domain })(which already stripshttp(s)://+ trailing slashes). On success: toast + refresh the citations data, so the row flips from "+" to the Competitor badge.No new server code, endpoints, or migrations — reuses
addCompetitorand theDialogprimitive.Related issue
Closes #301
Type of change
feat— New featureHow to test
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)