Skip to content

feat: add history events filter#720

Open
moudi-network wants to merge 4 commits into
livepeer:mainfrom
moudi-network:feat/711/history-events-filter
Open

feat: add history events filter#720
moudi-network wants to merge 4 commits into
livepeer:mainfrom
moudi-network:feat/711/history-events-filter

Conversation

@moudi-network

@moudi-network moudi-network commented Jul 1, 2026

Copy link
Copy Markdown

Description

Adds an event-type filter to the account History tab. A "Filter" popover on the nav row lets you show/hide history by event type (12 categories: Delegated, Reward calls, Reward cut & fee changes, Winning tickets, Votes, etc.), with All/None shortcuts and an active-count badge. Filter state is lifted to AccountLayout so the button sits beside the tabs while HistoryView consumes it.

Filtering is purely display-side: paging/loading is filter-agnostic, so the filter only changes what's shown, never what's fetched.

Type of Change

  • feat: New feature

Related Issue(s)

Related: #711
Closes: #511

Changes Made

Filter

  • New components/HistoryView/HistoryFilter.tsx. A popover that filters history events by type. EVENT_FILTERS maps each human-readable label to one or more event __typenames, with a reverse TYPENAME_TO_FILTER lookup; includes All/None shortcuts and an active-count badge
  • Lift filter state (selectedHistoryFilters) into layouts/account.tsx so the Filter button renders on the nav row beside the tabs; HistoryView takes a selectedFilters prop and renders only matching events (visibleEvents)
  • Add a hideBorder prop to components/HorizontalScrollContainer so the parent can draw a divider that spans both the tabs and the filter button on the nav row
  • Rework HistoryView infinite-scroll to a callback-ref IntersectionObserver that attaches once on sentinel mount, so paging never self-retriggers (a re-created observer would re-fire on the in-view sentinel and crawl the entire history on a short filtered list)
  • "None selected" suppresses auto-loading and shows a prompt; shared EmptyState card (matching Gateway/Delegator lists) with contextual messages

Testing

  • Tested locally
  • Added/updated tests
  • All tests passing

How to test (optional unless test is not trivial)

Filter

  • On the History tab, open Filter → toggle event types; the list updates to show only selected types. Check the active-count badge, All/None shortcuts, and that "None" shows the "Select at least one event type" prompt without crawling history. Confirm infinite scroll still pages normally with a partial filter.
  • pnpm typecheck, pnpm exec eslint … --max-warnings 0, prettier all clean.

Impact / Risk

Risk level: Low

Impacted areas: UI only (History tab nav row + filter popover). Display-only filtering. No DB, infra, config, API, or server code.

User impact: The History tab gains a Filter popover to narrow events by type. Default shows all events (current behavior), so the change is purely additive. Nothing existing is altered.

Rollback plan: Plain PR revert. The change is additive (new HistoryFilter component + a selectedFilters prop + a hideBorder prop), so reverting removes the filter with no migration or config cleanup.

Screenshots / Recordings (if applicable)

Screenshot 2026-06-28 at 00 56 23 Screenshot 2026-06-28 at 00 56 43

Additional Notes

  • History filtering is display-only. Loading/paging is identical to the unfiltered view (fetchNext no-ops at the end); the filter never changes what's fetched, only what's rendered.
  • Filter state is in-component, so it resets on tab switch (each tab is a separate route). Making it sticky (URL param) is a possible follow-up.

Summary by CodeRabbit

  • New Features
    • Added filter controls to the history view so users can narrow events by type, including quick select all/none actions and a visible count of active filters.
    • History results now update based on the selected event types, with clearer empty states when no items match.
  • Bug Fixes
    • Improved history loading behavior so more items are fetched only when needed while filtering is active.
  • Style
    • Added an option to hide the bottom border in horizontal scroll containers for cleaner layouts where needed.

Adds an event-type filter to the account History tab. The filter button
sits on the nav row beside the tabs; HistoryView consumes the selection
to decide which events to display. HorizontalScrollContainer gains a
hideBorder prop so the parent can draw a divider spanning the filter.
@moudi-network moudi-network requested a review from ECWireless as a code owner July 1, 2026 08:28
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@moudi-network is attempting to deploy a commit to the Livepeer Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@moudi-network, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32868ba6-03c8-4d08-aa3a-2e4cb6e4090b

📥 Commits

Reviewing files that changed from the base of the PR and between fe2c8f5 and dac050f.

📒 Files selected for processing (2)
  • components/HistoryView/HistoryFilter.tsx
  • layouts/account.tsx
