Skip to content

feat: add history events filter#720

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

feat: add history events filter#720
moudi-network wants to merge 5 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 event-type filter controls to the history view, including select all/none, an active filter count badge, and per-type toggles.
    • History results are now filtered by the selected event types, with tailored empty states when nothing matches.
  • Bug Fixes
    • Improved infinite scrolling so additional items load only when appropriate, including while filtering is active.
  • Style
    • Added a hideBorder option to horizontal scroll containers for cases where the bottom border should be removed.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8e733d9c-8f40-4c37-ad1b-0cfdcb54e943

📥 Commits

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

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

📝 Walkthrough

Walkthrough

Adds event-type filtering to account history through a new popover, shared filter metadata, layout-owned selection state, filtered event rendering, tailored empty states, and updated infinite scrolling. Also adds an optional hideBorder setting to HorizontalScrollContainer.

Changes

History event filtering feature

Layer / File(s) Summary
Filter metadata and lookup maps
components/HistoryView/HistoryFilter.tsx
Defines event filter keys, labels, typename mappings, and derived lookup helpers.
HistoryFilter popover controls
components/HistoryView/HistoryFilter.tsx
Provides the filter trigger, active count, select-all/clear controls, and keyboard-accessible filter rows.
Account layout filter state and wiring
layouts/account.tsx
Stores selected filters, handles toggle and bulk actions, renders the history filter, and passes selections to HistoryView.
Filtered history rendering and loading
components/HistoryView/index.tsx
Filters visible events, renders tailored empty states, and gates intersection-based loading when no filters are selected.

Horizontal scroll border option

Layer / File(s) Summary
hideBorder styling option
components/HorizontalScrollContainer/index.tsx
Adds an optional hideBorder prop that suppresses the bottom border styling.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant HistoryFilter
  participant AccountLayout
  participant HistoryView

  User->>HistoryFilter: toggle event filter
  HistoryFilter->>AccountLayout: onToggle(filterKey)
  AccountLayout->>AccountLayout: update selectedHistoryFilters
  AccountLayout->>HistoryView: pass selectedFilters
  HistoryView->>HistoryView: compute visibleEvents
  alt no events visible
    HistoryView->>User: show tailored empty state
  else events visible
    HistoryView->>User: render filtered history
  end
Loading

Suggested reviewers: ecwireless

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: adding a history events filter.
Description check ✅ Passed The description matches the template well, with change type, issues, changes, testing, risk, screenshots, and notes.
Linked Issues check ✅ Passed The PR implements the requested account history event-type filtering and popover UI described in #511.
Out of Scope Changes check ✅ Passed The extra UI, empty-state, and scrolling updates are all tied to the history filter feature and not clearly out of scope.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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 Outdated
Comment thread components/HistoryView/HistoryFilter.tsx
Comment thread layouts/account.tsx Outdated
@rickstaa
rickstaa self-requested a review July 7, 2026 13:58
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explorer-arbitrum-one Ready Ready Preview, Comment Jul 7, 2026 2:01pm

Request Review

@rickstaa

rickstaa commented Jul 7, 2026

Copy link
Copy Markdown
Member

@moudi-network thanks for the contribution.

@mehrdadmms did an initial review, and everything looks good so far. The implementation works, and the code quality is high enough for the bounty to be paid out. I may request a few minor code and UI changes after Adam has reviewed it.

@JJassonn69

JJassonn69 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
Screenshot 2026-07-24 at 12 25 04 PM Screenshot 2026-07-24 at 12 25 29 PM

Having a single toggle to either select all or none would be very user friendly. Also the unchecked checkbox outline is also very faint against the popover background.

@moudi-network

@mazlumtoprak

Copy link
Copy Markdown

Screenshot 2026-07-24 at 12 25 04 PM Screenshot 2026-07-24 at 12 25 29 PM
Having a single toggle to either select all or none would be very user friendly. Also the unchecked checkbox outline is also very faint against the popover background.

@moudi-network

Added the toggle now on Event Types and removed the two other buttons. Also tried to add more contrast ot the checkboxes.

image

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

4 participants