summaryrefslogtreecommitdiff
path: root/internal/handlers/handlers.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-13 18:10:10 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-16 02:42:31 +0000
commitd0f207704a406d4fbc65e89ef37f19bacfa0deef (patch)
tree2bafd1ee3e0759dff015df0c9bae184aa2bbc913 /internal/handlers/handlers.go
parent8e56555adb7d3c77f2da62288cbf484f7102a74a (diff)
feat(web): show multi-day calendar events on every day they span
TimelineItemView wraps a TimelineItem with a per-render-day MultiDayVariant (starts/ends/spans/none). HandleTimeline's bucketing now places a multi-day event into both TodayItems and TomorrowItems when it touches both, instead of only the list matching its start day.
Diffstat (limited to 'internal/handlers/handlers.go')
-rw-r--r--internal/handlers/handlers.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go
index 408006d..e427e40 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -46,6 +46,26 @@ func New(s *store.Store, trello api.TrelloAPI, planToEat api.PlanToEatAPI, googl
// Template functions
funcMap := template.FuncMap{
"subtract": func(a, b int) int { return a - b },
+ // multiDayLabel returns the "(starts/ends HH:MM)" suffix for a
+ // multi-day calendar event's row on the day it's rendered, or ""
+ // for a normal item or a "spans" (pass-through) day, which shows
+ // as a plain all-day row with no time label.
+ "multiDayLabel": func(item TimelineItemView) string {
+ switch item.MultiDayVariant {
+ case "starts":
+ if item.Time.Hour() == 0 && item.Time.Minute() == 0 {
+ return ""
+ }
+ return " (starts " + item.Time.Format("3:04 PM") + ")"
+ case "ends":
+ if item.EndTime == nil || (item.EndTime.Hour() == 0 && item.EndTime.Minute() == 0) {
+ return ""
+ }
+ return " (ends " + item.EndTime.Format("3:04 PM") + ")"
+ default:
+ return ""
+ }
+ },
}
// Parse templates including partials