doing some filtering and tabwork
This commit is contained in:
parent
05a79cd921
commit
5231fd8f6a
23
bubbletea.go
23
bubbletea.go
@ -64,10 +64,29 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
func (m model) View() string {
|
||||
// The header
|
||||
s := "What should we buy at the market?\n\n"
|
||||
s := ""
|
||||
currentList := []todo{}
|
||||
|
||||
switch m.tab {
|
||||
case 0:
|
||||
s += "Inbox"
|
||||
inboxFilter := func(t todo) bool { return t.isInbox}
|
||||
currentList = filter(m.todos, inboxFilter)
|
||||
case 1:
|
||||
s += "Today"
|
||||
case 2:
|
||||
s += "Tomorrow"
|
||||
case 3:
|
||||
s += "Scheduled"
|
||||
case 4:
|
||||
s += "Anytime"
|
||||
}
|
||||
|
||||
s += "\n\n"
|
||||
|
||||
|
||||
// Iterate over our choices
|
||||
for i, choice := range m.list {
|
||||
for i, choice := range currentList {
|
||||
|
||||
// Is the cursor pointing at this choice?
|
||||
cursor := " " // no cursor
|
||||
|
Loading…
x
Reference in New Issue
Block a user