Skip to content

Prompt detail: 10-per-page Top Sources pagination and a URL/domain filter #530

Closed

Description

@gkhngyk

Problem

The Top Sources card on the prompt detail page (web/src/app/[locale]/(dashboard)/dashboard/prompts/[id]/page.tsx, TopSourceDomainsTable / TopSourceUrlsTable) technically paginates, but the shared PAGE_SIZE constant is 100 (web/src/components/table-pager.tsx) — so in practice everything renders as one very long page at the bottom of the prompt detail.

There is also no way to filter the list. A common need is checking whether your own pages got cited for this prompt — today that means scanning the whole table row by row.

Fix

Two small, related changes in the same component:

  1. 10-per-page pagination — add an optional pageSize parameter to usePagination (default PAGE_SIZE = 100 so the citations page keeps its current behavior), and pass 10 from the two prompt-detail Top Sources tables.
  2. Filter box — add a small search input to the Top Sources card that filters rows by case-insensitive substring match on domain, URL and title. It applies to both tabs (Domains / URLs). Everything is already client-side — no backend change. Pass the filter string as the pager's resetKey (see how the citations page passes filterKey to usePagination) so changing the filter jumps back to page 1. Keep the rank column's global numbering (pager.start + i + 1) based on the filtered list.

Nice-to-have (optional, not required): visually highlight rows whose domain matches the brand's own domain.

Acceptance criteria

  • Both Top Sources tabs page through rows 10 at a time with the existing Previous/Next footer; the citations page still pages by 100.
  • Typing in the filter narrows both tabs by domain/URL/title substring and resets the pager to the first page; clearing it restores the full list.
  • Rank numbers stay continuous across pages of the filtered list.
  • yarn lint, yarn typecheck, yarn format:check pass from web/.

Getting started

See CONTRIBUTING.md for setup. Comment here to claim the issue before opening a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions