diff --git a/bubbletea.go b/bubbletea.go index faf6312..e9e7040 100644 --- a/bubbletea.go +++ b/bubbletea.go @@ -46,6 +46,13 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.tab++ } + // new task + case "n": + m.addTask = true + + case "esc": + m.addTask = false + // The "enter" key and the spacebar (a literal space) toggle // the selected state for the item that the cursor is pointing at. case "enter", " ": @@ -68,22 +75,22 @@ func (m model) View() string { 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" - } + // 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" + s += "GOTD\n\n" // Iterate over our choices for i, choice := range currentList { @@ -104,10 +111,22 @@ func (m model) View() string { s += fmt.Sprintf("%s [%s] %s\n", cursor, checked, choice) } + for i, v := range []string{"Inbox", "Today", "Tomorrow", "Scheduled", "Anytime"} { + if i == m.tab { + s += fmt.Sprintf("**%s** ", v) + } else { + s += fmt.Sprintf("%s ", v) + } + } + // The footer - s += "n: new\n" + s += "\nn: new\n" s += "q: quit.\n" + if m.addTask { + + } + // Send the UI for rendering return s } diff --git a/model.go b/model.go index 8d24ad1..94f4130 100644 --- a/model.go +++ b/model.go @@ -15,7 +15,7 @@ type model struct { 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 - add bool // defines if the new task window is shown + addTask bool // defines if the new task window is shown } func initialModel() model {