move delegate to issue_list

This commit is contained in:
Robin Olsen
2026-02-10 17:49:22 +01:00
parent 41bde2d1f4
commit 6ee8e67858

View File

@@ -1,38 +0,0 @@
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))
}