Skip to content

feat(income): add account filter to income page with mobile drawer#767

Merged
afadil merged 2 commits intomainfrom
feature/awesome-leakey
Mar 19, 2026
Merged

feat(income): add account filter to income page with mobile drawer#767
afadil merged 2 commits intomainfrom
feature/awesome-leakey

Conversation

@afadil
Copy link
Owner

@afadil afadil commented Mar 19, 2026

Changes

Frontend

  • Added account filter dropdown to income page (desktop) and mobile filter sheet drawer
  • Created new IncomeMobileFilterSheet component for mobile filter interface
  • Added createPortfolioAccount() helper function to create synthetic "All Portfolio" account for filter defaults
  • Updated income summary query to support optional accountId parameter
  • Modified getIncomeSummary() adapter to accept optional accountId parameter
  • Added account selector UI with visual indicator when filter is active on mobile
  • Updated period selector to work alongside account filter on both desktop and mobile layouts

Backend

  • Updated get_income_summary() API endpoint to accept optional accountId query parameter
  • Modified Tauri command to pass through account_id parameter
  • Updated IncomeServiceTrait to accept optional account ID in get_income_summary()
  • Modified ActivityRepositoryTrait.get_income_activities_data() to filter by account ID when provided
  • Updated SQLite repository to build dynamic SQL query with account filter clause

Types & Constants

  • Exported createPortfolioAccount from lib types
  • Added helper function to create portfolio account object with standard properties

Test Updates

  • Updated all mock implementations of get_income_activities_data() to accept optional account ID parameter

Thread an optional account_id parameter through the income summary API
(Tauri command, Axum endpoint, service trait, SQL query) so users can
filter income by account.

Frontend changes:
- Add AccountSelector (desktop) and a bottom-sheet filter drawer (mobile)
  to the income page, matching the holdings page pattern.
- Extract createPortfolioAccount() helper into constants.ts to eliminate
  duplicated dummy-account construction.
- Fix missing `relative` class on the empty-state mobile filter button
  (dot indicator was mis-positioned).
- Align queryKey with the actual accountId parameter to prevent stale
  cache issues.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 661cccdb05

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let activities = match self.activity_repository.get_income_activities_data() {
let activities = match self
.activity_repository
.get_income_activities_data(account_id)

Choose a reason for hiding this comment

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

P1 Badge Scope first-activity baseline to the filtered account

After adding account_id filtering, this method now loads income rows for a single account but still computes monthly-average denominators from get_first_activity_date_overall(), which is portfolio-wide. In environments where another account has older history, per-account summaries will divide by too many months and understate monthlyAverage (and related period month counts) for the new account-filtered view.

Useful? React with 👍 / 👎.

When account_id is provided, use get_first_activity_date (scoped to
that account) instead of get_first_activity_date_overall (portfolio-
wide). This fixes monthlyAverage being understated for per-account
views when other accounts have older history.
@afadil afadil merged commit b262095 into main Mar 19, 2026
1 of 2 checks passed
@afadil afadil deleted the feature/awesome-leakey branch March 19, 2026 17:33
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.

1 participant