updated hourly view to have controls at bottom header at top

This commit is contained in:
steven carpenter 2025-07-03 22:23:43 -04:00
parent ddb4469501
commit 1f9185b8df

10
view.go
View file

@ -13,11 +13,14 @@ func (m model) View() string {
return m.viewMonth()
case hourlyView:
return m.viewHourly()
case formView:
return m.form.View()
default:
return ""
}
}
func (m model) viewMonth() string {
var out string
@ -60,13 +63,17 @@ func (m model) viewMonth() string {
out += "\n"
}
out += "\n[a]/[d] to change month, arrows to move, enter to select a day, q to quit."
out += "\n[a]/[d] to change month, [up]/[down]/[left]/[right] keys to move, [enter] to select a day, [q] to quit."
return out
}
func (m model) viewHourly() string {
var b strings.Builder
date := time.Date(m.year, time.Month(m.monthIndex+1), m.selectedDay, 0, 0, 0, 0, time.UTC)
header := headerStyle.Render(date.Format("Monday, Jan 2, 2006"))
b.WriteString(header + "\n\n")
events, _ := GetEventsForDay(int32(m.year), int32(m.monthIndex+1), int32(m.selectedDay))
for hour := 0; hour < 24; hour++ {
@ -109,6 +116,7 @@ func (m model) viewHourly() string {
b.WriteString(label + "\n")
}
b.WriteString("[n] to add event, [up]/[down] keys to move, [Esc] to go back to month view, [q] to quit.")
return b.String()
}