📝 Walkthrough

Walkthrough

Adds a new HistoryFilter popover component with event-type filter constants and lookup maps, wires filter state into the account layout with toggle/select-all/clear handlers, updates HistoryView to filter displayed events and refactor infinite scrolling, and adds a hideBorder option to HorizontalScrollContainer.

Changes

History event filtering feature

Layer / File(s) Summary
Filter keys and lookup maps
components/HistoryView/HistoryFilter.tsx
Adds EventFilterKey type, EVENT_FILTERS labels/typenames mapping, and derived ALL_FILTER_KEYS/TYPENAME_TO_FILTER helpers.
HistoryFilter popover component
components/HistoryView/HistoryFilter.tsx
Implements HistoryFilterProps and the HistoryFilter component with a popover trigger, active count badge, All/None controls, and per-filter checkbox rows.
Account layout filter state and wiring
layouts/account.tsx
Adds selectedHistoryFilters state with toggle/select-all/clear callbacks, renders HistoryFilter in the history tab nav row, and passes selectedFilters to HistoryView.
HistoryView filtering and infinite scroll refactor
components/HistoryView/index.tsx
Accepts selectedFilters, computes visibleEvents/isFiltered/noneSelected, adds a shared EmptyState with tailored messaging, and refactors infinite scroll to a callback-ref-based IntersectionObserver.

Estimated code review effort: 3 (Moderate) | ~25 minutes

HorizontalScrollContainer border option

Layer / File(s) Summary
hideBorder prop and conditional styling
components/HorizontalScrollContainer/index.tsx
Adds optional hideBorder prop and conditionally omits the &::after bottom border CSS when set.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant HistoryFilter
  participant AccountLayout
  participant HistoryView

  User->>HistoryFilter: toggle filter checkbox
  HistoryFilter->>AccountLayout: onToggle(filterKey)
  AccountLayout->>AccountLayout: update selectedHistoryFilters Set
  AccountLayout->>HistoryView: selectedFilters prop
  HistoryView->>HistoryView: compute visibleEvents via TYPENAME_TO_FILTER
  alt no events visible
    HistoryView->>User: show tailored EmptyState message
  else events visible
    HistoryView->>User: render filtered event list
  end
Loading

Related issues: #511 — adds account transaction history filtering by event type via a popover filter button.

Suggested labels: enhancement, frontend

Suggested reviewers: livepeer/explorer maintainers

🐰 A rabbit hops through history's stream,
Sifting events by type and theme,
Checkboxes tick, the popover clicks,
Filtered lists replace the mix,
No border here, just filtered dreams.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding history event filtering.
Linked Issues check ✅ Passed The changes implement the requested account history filter popover and event-type filtering for all history entries.
Out of Scope Changes check ✅ Passed The added empty state, layout wiring, and hideBorder support all directly support the history filtering feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/HistoryView/HistoryFilter.tsx`:
- Around line 159-186: The All and None controls in HistoryFilter are
duplicating the same inline button styles, which should be centralized to
prevent drift. Extract the shared css object or a small reusable button
component for the two Box as="button" elements in HistoryFilter, and update
onSelectAll/onClear usage to reference that shared styling so both buttons stay
consistent as the popover changes.
- Around line 190-215: The filter rows in HistoryFilter are mouse-only because
the Flex wrapper handles onClick but is not focusable or keyboard-operable,
while the Checkbox is removed from the tab order. Update the row interaction in
EVENT_FILTERS.map so each row can receive focus and toggle via keyboard, using
the existing onToggle(filter.key) behavior. Ensure the clickable row has
appropriate accessibility semantics and key handling so users can activate it
without a mouse.

In `@layouts/account.tsx`:
- Around line 301-306: The tab anchor list in the tabs.map render is using the
array index as the React key, which is unstable. Update the key on the A/Link
element in the tab rendering logic to use the stable unique tab.href value
instead of i, keeping the rest of the tab mapping behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e40da406-9ca3-44ab-8de7-134bdfc2bf7d

📥 Commits

Reviewing files that changed from the base of the PR and between 48e5844 and fe2c8f5.

📒 Files selected for processing (4)
  • components/HistoryView/HistoryFilter.tsx
  • components/HistoryView/index.tsx
  • components/HorizontalScrollContainer/index.tsx
  • layouts/account.tsx

Comment thread components/HistoryView/HistoryFilter.tsx
Comment thread components/HistoryView/HistoryFilter.tsx
Comment thread layouts/account.tsx Outdated
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.

Add account transaction history filtering

1 participant