adding assignee for tui
This commit is contained in:
@@ -126,7 +126,8 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
|
||||
{Key: "↓/j", Desc: "down"},
|
||||
{Key: "pgup/pgdn", Desc: "page"},
|
||||
{Key: "a", Desc: "add"},
|
||||
{Key: "e/d/s/p/t", Desc: "edit"},
|
||||
{Key: "c", Desc: "comment"},
|
||||
{Key: "e/d/s/p/t/A", Desc: "edit"},
|
||||
{Key: "x", Desc: "delete"},
|
||||
{Key: "S", Desc: "submit"},
|
||||
{Key: "q", Desc: "quit"},
|
||||
@@ -137,11 +138,13 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
|
||||
{LeftKey: "enter", LeftDesc: "view issue", RightKey: "↓/j", RightDesc: "down"},
|
||||
{LeftKey: "pgup", LeftDesc: "page up", RightKey: "pgdn", RightDesc: "page down"},
|
||||
{LeftKey: "b", LeftDesc: "back to list", RightKey: "a", RightDesc: "add issue"},
|
||||
{LeftKey: "c", LeftDesc: "add comment", RightKey: "", RightDesc: ""},
|
||||
{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: "v", LeftDesc: "kanban", RightKey: "q", RightDesc: "quit"},
|
||||
{LeftKey: "S", LeftDesc: "submit", RightKey: "?", RightDesc: "help"},
|
||||
{LeftKey: "t", LeftDesc: "change type", RightKey: "A", RightDesc: "change assignee"},
|
||||
{LeftKey: "x", LeftDesc: "delete issue", RightKey: "v", RightDesc: "kanban"},
|
||||
{LeftKey: "q", LeftDesc: "quit", RightKey: "S", RightDesc: "submit"},
|
||||
{LeftKey: "?", LeftDesc: "help", RightKey: "", RightDesc: ""},
|
||||
},
|
||||
}
|
||||
case ViewKanban:
|
||||
@@ -154,7 +157,7 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
|
||||
{Key: "h/l", Desc: "column"},
|
||||
{Key: "←/→", Desc: "move"},
|
||||
{Key: "a", Desc: "add"},
|
||||
{Key: "e/d/s/p/t", Desc: "edit"},
|
||||
{Key: "e/d/s/p/t/A", Desc: "edit"},
|
||||
{Key: "x", Desc: "delete"},
|
||||
{Key: "q", Desc: "quit"},
|
||||
{Key: "S", Desc: "submit"},
|
||||
@@ -168,9 +171,9 @@ func helpBarConfig(view ViewKind) HelpBarConfig {
|
||||
{LeftKey: "b", LeftDesc: "back to list", RightKey: "a", RightDesc: "add issue"},
|
||||
{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: "S", RightDesc: "submit"},
|
||||
{LeftKey: "?", LeftDesc: "help", RightKey: "", RightDesc: ""},
|
||||
{LeftKey: "t", LeftDesc: "change type", RightKey: "A", RightDesc: "change assignee"},
|
||||
{LeftKey: "x", LeftDesc: "delete issue", RightKey: "q", RightDesc: "quit"},
|
||||
{LeftKey: "S", LeftDesc: "submit", RightKey: "?", RightDesc: "help"},
|
||||
},
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -67,11 +67,15 @@ func (i *IssueDetail) refreshContent() {
|
||||
styles.LabelStyle.Render("Priority:") + styles.ValueStyle.Render(PriorityCodeName(i.issue.Priority)),
|
||||
)
|
||||
|
||||
assigneeRow := styles.RowStyle.Render(
|
||||
styles.LabelStyle.Render("Assignee:") + styles.ValueStyle.Render(i.issue.Assignee),
|
||||
)
|
||||
|
||||
descLabel := styles.LabelStyle.Render("Description:")
|
||||
descContent := styles.ValueStyle.Render(i.issue.Description)
|
||||
|
||||
var parts []string
|
||||
parts = append(parts, titleRow, idRow, typeRow, statusRow, priorityRow, descLabel, descContent)
|
||||
parts = append(parts, titleRow, idRow, typeRow, statusRow, priorityRow, assigneeRow, descLabel, descContent)
|
||||
|
||||
// Comments section
|
||||
commentsLabel := styles.LabelStyle.Render("Comments:")
|
||||
|
||||
@@ -54,7 +54,7 @@ func getTableColumns(width int) []tableColumn {
|
||||
{width: 20, label: "TITLE", key: "title"},
|
||||
{width: 15, label: "STATUS", key: "status"},
|
||||
}
|
||||
default:
|
||||
case width < 75:
|
||||
return []tableColumn{
|
||||
{width: 12, label: "ID", key: "id"},
|
||||
{width: 20, label: "TITLE", key: "title"},
|
||||
@@ -62,6 +62,15 @@ func getTableColumns(width int) []tableColumn {
|
||||
{width: 10, label: "TYPE", key: "type"},
|
||||
{width: 15, label: "PRIORITY", key: "priority"},
|
||||
}
|
||||
default:
|
||||
return []tableColumn{
|
||||
{width: 12, label: "ID", key: "id"},
|
||||
{width: 20, label: "TITLE", key: "title"},
|
||||
{width: 15, label: "STATUS", key: "status"},
|
||||
{width: 11, label: "TYPE", key: "type"},
|
||||
{width: 14, label: "PRIORITY", key: "priority"},
|
||||
{width: 12, label: "ASSIGNEE", key: "assignee"},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +108,12 @@ func renderHeaders(cols []tableColumn) string {
|
||||
return lipgloss.JoinHorizontal(lipgloss.Left, parts...)
|
||||
}
|
||||
|
||||
// IssueInputs bundles the common text inputs used for issue title, creation, and description.
|
||||
// IssueInputs bundles the common text inputs used for issue title, creation, description, and assignee.
|
||||
type IssueInputs struct {
|
||||
Title textinput.Model
|
||||
CreateTitle textinput.Model
|
||||
Description textarea.Model
|
||||
Assignee textinput.Model
|
||||
}
|
||||
|
||||
// NewIssueInputs creates initialized inputs for issue title, new issue title, and description.
|
||||
@@ -121,10 +131,15 @@ func NewIssueInputs() IssueInputs {
|
||||
descTa.SetWidth(56)
|
||||
descTa.SetHeight(8)
|
||||
|
||||
assigneeTi := textinput.New()
|
||||
assigneeTi.Placeholder = "Assignee name..."
|
||||
assigneeTi.CharLimit = 64
|
||||
|
||||
return IssueInputs{
|
||||
Title: ti,
|
||||
CreateTitle: createTi,
|
||||
Description: descTa,
|
||||
Assignee: assigneeTi,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +429,8 @@ func getColumnValue(col tableColumn, issue ListIssue) string {
|
||||
return string(issue.Issue.IssueType)
|
||||
case "priority":
|
||||
return PriorityCodeName(issue.Issue.Priority)
|
||||
case "assignee":
|
||||
return issue.Assignee
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ type CommonKeyMap struct {
|
||||
ChangeStatus key.Binding
|
||||
ChangePriority key.Binding
|
||||
ChangeType key.Binding
|
||||
ChangeAssignee key.Binding
|
||||
AddIssue key.Binding
|
||||
DeleteIssue key.Binding
|
||||
}
|
||||
@@ -67,6 +68,10 @@ func DefaultCommonKeyMap() CommonKeyMap {
|
||||
key.WithKeys("t"),
|
||||
key.WithHelp("t", "change type"),
|
||||
),
|
||||
ChangeAssignee: key.NewBinding(
|
||||
key.WithKeys("A"),
|
||||
key.WithHelp("A", "change assignee"),
|
||||
),
|
||||
AddIssue: key.NewBinding(
|
||||
key.WithKeys("a"),
|
||||
key.WithHelp("a", "add issue"),
|
||||
|
||||
@@ -118,6 +118,22 @@ func RenderChoosePriority(width, height int, issueID string) string {
|
||||
return lipgloss.Place(width, height, lipgloss.Center, lipgloss.Center, priorityBox)
|
||||
}
|
||||
|
||||
func RenderEditAssignee(width, height int, inputView string) string {
|
||||
if width < 5 || height < 5 {
|
||||
return ""
|
||||
}
|
||||
editBoxWidth := modalBoxWidth(60, width)
|
||||
editContent := lipgloss.JoinVertical(lipgloss.Left,
|
||||
styles.LabelStyle.Render("Edit assignee (Enter to save, Esc to cancel):"),
|
||||
inputView,
|
||||
)
|
||||
editBox := styles.ContainerStyle.
|
||||
Width(editBoxWidth).
|
||||
BorderForeground(styles.PrimaryBorder).
|
||||
Render(editContent)
|
||||
return lipgloss.Place(width, height, lipgloss.Center, lipgloss.Center, editBox)
|
||||
}
|
||||
|
||||
func RenderChooseType(width, height int, issueID string) string {
|
||||
if width < 5 || height < 5 {
|
||||
return ""
|
||||
@@ -148,6 +164,7 @@ func RenderModals(
|
||||
choosingStatus bool, statusIssueID string,
|
||||
choosingPriority bool, priorityIssueID string,
|
||||
choosingType bool, typeIssueID string,
|
||||
editingAssignee bool, assigneeInputView string,
|
||||
mainView string,
|
||||
) string {
|
||||
if editingTitle {
|
||||
@@ -178,6 +195,10 @@ func RenderModals(
|
||||
return RenderChooseType(width, height, typeIssueID)
|
||||
}
|
||||
|
||||
if editingAssignee {
|
||||
return RenderEditAssignee(width, height, assigneeInputView)
|
||||
}
|
||||
|
||||
return mainView
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user