Repository navigation
feat(prompts): Top Sources card on the prompt detail page - #495
Merged
Merged
Conversation
Aggregates the prompt's already-loaded results by cited domain in getPromptDetail (same classification, rounding and row shape as the citations overview) and renders a Top Sources table between the KPI row and Platform Results: favicon, category badge, per-provider dots, usage bar and citation count, with a top-10 preview and show-all toggle. The shared cells (DomainFavicon, CategoryBadge, PlatformsCell, UsageBar) moved from the citations page into components/citations/source-cells.tsx so both pages render domains identically.
…elow Platform Results URL rows aggregate with the same normalization as the citations overview (strip query/fragment and trailing slash) and render like the citations URLs tab: title link, domain, category badge, provider dots, usage bar and citation count. Both tabs keep the top-10 preview with a show-all toggle, and the card now sits at the end of the page.
Replace the show-all toggle with the citations-style TablePager (100 rows per page, continuous rank across pages). TablePager and usePagination moved from the citations page into components/table-pager so both pages share one implementation; the reset-on-key-change logic now uses the adjust-state-during-render pattern instead of a ref write, which the react-hooks/refs lint rule rejects.
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
Adds a Top Sources card to the prompt detail page (
/dashboard/prompts/[id]), answering "which sources do AI platforms cite when answering this prompt?" — the per-prompt counterpart of the citations page.getPromptDetailnow aggregates the prompt's already-loaded results by cited domain and by normalized URL (query/fragment and trailing slash stripped), using the sameclassifyDomain/extractHostnamehelpers, rounding, and row shape asgetCitationsOverview, so both pages always agree on a domain's name, category, and usage. Adds two additive fields toPromptDetailData:topSourcesandtopSourceUrls.DomainFavicon,CategoryBadge,PlatformsCell,UsageBar→components/citations/source-cells.tsxTablePager,usePagination,PAGE_SIZE→components/table-pager.tsx(the reset-on-filter-change logic now uses the adjust-state-during-render pattern instead of a ref write, which thereact-hooks/refslint rule rejects)Related issue
—
Type of change
feat— New featureHow to test
/dashboard/prompts/<id>) for a prompt with tracking results./dashboard/citations(same period ≈ all time): category and look should match.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)