Refactor picker
This commit is contained in:
@ -94,24 +94,24 @@ func (p *ReportPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return p, tea.Quit
|
||||
case key.Matches(msg, p.common.Keymap.SetReport):
|
||||
p.subpage = NewReportPickerPage(p.common, p.activeReport)
|
||||
p.subpage.Init()
|
||||
cmd := p.subpage.Init()
|
||||
p.common.PushPage(p)
|
||||
return p.subpage, nil
|
||||
return p.subpage, cmd
|
||||
case key.Matches(msg, p.common.Keymap.SetContext):
|
||||
p.subpage = NewContextPickerPage(p.common)
|
||||
p.subpage.Init()
|
||||
cmd := p.subpage.Init()
|
||||
p.common.PushPage(p)
|
||||
return p.subpage, nil
|
||||
return p.subpage, cmd
|
||||
case key.Matches(msg, p.common.Keymap.Add):
|
||||
p.subpage = NewTaskEditorPage(p.common, taskwarrior.NewTask())
|
||||
p.subpage.Init()
|
||||
cmd := p.subpage.Init()
|
||||
p.common.PushPage(p)
|
||||
return p.subpage, nil
|
||||
return p.subpage, cmd
|
||||
case key.Matches(msg, p.common.Keymap.Edit):
|
||||
p.subpage = NewTaskEditorPage(p.common, *p.selectedTask)
|
||||
p.subpage.Init()
|
||||
cmd := p.subpage.Init()
|
||||
p.common.PushPage(p)
|
||||
return p.subpage, nil
|
||||
return p.subpage, cmd
|
||||
case key.Matches(msg, p.common.Keymap.Ok):
|
||||
p.common.TW.SetTaskDone(p.selectedTask)
|
||||
return p, p.getTasks()
|
||||
@ -120,9 +120,9 @@ func (p *ReportPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return p, p.getTasks()
|
||||
case key.Matches(msg, p.common.Keymap.SetProject):
|
||||
p.subpage = NewProjectPickerPage(p.common, p.activeProject)
|
||||
p.subpage.Init()
|
||||
cmd := p.subpage.Init()
|
||||
p.common.PushPage(p)
|
||||
return p.subpage, nil
|
||||
return p.subpage, cmd
|
||||
case key.Matches(msg, p.common.Keymap.Tag):
|
||||
if p.selectedTask != nil {
|
||||
tag := p.common.TW.GetConfig().Get("uda.tasksquire.tag.default")
|
||||
|
||||
Reference in New Issue
Block a user