remove submission keybind as its now automatic

This commit is contained in:
Robin Olsen
2026-03-20 12:23:49 +01:00
parent ecafe0c17e
commit 78696e7a4b

View File

@@ -2,14 +2,13 @@ package dashboard
import (
"charm.land/bubbles/v2/key"
"charm.land/bubbletea/v2"
tea "charm.land/bubbletea/v2"
"github.com/LazyBachelor/LazyPM/pkg/tui/components"
"github.com/LazyBachelor/LazyPM/pkg/tui/msgs"
)
type DashboardKeyMap struct {
components.CommonKeyMap
SwitchWindow key.Binding
SwitchToKanbanBoard key.Binding
Quit key.Binding
SelectIssue key.Binding
@@ -25,15 +24,10 @@ type DashboardKeyMap struct {
AddComment key.Binding
AddIssue key.Binding
DeleteIssue key.Binding
SubmitValidation key.Binding
}
var defaultDashboardKeyMap = DashboardKeyMap{
CommonKeyMap: components.DefaultCommonKeyMap(),
SwitchWindow: key.NewBinding(
key.WithKeys("tab"),
key.WithHelp("tab", "switch window"),
),
SwitchToKanbanBoard: key.NewBinding(
key.WithKeys("v"),
key.WithHelp("v", "switch to kanban")),
@@ -73,10 +67,6 @@ var defaultDashboardKeyMap = DashboardKeyMap{
key.WithKeys("x"),
key.WithHelp("x", "delete issue"),
),
SubmitValidation: key.NewBinding(
key.WithKeys("S"),
key.WithHelp("S", "submit validation"),
),
}
func (d *Model) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
@@ -89,16 +79,8 @@ func (d *Model) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
case key.Matches(msg, d.keyMap.Quit):
d.logAction("tui quit requested")
return tea.Quit
case key.Matches(msg, d.keyMap.SwitchWindow):
d.ToggleFocusedWindow()
case !d.IsInModal() && key.Matches(msg, d.keyMap.SwitchToKanbanBoard):
return func() tea.Msg { return msgs.SwitchToKanbanBoardMsg{} }
case d.IsFocusedOnList() && key.Matches(msg, d.keyMap.SelectIssue):
d.FocusDetail()
d.logAction("tui opened issue detail")
case d.IsFocusedOnDetail() && (key.Matches(msg, d.keyMap.BackToList) || key.Matches(msg, d.keyMap.SelectIssue)):
d.FocusList()
d.logAction("tui returned to issue list")
case d.IsFocusedOnDetail() && key.Matches(msg, d.keyMap.ScrollUp):
d.issueDetail.ScrollUp(1)
d.logAction("tui scrolled issue detail up")
@@ -106,40 +88,40 @@ func (d *Model) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
d.issueDetail.ScrollDown(1)
d.logAction("tui scrolled issue detail down")
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.EditTitle):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startEditTitle(selected)
cmd = d.titleInput.Focus()
d.logAction("tui started editing issue title")
}
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.EditDescription):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startEditDescription(selected)
cmd = d.descriptionInput.Focus()
d.logAction("tui started editing issue description")
}
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.ChangeStatus):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startChooseStatus(selected)
d.logAction("tui opened status picker")
}
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.ChangePriority):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startChoosePriority(selected)
d.logAction("tui opened priority picker")
}
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.ChangeType):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startChooseType(selected)
d.logAction("tui opened type picker")
}
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.ChangeAssignee):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startEditAssignee(selected)
cmd = d.assigneeInput.Focus()
d.logAction("tui started editing assignee")
}
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.AddComment):
if selected := d.FocusedIssueList().SelectedItem(); selected.ID != "" {
if selected := d.issueList.SelectedItem(); selected.ID != "" {
d.startAddComment(selected)
cmd = d.commentInput.Focus()
}
@@ -148,19 +130,11 @@ func (d *Model) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
cmd = d.createTitleInput.Focus()
d.logAction("tui started creating issue")
case !d.IsInModal() && !d.addingComment && key.Matches(msg, d.keyMap.DeleteIssue):
fl := d.FocusedIssueList()
fl := d.issueList
if selected := fl.SelectedItem(); selected.ID != "" {
d.startConfirmDelete(selected.ID, fl.Index())
d.logAction("tui opened delete confirmation")
}
case key.Matches(msg, d.keyMap.SubmitValidation):
if d.submitChan != nil {
select {
case d.submitChan <- struct{}{}:
d.logAction("tui submitted validation")
default:
}
}
}
return cmd