50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/charmbracelet/bubbles/textinput"
|
|
)
|
|
|
|
type todo struct {
|
|
name string
|
|
done bool
|
|
deadline int
|
|
startdate int
|
|
priority int // 1-4, 1 being highest priority, 4 being no priority
|
|
isInbox bool
|
|
}
|
|
|
|
type model struct {
|
|
todos []todo // ALL items on the to-do list
|
|
list []todo // items currently visible on the list right now
|
|
cursor int // which to-do list item our cursor is pointing at
|
|
selected map[int]struct{} // which to-do items are selected
|
|
tab int // which tab is selected
|
|
addTask bool // defines if the new task window is shown
|
|
textinput textinput.Model
|
|
}
|
|
|
|
func initialModel() model {
|
|
ti := textinput.New()
|
|
ti.Placeholder = "New Task"
|
|
// ti.Focus()
|
|
// ti.CharLimit = 156
|
|
// ti.Width = 20
|
|
|
|
return model{
|
|
textinput: ti,
|
|
|
|
// Start empty
|
|
todos: []todo{},
|
|
|
|
list: []todo{},
|
|
|
|
// start on today tab
|
|
// 0: inbox, 1: today, 2: tomorrow, 3: scheduled, 4: anytime
|
|
tab: 1,
|
|
|
|
// A map which indicates which choices are selected. We're using
|
|
// the map like a mathematical set. The keys refer to the indexes
|
|
// of the `choices` slice, above.
|
|
selected: make(map[int]struct{}),
|
|
}
|
|
} |