feat(income): add account filter to income page with mobile drawer#767
feat(income): add account filter to income page with mobile drawer#767
Conversation
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.
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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.
Changes
Frontend
IncomeMobileFilterSheetcomponent for mobile filter interfacecreatePortfolioAccount()helper function to create synthetic "All Portfolio" account for filter defaultsaccountIdparametergetIncomeSummary()adapter to accept optionalaccountIdparameterBackend
get_income_summary()API endpoint to accept optionalaccountIdquery parameteraccount_idparameterIncomeServiceTraitto accept optional account ID inget_income_summary()ActivityRepositoryTrait.get_income_activities_data()to filter by account ID when providedTypes & Constants
createPortfolioAccountfrom lib typesTest Updates
get_income_activities_data()to accept optional account ID parameter