Add basic issue view, styling and ux need improvement

This commit is contained in:
Robin Olsen
2026-02-04 15:22:32 +01:00
parent b56a0a3f43
commit 008bfd1efb
11 changed files with 364 additions and 6 deletions

View File

@@ -0,0 +1,38 @@
package dashboard
import (
"fmt"
"io"
"github.com/LazyBachelor/LazyPM/pkg/tui/styles"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
)
type IssueListDelegate struct{}
func (d IssueListDelegate) Height() int { return 2 }
func (d IssueListDelegate) Spacing() int { return 1 }
func (d IssueListDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil }
func (d IssueListDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) {
issue, ok := listItem.(ListIssue)
if !ok {
return
}
id := issue.ID
title := issue.Title()
description := issue.Description()
str := fmt.Sprintf("ID: %s\t%s\nDescription:\t%s", id, title, description)
fn := styles.ItemStyle.Render
if index == m.Index() {
fn = func(s ...string) string {
return styles.SelectedItemStyle.Render(s...)
}
}
fmt.Fprint(w, fn(str))
}