refactor: consolidate style helpers, Go idioms, remove dead code (#87 #88 #89)#91
refactor: consolidate style helpers, Go idioms, remove dead code (#87 #88 #89)#91
Conversation
- service_browser: use TableHeaderStyle() and SelectedStyle() - use max()/min() builtins instead of if statements - use range over int for loop modernization
- Add 6 new theme helpers: SectionStyle, HighlightStyle, BoldSuccessStyle, BoldDangerStyle, BoldWarningStyle, BoldPendingStyle - Apply helpers across 8 view files for consistency - Fix hardcoded #ff0000 color in exec_with_header.go - Use max()/min() builtins in dashboard_view_panels.go - Use range-over-int in dashboard_view.go and dashboard_view_panels.go
- Remove unused width/height fields from 5 view structs - Apply DimStyle() across 11 locations - Apply SuccessStyle/WarningStyle/DangerStyle where applicable - Update tests to match field removal
…to render/action (#88)
…olidate truncate (#88)
Code Review: PR #91 - Refactor: Consolidate Style Helpers, Go Idioms, Remove Dead CodeSummaryThis is an excellent refactoring PR that significantly improves code quality, maintainability, and consistency. The changes are well-structured, thoroughly tested, and demonstrate strong software engineering practices. ✅ Strengths1. Code Quality & Best Practices
2. Dead Code Removal
3. Test Coverage ⭐
4. Migration Consistency
🔍 Potential Issues & SuggestionsMinor Issues (Optional Improvements)1. Potential Performance Consideration However, since lipgloss.Style is lightweight and this passes existing performance tests, this optimization may not be necessary. 2. Test Coverage - Could Be More Thorough That said, since lipgloss styles are primarily visual and the existing smoke tests verify basic functionality, this is acceptable. 3. ViewportState Naming 🔒 Security AssessmentNo security concerns identified.
⚡ Performance ConsiderationsOverall: Neutral to Positive
📊 Test CoverageExcellent ✅
🎯 RecommendationsRequired: NoneThis PR is ready to merge as-is. Optional Improvements (Future PRs):
Final VerdictLGTM 🚀 - Approve with enthusiasm This PR demonstrates:
The code is cleaner, more maintainable, and adheres to DRY principles. The migration from inline styles to consolidated helpers will make future UI changes much easier. The adoption of modern Go idioms demonstrates keeping the codebase current. Changes close issues #87, #88, #89 as stated. Great work! 👏 |
Summary
ViewportStatehelper to eliminate viewport initialization boilerplate across 5 viewsinternal/ui/theme.go(TitleStyle, SelectedStyle, BoxStyle, etc.)ui.XxxStyle()callsmax(),min(),cmp.Or(),slices.Collect(), range-over-intChanges
ui.XxxStyle()directlyTesting
task lint✅task test✅task build✅Closes #87, #88, #89