updated hourly view to have controls at bottom header at top
This commit is contained in:
parent
ddb4469501
commit
1f9185b8df
1 changed files with 9 additions and 1 deletions
10
view.go
10
view.go
|
|
@ -13,11 +13,14 @@ func (m model) View() string {
|
||||||
return m.viewMonth()
|
return m.viewMonth()
|
||||||
case hourlyView:
|
case hourlyView:
|
||||||
return m.viewHourly()
|
return m.viewHourly()
|
||||||
|
case formView:
|
||||||
|
return m.form.View()
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m model) viewMonth() string {
|
func (m model) viewMonth() string {
|
||||||
var out string
|
var out string
|
||||||
|
|
||||||
|
|
@ -60,13 +63,17 @@ func (m model) viewMonth() string {
|
||||||
out += "\n"
|
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
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m model) viewHourly() string {
|
func (m model) viewHourly() string {
|
||||||
var b strings.Builder
|
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))
|
events, _ := GetEventsForDay(int32(m.year), int32(m.monthIndex+1), int32(m.selectedDay))
|
||||||
|
|
||||||
for hour := 0; hour < 24; hour++ {
|
for hour := 0; hour < 24; hour++ {
|
||||||
|
|
@ -109,6 +116,7 @@ func (m model) viewHourly() string {
|
||||||
b.WriteString(label + "\n")
|
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()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue