copied the dashboard and made a keybinding to change back and forth between them; ready to turn dashboard2 into a boardview dashboard
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
package dashboard
|
||||
|
||||
import (
|
||||
"github.com/LazyBachelor/LazyPM/pkg/tui/msgs"
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
type DashboardKeyMap struct {
|
||||
Help key.Binding
|
||||
Quit key.Binding
|
||||
SelectIssue key.Binding
|
||||
BackToList key.Binding
|
||||
ScrollUp key.Binding
|
||||
ScrollDown key.Binding
|
||||
SwitchWindow key.Binding
|
||||
EditTitle key.Binding
|
||||
EditDescription key.Binding
|
||||
ChangeStatus key.Binding
|
||||
ChangePriority key.Binding
|
||||
ChangeType key.Binding
|
||||
AddIssue key.Binding
|
||||
DeleteIssue key.Binding
|
||||
Help key.Binding
|
||||
Quit key.Binding
|
||||
SelectIssue key.Binding
|
||||
BackToList key.Binding
|
||||
ScrollUp key.Binding
|
||||
ScrollDown key.Binding
|
||||
SwitchWindow key.Binding
|
||||
SwitchToDashboard2 key.Binding
|
||||
EditTitle key.Binding
|
||||
EditDescription key.Binding
|
||||
ChangeStatus key.Binding
|
||||
ChangePriority key.Binding
|
||||
ChangeType key.Binding
|
||||
AddIssue key.Binding
|
||||
DeleteIssue key.Binding
|
||||
}
|
||||
|
||||
var defaultDashboardKeyMap = DashboardKeyMap{
|
||||
@@ -51,6 +53,10 @@ var defaultDashboardKeyMap = DashboardKeyMap{
|
||||
key.WithKeys("tab"),
|
||||
key.WithHelp("tab", "switch window"),
|
||||
),
|
||||
SwitchToDashboard2: key.NewBinding(
|
||||
key.WithKeys("2"),
|
||||
key.WithHelp("2", "dashboard 2"),
|
||||
),
|
||||
EditTitle: key.NewBinding(
|
||||
key.WithKeys("e"),
|
||||
key.WithHelp("e", "edit title"),
|
||||
@@ -91,6 +97,8 @@ func (d *Model) handleKeyMsg(msg tea.KeyMsg) tea.Cmd {
|
||||
return tea.Quit
|
||||
case key.Matches(msg, d.keyMap.SwitchWindow):
|
||||
d.ToggleFocusedWindow()
|
||||
case !d.editingTitle && !d.creatingIssue && !d.editingDescription && !d.choosingStatus && !d.choosingPriority && !d.confirmingDelete && !d.choosingType && key.Matches(msg, d.keyMap.SwitchToDashboard2):
|
||||
return func() tea.Msg { return msgs.SwitchToDashboard2Msg{} }
|
||||
case d.IsFocusedOnList() && key.Matches(msg, d.keyMap.SelectIssue):
|
||||
d.FocusDetail()
|
||||
case d.IsFocusedOnDetail() && key.Matches(msg, d.keyMap.BackToList):
|
||||
|
||||
Reference in New Issue
Block a user