Merge branch 'main' into Metrics-and-Logs

This commit is contained in:
Robin Olsen
2026-03-04 14:32:54 +01:00
9 changed files with 231 additions and 36 deletions

View File

@@ -47,6 +47,9 @@ type Model struct {
priorityIssueID string
choosingType bool // true while choosing a type
typeIssueID string
addingComment bool // true while adding a comment
commentInput textarea.Model
commentIssueID string
feedbackChan chan models.ValidationFeedback
quitChan chan bool
currentFeedback models.ValidationFeedback
@@ -89,15 +92,39 @@ func NewDashboard(app *app.App, feedbackChan chan models.ValidationFeedback, qui
descTa.SetHeight(8)
m.descriptionInput = descTa
commentTa := textarea.New()
commentTa.Placeholder = "Write your comment..."
commentTa.SetWidth(56)
commentTa.SetHeight(6)
m.commentInput = commentTa
if selected := m.issueList.SelectedItem(); selected.ID != "" {
m.issueDetail.SetIssue(selected.Issue)
m.setDetailIssueWithComments(selected.Issue)
} else if selected := m.closedIssueList.SelectedItem(); selected.ID != "" {
m.issueDetail.SetIssue(selected.Issue)
m.setDetailIssueWithComments(selected.Issue)
}
return m
}
// setDetailIssueWithComments sets the issue in the detail pane and loads its comments.
func (m *Model) setDetailIssueWithComments(issue models.Issue) {
m.issueDetail.SetIssue(issue)
if issue.ID == "" {
m.issueDetail.SetComments(nil)
return
}
comments, _ := m.app.Issues.GetIssueComments(context.Background(), issue.ID)
m.issueDetail.SetComments(comments)
}
func (m *Model) startAddComment(selected ListIssue) {
m.addingComment = true
m.commentIssueID = selected.ID
m.commentInput.SetValue("")
m.commentInput.Reset()
}
func (m *Model) logAction(action string) {
if m.app != nil {
m.app.LogAction(models.EncodeActionEvent(models.ActionEvent{
@@ -212,11 +239,11 @@ func (m *Model) ToggleFocusedWindow() {
m.focusedWindow = 1 - m.focusedWindow
if m.focusedWindow == 0 {
if selected := m.issueList.SelectedItem(); selected.ID != "" {
m.issueDetail.SetIssue(selected.Issue)
m.setDetailIssueWithComments(selected.Issue)
}
} else {
if selected := m.closedIssueList.SelectedItem(); selected.ID != "" {
m.issueDetail.SetIssue(selected.Issue)
m.setDetailIssueWithComments(selected.Issue)
}
}
m.issueDetail.SetFocused(m.IsFocusedOnDetail())