85 lines
1.2 KiB
Go
85 lines
1.2 KiB
Go
package pages
|
|
|
|
import (
|
|
"tasksquire/taskwarrior"
|
|
"time"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type UpdatedTasksMsg struct{}
|
|
|
|
type nextColumnMsg struct{}
|
|
|
|
func nextColumn() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return nextColumnMsg{}
|
|
}
|
|
}
|
|
|
|
type prevColumnMsg struct{}
|
|
|
|
func prevColumn() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return prevColumnMsg{}
|
|
}
|
|
}
|
|
|
|
type nextFieldMsg struct{}
|
|
|
|
func nextField() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return nextFieldMsg{}
|
|
}
|
|
}
|
|
|
|
type prevFieldMsg struct{}
|
|
|
|
func prevField() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return prevFieldMsg{}
|
|
}
|
|
}
|
|
|
|
type nextAreaMsg struct{}
|
|
|
|
func nextArea() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return nextAreaMsg{}
|
|
}
|
|
}
|
|
|
|
type prevAreaMsg struct{}
|
|
|
|
func prevArea() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return prevAreaMsg{}
|
|
}
|
|
}
|
|
|
|
type changeAreaMsg int
|
|
|
|
func changeArea(a int) tea.Cmd {
|
|
return func() tea.Msg {
|
|
return changeAreaMsg(a)
|
|
}
|
|
}
|
|
|
|
func changeMode(mode mode) tea.Cmd {
|
|
return func() tea.Msg {
|
|
return changeModeMsg(mode)
|
|
}
|
|
}
|
|
|
|
type changeModeMsg mode
|
|
|
|
type taskMsg taskwarrior.Tasks
|
|
|
|
type tickMsg time.Time
|
|
|
|
func doTick() tea.Cmd {
|
|
return tea.Tick(time.Second, func(t time.Time) tea.Msg {
|
|
return tickMsg(t)
|
|
})
|
|
}
|