Repository navigation
feat: rebuild Accounts page into componentized grid layout - #140
Conversation
Replace monolithic accordion-card Accounts.jsx (900 lines) with a componentized grid layout matching the accounts-playground mock. New components: - AllocationStrip: stacked bar showing per-account portfolio share - AccountCard: grid card with broker logo, value, holdings pills, sync status - AccountGrid: auto-fill grid + dashed add-account placeholder card - AccountSidebar: slide-over with summary, holdings list, and P&L New hook: - useAccountsData: fetches accounts + dashboard summary + positions in parallel, enriches accounts with values/allocation/sync, groups positions by account_id for per-account holdings without N+1 calls AccountWizard integration preserved; broker-data fetch removed (unused in new architecture). Closes #127 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 2 issues:
finch/frontend/src/hooks/useAccountsData.js Lines 19 to 25 in 863c9bc (Consumers: AccountCard.jsx#L64-L67, AccountSidebar.jsx#L120-L124)
finch/frontend/src/pages/Accounts.jsx Lines 40 to 46 in 863c9bc 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
- Fix getSyncStatus unknown case using text- class instead of bg- (score 85) - Fix stale selectedAccount snapshot after refresh via accounts.find() live lookup (score 85) - Add limit: 100 to /accounts fetch to match backend max and avoid silent 50-account truncation (score 75) - Track positionsTruncated from /positions has_more and surface in sidebar when >100 positions (score 75) - Restore management actions in AccountSidebar: rename (inline), delete (confirmation), upload data, API credentials (score 75) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 4 issues:
finch/frontend/src/pages/Accounts.jsx Lines 55 to 63 in b829283
finch/frontend/src/pages/Accounts.jsx Lines 201 to 212 in b829283
finch/frontend/src/pages/Accounts.jsx Lines 56 to 70 in b829283 finch/frontend/src/components/accounts/AccountSidebar.jsx Lines 65 to 70 in b829283
finch/frontend/src/pages/Accounts.jsx Lines 189 to 200 in b829283 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
- Fix handleDelete to use unlink endpoint for shared accounts (portfolio_ids.length > 1)
uses DELETE /portfolios/{pid}/accounts/{id} instead of always hard-deleting
- Fix hasCredentials hardcoded false: fetch GET /brokers/{type}/credentials/{id}
before opening ApiCredentialsModal; restore onGoToSettings navigation
- Fix silent failures: handleDelete/handleRename now throw on non-ok response;
AccountSidebar.handleDeleteConfirm catches and shows inline error, only resets
spinner on the error path (success closes sidebar naturally)
- Fix BatchUploadModal two-callback contract: refresh() moved to onComplete,
onClose only handles modal state cleanup (no spurious refresh on cancel)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 3 issues:
finch/frontend/src/components/accounts/AccountSidebar.jsx Lines 40 to 47 in f4d6d98
finch/frontend/src/pages/Accounts.jsx Lines 219 to 231 in f4d6d98 finch/frontend/src/components/BatchUploadModal.jsx Lines 96 to 100 in f4d6d98
finch/frontend/src/components/accounts/AccountSidebar.jsx Lines 36 to 47 in f4d6d98 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
- Reset all local sidebar state (rename/delete/error) when switching accounts via useEffect keyed on account?.id; null guard skips reset during close animation - Preserve sidebar content during 200ms slide-out by keeping last non-null account in a ref (renderAccount = account ?? prevAccountRef.current) - Conditionally render BatchUploadModal so sessionId is freshly generated on each open instead of reusing the same session across uploads Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
When the user presses Escape to cancel an inline rename, removing the input from the DOM triggers onBlur -> commitRename, silently saving the change. A cancelRenameRef flag is set before setEditingName(false) so commitRename exits early when called from blur after Escape. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
positionsTruncated was a portfolio-wide flag that triggered a misleading
warning inside individual account holdings cards — an account with 3
positions would show "Portfolio has more than 100 positions" whenever
the total portfolio exceeded the limit.
Replace with a per-account check: compare renderAccount.holdingCount
(from dashboard summary) against holdings.length. The warning now only
appears for accounts whose holdings are actually truncated, and the
message shows exact counts ("Showing X of Y positions").
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix account name clipping: X button is now absolute-positioned, freeing full header width for the name; View Details moves to sit beside the value number - Cap holdings preview at 5 (top by market value); show "+N more" footer when the account has additional positions - Add Recent Activity card: fetches last 5 transactions across all types (trades/dividends/forex/cash) filtered by account_id, with a skeleton loading state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…links - Remove holdings count from card title - Remove Upload Data and API Credentials actions (moved to account details page) - Remove dead BatchUploadModal, ApiCredentialsModal, and related state from Accounts.jsx - Add "View all holdings" footer button → /accounts/:id?tab=holdings - Add "View all activity" footer button → /accounts/:id?tab=transactions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The useEffect only handled tab=settings; holdings and transactions were silently ignored, leaving the page on the Overview tab. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ebar - AccountCard: trash icon in footer footer triggers an inline overlay confirmation (stopPropagation prevents opening the sidebar); handles shared vs. owned accounts (Remove vs. Delete label) - AccountGrid: thread onDelete through to AccountCard - AccountSidebar: remove Manage section entirely (delete state, handlers, ActionButton helper, onDelete prop, TrashIcon import) - Accounts.jsx: pass onDelete to AccountGrid, drop from AccountSidebar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code reviewFound 1 issue:
finch/frontend/src/components/accounts/AccountSidebar.jsx Lines 193 to 200 in 2432fc4 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Code review (additional findings)Posting the remaining issues that scored 75 confidence (the issue above scored 90). These are genuine but lower-severity than the Escape/rename bug:
finch/frontend/src/hooks/useAccountsData.js Lines 96 to 106 in 2432fc4 (Hook returns it: useAccountsData.js#L147; page omits it from the destructure) finch/frontend/src/pages/Accounts.jsx Lines 22 to 25 in 2432fc4
finch/frontend/src/components/accounts/AccountCard.jsx Lines 24 to 33 in 2432fc4
finch/frontend/src/pages/Accounts.jsx Lines 165 to 166 in 2432fc4 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
… jank - AccountSidebar: add e.stopPropagation() on Escape in rename input so the event doesn't bubble to useSlideover's document listener and close the entire panel when the user is just cancelling a rename - AccountCard: add deleteError state; surface API error message inside the confirmation overlay instead of silently dismissing it - Accounts.jsx: mirror prevAccountRef pattern for holdings so the Top Holdings card stays visible during the 200ms sidebar slide-out after liveSelectedAccount becomes null Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When the portfolio has more than 100 positions the /positions endpoint truncates the response, leaving holdings pills, the allocation strip, and the sidebar previews silently incomplete. Re-add positionsTruncated to the useAccountsData destructure and show an amber banner above the allocation strip so the user knows the data is partial. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The banner previously said 'Open an account to see its full breakdown,' which was ambiguous: the sidebar's Top Holdings is derived from the same truncated /positions?limit=100 response and is just as partial. Point the user at the account's full details page (separate per-account fetch) and note that allocation is partial too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Accounts.jsx(900 lines) with a grid-card layout matching the accounts-playground mockuseAccountsDatahook fetches accounts + dashboard summary + positions in parallel, enriching each account with value, allocation %, sync status, and per-account holdings (pivoted from the positions endpoint — no N+1 calls)components/accounts/:AllocationStrip,AccountCard,AccountGrid,AccountSidebar,constants,iconsTransactionDetailSidebarpatternTest plan
/accounts/:idCloses #127
🤖 Generated with Claude Code