refactor: modal-based selectors with stack support (#62)#84
Conversation
Release v0.6.1
- ProfileSelector, RegionSelector, HelpView now use Modal overlay - q/Esc closes modal (no longer quits app) - Background remains visible (dimmed) for context - Closes #62
- Add newTestApp() helper to reduce test boilerplate - Consolidate modal open/close tests into table-driven patterns - Extract modal width magic numbers into named constants
- Add test to prevent future regression
- add modal stack for nested modals (ProfileDetail back to ProfileSelector) - add ModalWidthActionMenu=60, ModalWidthProfileDetail=65 - fix persistence overwriting unrelated config on region/profile change - remove dead ProfileSelector viewStack check
- Consolidate ShowModalMsg handler logic (both paths now push to stack) - Add tests: TestShowModalFromNormalState, TestModalStackClearedOnRegion/ProfileChange - Document modal system in docs/architecture.md (stack flow, width constants)
…ursion - Add clearModalState(), showModal(), handleNavigate() helpers - Add handleRegionChanged(), handleProfilesChanged(), popToRefreshableView() - Eliminate recursive Update() calls in handleModalUpdate - Reduce ShowModalMsg/NavigateMsg/RegionChangedMsg duplication
Pull Request Review: Modal-based selectors with stack support (#62)OverviewThis PR refactors the Help, Region Selector, Profile Selector, and Action Menu views from full-screen views to modals with nested modal stack support. The implementation is well-architected and includes comprehensive test coverage. ✅ Strengths1. Code Quality & Architecture
2. Test Coverage
3. User Experience
🔍 Issues & Concerns1. Critical Bug: Region Persistence
|
| Category | Rating | Notes |
|---|---|---|
| Code Quality | ⭐⭐⭐⭐⭐ | Excellent refactoring with helper functions |
| Test Coverage | ⭐⭐⭐⭐⭐ | Comprehensive tests including edge cases |
| Documentation | ⭐⭐⭐⭐ | Good architecture docs, minor godoc gaps |
| Performance | ⭐⭐⭐⭐⭐ | No concerns |
| Security | ⭐⭐⭐⭐⭐ | No concerns |
✅ Recommendation
APPROVE with minor clarifications requested
This is a well-implemented refactoring that improves code maintainability and UX. The main concern is clarifying the region persistence behavior mentioned in the PR description vs. the actual implementation.
Before merging, please clarify:
- Is the
AddRegionvsSetRegionfix only for theprofileRefreshDoneMsgpath (line 303)? - Is the removal of the ProfileSelector check from
handleProfilesChanged()intentional?
Great work overall! The modal stack implementation is clean and well-tested. 🎉
Generated by Claude Code PR Review
Summary
Changes
modalStackfield for nested modal supportshowModal(),popModal(),clearModalState()helpershandleNavigate(),handleRegionChanged(),handleProfilesChanged(),popToRefreshableView()to reduce duplicationAddRegioninstead ofSetRegionto preserve existing regions on profile refreshinternal/view/modal.godocs/architecture.mdwith modal system documentationTesting
Closes #62