Skip to content

feat(slice-006): create portfolio left panel with navigation and create dialog#7

Merged
fredericomozzato merged 9 commits into
mainfrom
feat/006-create-portfolio-left-panel
Apr 12, 2026
Merged

feat(slice-006): create portfolio left panel with navigation and create dialog#7
fredericomozzato merged 9 commits into
mainfrom
feat/006-create-portfolio-left-panel

Conversation

@fredericomozzato
Copy link
Copy Markdown
Owner

@fredericomozzato fredericomozzato commented Apr 12, 2026

Summary

  • Add portfolio store methods (CreatePortfolio, GetAllPortfolios) with full SQLite tests
  • Implement portfolio left panel with cursor, j/k navigation, and reverse-video highlight
  • Add create dialog (max 50 chars, Enter saves, Esc cancels) using lipgloss.Place for centered overlay
  • Add "Portfolios" and "Holdings" panel titles inside borders

Bug Fixes (discovered during review)

Panel layout:

  • Fix bordered panels consuming 2 extra rows, pushing the tab bar off screen (contentHeight := m.height - 3)
  • Fix left + right panel outer widths summing to m.width + 3, causing horizontal overflow
  • Fix renderLeftPanel receiving contentHeight-2 — border offset already handled by lipgloss, hiding 2 panel rows unnecessarily

Dialog:

  • Fix renderDialogOverlay ignoring its background parameter (panels vanished behind dialog)
  • Fix ANSI-unaware byte-level string slicing in overlayDialog corrupting dialog layout; replaced with lipgloss.Place

Data loading:

  • Fix portfoliosLoadedMsg being dropped when Markets tab is active on startup; background messages are now fanned out to both child models in app.go

Cleanup:

  • Remove unused height parameter from renderRightPanel

Test Plan

  • go test -race -v ./internal/store/... -run "Portfolio" → 5 tests PASS
  • go test -race -v ./internal/ui/... -run "Portfolio" → 23 tests PASS
  • golangci-lint run ./... → no issues
  • Navigate portfolios with j/k, cursor highlights full row width
  • Press n to open create dialog, Enter saves, Esc cancels
  • Portfolios load correctly when starting on the Markets tab (not just after first create)
  • Panel borders and tab bar fit within terminal without overflow

Closes findings I1 and I2 in docs/reviews/006-create-portfolio-left-panel/revision-1.md

- I1: Implement overlayDialog helper to show panels behind dialog
- I2: Remove unused height parameter from renderRightPanel
…d width calculations

- I1: Fixed contentHeight to account for border rows (m.height - 3)
- I2: Replaced byte-level overlayDialog with lipgloss.Place centered dialog
- I3: Fixed panel width calculations using outer/inner width distinction

Closes findings I1, I2, I3 in docs/reviews/006-create-portfolio-left-panel/revision-2.md
- I1 (HIGH): Fan out background messages to both child models in app.go
  so portfoliosLoadedMsg is not dropped when Markets tab is active.

- I2 (LOW): Add 'Portfolios' and 'Holdings' titles to left and right panels.

- Added tests for both behaviors:
  * TestBackgroundMessagesFannedOutToBothChildren
  * TestPanelTitlesDisplayed

Closes findings I1, I2 in docs/reviews/006-create-portfolio-left-panel/revision-3.md
Closes finding I1 in docs/reviews/006-create-portfolio-left-panel/revision-4.md
@fredericomozzato fredericomozzato merged commit 5b8d01f into main Apr 12, 2026
5 checks passed
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