Merge remote-tracking branch 'origin/main' into WIP-LPM-79

This commit is contained in:
Robin Olsen
2026-03-06 16:02:50 +01:00
45 changed files with 2385 additions and 212 deletions

View File

@@ -57,7 +57,7 @@ func (h HelpBar) View() string {
func (h HelpBar) shortHelp() string {
keys := make([]string, 0, len(h.config.ShortItems))
for _, item := range h.config.ShortItems {
keys = append(keys, styles.HighlightKey(item.Key)+" "+item.Desc)
keys = append(keys, styles.HighlightKey(item.Key)+item.Desc+" ")
}
content := lipgloss.JoinHorizontal(lipgloss.Left, keys...)
return lipgloss.NewStyle().
@@ -128,6 +128,7 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
{Key: "a", Desc: "add"},
{Key: "e/d/s/p/t", Desc: "edit"},
{Key: "x", Desc: "delete"},
{Key: "S", Desc: "submit"},
{Key: "q", Desc: "quit"},
{Key: "?", Desc: "help"},
},
@@ -140,7 +141,7 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
{LeftKey: "s", LeftDesc: "change status", RightKey: "p", RightDesc: "change priority"},
{LeftKey: "t", LeftDesc: "change type", RightKey: "x", RightDesc: "delete issue"},
{LeftKey: "v", LeftDesc: "kanban", RightKey: "q", RightDesc: "quit"},
{LeftKey: "?", LeftDesc: "help", RightKey: "", RightDesc: ""},
{LeftKey: "S", LeftDesc: "submit", RightKey: "?", RightDesc: "help"},
},
}
case ViewKanban:
@@ -156,6 +157,7 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
{Key: "e/d/s/p/t", Desc: "edit"},
{Key: "x", Desc: "delete"},
{Key: "q", Desc: "quit"},
{Key: "S", Desc: "submit"},
{Key: "?", Desc: "help"},
},
FullRows: []FullRow{
@@ -167,7 +169,8 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
{LeftKey: "e", LeftDesc: "edit title", RightKey: "d", RightDesc: "edit description"},
{LeftKey: "s", LeftDesc: "change status", RightKey: "p", RightDesc: "change priority"},
{LeftKey: "t", LeftDesc: "change type", RightKey: "x", RightDesc: "delete issue"},
{LeftKey: "q", LeftDesc: "quit", RightKey: "?", RightDesc: "help"},
{LeftKey: "q", LeftDesc: "quit", RightKey: "S", RightDesc: "submit"},
{LeftKey: "?", LeftDesc: "help", RightKey: "", RightDesc: ""},
},
}
default:

View File

@@ -1,6 +1,8 @@
package components
import (
"time"
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/LazyBachelor/LazyPM/pkg/tui/styles"
"github.com/charmbracelet/bubbles/viewport"
@@ -10,6 +12,7 @@ import (
type IssueDetail struct {
viewport viewport.Model
issue models.Issue
comments []*models.Comment
focused bool
}
@@ -26,6 +29,12 @@ func (i *IssueDetail) SetIssue(issue models.Issue) {
i.refreshContent()
}
// SetComments updates the list of comments displayed for the current issue.
func (i *IssueDetail) SetComments(comments []*models.Comment) {
i.comments = comments
i.refreshContent()
}
func (i *IssueDetail) SetSize(width, height int) {
i.viewport.Height = height
@@ -61,19 +70,34 @@ func (i *IssueDetail) refreshContent() {
descLabel := styles.LabelStyle.Render("Description:")
descContent := styles.ValueStyle.Render(i.issue.Description)
content := lipgloss.JoinVertical(lipgloss.Left,
titleRow,
idRow,
typeRow,
statusRow,
priorityRow,
descLabel,
descContent,
)
var parts []string
parts = append(parts, titleRow, idRow, typeRow, statusRow, priorityRow, descLabel, descContent)
// Comments section
commentsLabel := styles.LabelStyle.Render("Comments:")
parts = append(parts, commentsLabel)
if len(i.comments) == 0 {
parts = append(parts, lipgloss.NewStyle().Foreground(styles.FaintText).Render(" No comments yet."))
} else {
for _, c := range i.comments {
authorDate := lipgloss.NewStyle().Foreground(styles.Primary).Render(c.Author) + " " +
lipgloss.NewStyle().Foreground(styles.FaintText).Render(formatCommentTime(c.CreatedAt))
commentRow := lipgloss.JoinVertical(lipgloss.Left,
authorDate,
styles.ValueStyle.Render(c.Text),
)
parts = append(parts, commentRow)
}
}
content := lipgloss.JoinVertical(lipgloss.Left, parts...)
i.viewport.SetContent(content)
}
func formatCommentTime(t time.Time) string {
return t.Format("Jan 2, 15:04")
}
func (i IssueDetail) View() string {
content := i.viewport.View()