[WIP] Task editing

This commit is contained in:
Martin
2024-05-23 07:15:08 +02:00
parent 14dbfc406d
commit 7712711736
4 changed files with 152 additions and 27 deletions

View File

@ -141,6 +141,9 @@ func (p *ReportPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
p.subpageActive = true
p.common.PushPage(p)
return p.subpage, nil
case key.Matches(msg, p.common.Keymap.Ok):
p.common.TW.SetTaskDone(p.selectedTask)
return p, p.getTasks()
case key.Matches(msg, p.common.Keymap.SetProject):
p.subpage = NewProjectPickerPage(p.common, p.activeProject)
p.subpage.Init()

View File

@ -43,7 +43,12 @@ func NewTaskEditorPage(common *common.Common, task taskwarrior.Task) *TaskEditor
p := &TaskEditorPage{
common: common,
task: task,
mode: ModeInsert,
}
if p.task.Uuid == "" {
p.mode = ModeInsert
} else {
p.mode = ModeNormal
}
if p.task.Priority == "" {
@ -197,7 +202,7 @@ func (p *TaskEditorPage) View() string {
return lipgloss.JoinVertical(
lipgloss.Left,
// lipgloss.Place(p.common.Width(), p.common.Height()-1, 0.5, 0.5, p.form.View(), lipgloss.WithWhitespaceBackground(p.common.Styles.Warning.GetForeground())),
lipgloss.Place(p.common.Width(), p.common.Height()-1, 0.5, 0.5, p.form.View(), lipgloss.WithWhitespaceChars(".")),
lipgloss.Place(p.common.Width(), p.common.Height()-1, 0.5, 0.5, p.form.View(), lipgloss.WithWhitespaceChars(" . ")),
p.statusline.View(),
)
}