Merge pull request #73 from LazyBachelor/LPM-138

LPM-138 Refactor Tui with composable modals and use canvas

Refactors the TUI (dashboard + kanban) to use a shared, composable modal system with canvas-based overlay rendering, while consolidating styling into internal/style and expanding issue interactions (e.g., comments).

Changes:

Introduces a new pkg/tui/modal system (manager/stack + multiple modal types) and overlays modals using Lipgloss compositor layers.
Refactors dashboard/kanban views and input handling to use the modal manager + focus manager instead of per-modal boolean state.
Consolidates TUI styling by moving from pkg/tui/styles to internal/style and updates components to use the new style package; adds a shared footer renderer.
This commit is contained in:
Robin Olsen
2026-03-20 08:28:10 -07:00
committed by GitHub
parent 9a47acc49a
commit 7facfb6afe
27 changed files with 2469 additions and 1752 deletions

View File

@@ -0,0 +1,48 @@
package components
import (
"charm.land/lipgloss/v2"
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/LazyBachelor/LazyPM/internal/style"
"github.com/LazyBachelor/LazyPM/internal/utils/truncate"
)
// RenderFooter renders the shared footer with the help bar and optional
// validation feedback message.
func RenderFooter(width int, helpBar *HelpBar, feedback models.ValidationFeedback) string {
feedbackStatus := feedback.Message
// Ensure the feedback message does not exceed the total available width.
if feedback.Message != "" {
// Allocate at least 30% of width for feedback, but not more than 60%
feedbackWidth := max(width*3/10, min(width/2, 50))
styledFeedback := style.ErrorStyle.Render(feedbackStatus + " [Press '?' for details]")
feedbackStatus = truncate.TruncateToWidth(styledFeedback, feedbackWidth)
if helpBar.IsExpanded() && feedbackStatus != "" {
for _, check := range feedback.Checks {
var prefix string
if check.Valid {
prefix = "✅ "
} else {
prefix = "❌ "
}
remainingWidth := max(width/2, 10)
styledCheckMsg := style.TextStyle.Render(check.Message)
truncatedMsg := truncate.TruncateToWidth(styledCheckMsg, remainingWidth)
feedbackStatus += "\n" + prefix + truncatedMsg
}
}
}
if feedbackStatus == "" {
return helpBar.View()
}
helpWidth := max(width-lipgloss.Width(feedbackStatus), 0)
helpBar.SetWidth(helpWidth)
return lipgloss.JoinHorizontal(lipgloss.Left, helpBar.View(), feedbackStatus)
}