diff --git a/pkg/tui/components/helpbar.go b/pkg/tui/components/helpbar.go index 146d27f..7766d0c 100644 --- a/pkg/tui/components/helpbar.go +++ b/pkg/tui/components/helpbar.go @@ -24,13 +24,11 @@ type FullRow struct { RightDesc string } - type HelpBarConfig struct { ShortItems []ShortItem FullRows []FullRow } - type HelpBar struct { view ViewKind config HelpBarConfig @@ -38,7 +36,6 @@ type HelpBar struct { width int } - func NewHelpBar(view ViewKind) HelpBar { return HelpBar{view: view, config: helpBarConfig(view)} } @@ -47,7 +44,6 @@ func (h *HelpBar) SetWidth(width int) { h.width = width } - func (h HelpBar) View() string { if h.width == 0 { return "" @@ -111,7 +107,6 @@ func (h HelpBar) Height() int { return lipgloss.Height(h.View()) } - func (h HelpBar) IsExpanded() bool { return h.showAll } @@ -126,7 +121,7 @@ func helpBarConfig(view ViewKind) HelpBarConfig { return HelpBarConfig{ ShortItems: []ShortItem{ {Key: "tab", Desc: "switch"}, - {Key: "k", Desc: "kanban"}, + {Key: "v", Desc: "kanban"}, {Key: "↑/k", Desc: "up"}, {Key: "↓/j", Desc: "down"}, {Key: "pgup/pgdn", Desc: "page"}, @@ -144,14 +139,14 @@ 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: "2", LeftDesc: "kanban", RightKey: "q", RightDesc: "quit"}, + {LeftKey: "v", LeftDesc: "kanban", RightKey: "q", RightDesc: "quit"}, {LeftKey: "?", LeftDesc: "help", RightKey: "", RightDesc: ""}, }, } case ViewKanban: return HelpBarConfig{ ShortItems: []ShortItem{ - {Key: "1", Desc: "issues"}, + {Key: "v", Desc: "list view"}, {Key: "↑/k", Desc: "up"}, {Key: "↓/j", Desc: "down"}, {Key: "pgup/pgdn", Desc: "page"}, @@ -164,7 +159,7 @@ func helpBarConfig(view ViewKind) HelpBarConfig { {Key: "?", Desc: "help"}, }, FullRows: []FullRow{ - {LeftKey: "1", LeftDesc: "issues", RightKey: "↑/k", RightDesc: "up"}, + {LeftKey: "v", LeftDesc: "list view", RightKey: "↑/k", RightDesc: "up"}, {LeftKey: "enter", LeftDesc: "view issue", RightKey: "↓/j", RightDesc: "down"}, {LeftKey: "pgup", LeftDesc: "page up", RightKey: "pgdn", RightDesc: "page down"}, {LeftKey: "h/l", LeftDesc: "switch column", RightKey: "←/→", RightDesc: "move issue"}, diff --git a/pkg/tui/views/dashboard/keys.go b/pkg/tui/views/dashboard/keys.go index 63a74d4..e265ffb 100644 --- a/pkg/tui/views/dashboard/keys.go +++ b/pkg/tui/views/dashboard/keys.go @@ -9,8 +9,8 @@ import ( type DashboardKeyMap struct { components.CommonKeyMap - SwitchWindow key.Binding - SwitchToKanbanBoard key.Binding + SwitchWindow key.Binding + SwitchToKanbanBoard key.Binding } var defaultDashboardKeyMap = DashboardKeyMap{ @@ -20,8 +20,8 @@ var defaultDashboardKeyMap = DashboardKeyMap{ key.WithHelp("tab", "switch window"), ), SwitchToKanbanBoard: key.NewBinding( - key.WithKeys("k"), - key.WithHelp("k", "switch to kanban"), + key.WithKeys("v"), + key.WithHelp("v", "switch to kanban"), ), } @@ -39,7 +39,7 @@ func (d *Model) handleKeyMsg(msg tea.KeyMsg) tea.Cmd { return func() tea.Msg { return msgs.SwitchToKanbanBoardMsg{} } case d.IsFocusedOnList() && key.Matches(msg, d.keyMap.SelectIssue): d.FocusDetail() - case d.IsFocusedOnDetail() && key.Matches(msg, d.keyMap.BackToList): + case d.IsFocusedOnDetail() && (key.Matches(msg, d.keyMap.BackToList) || key.Matches(msg, d.keyMap.SelectIssue)): d.FocusList() case d.IsFocusedOnDetail() && key.Matches(msg, d.keyMap.ScrollUp): d.issueDetail.ScrollUp(1) diff --git a/pkg/tui/views/kanban/keys.go b/pkg/tui/views/kanban/keys.go index e2d2a5b..47227ce 100644 --- a/pkg/tui/views/kanban/keys.go +++ b/pkg/tui/views/kanban/keys.go @@ -19,8 +19,8 @@ type KanbanKeyMap struct { var defaultKanbanKeyMap = KanbanKeyMap{ CommonKeyMap: components.DefaultCommonKeyMap(), SwitchToDashboard: key.NewBinding( - key.WithKeys("1"), - key.WithHelp("1", "dashboard 1"), + key.WithKeys("v"), + key.WithHelp("v", "dashboard 1"), ), MoveColumnLeft: key.NewBinding( key.WithKeys("h"), @@ -68,7 +68,7 @@ func (d *Model) handleKeyMsg(msg tea.KeyMsg) tea.Cmd { cmd = d.moveIssue(-1) case d.IsFocusedOnList() && key.Matches(msg, d.keyMap.SelectIssue): d.FocusDetail() - case d.IsFocusedOnDetail() && key.Matches(msg, d.keyMap.BackToList): + case d.IsFocusedOnDetail() && (key.Matches(msg, d.keyMap.BackToList) || key.Matches(msg, d.keyMap.SelectIssue)): d.FocusList() case d.IsFocusedOnDetail() && key.Matches(msg, d.keyMap.ScrollUp): d.issueDetail.ScrollUp(1) diff --git a/pkg/tui/views/kanban/view.go b/pkg/tui/views/kanban/view.go index 045541b..34fb0da 100644 --- a/pkg/tui/views/kanban/view.go +++ b/pkg/tui/views/kanban/view.go @@ -66,7 +66,15 @@ func (m *Model) View() string { board := lipgloss.JoinHorizontal(lipgloss.Left, todoCol, inProgCol, doneCol) content := lipgloss.JoinVertical(lipgloss.Left, board, m.issueDetail.View()) + // Add spacer to lock footer to bottom of screen when content is shorter than available space + // This is to avoid having the footer floating above the bottom of the screen mainView := lipgloss.JoinVertical(lipgloss.Left, header, content, footer) + mainViewHeight := lipgloss.Height(mainView) + if mainViewHeight < m.height { + spacerHeight := m.height - mainViewHeight + spacer := lipgloss.NewStyle().Height(spacerHeight).Width(m.width).Render("") + mainView = lipgloss.JoinVertical(lipgloss.Left, header, content, spacer, footer) + } return components.RenderModals( m.width,