diff options
| -rw-r--r-- | internal/handlers/timeline.go | 18 | ||||
| -rw-r--r-- | web/templates/partials/timeline-tab.html | 6 |
2 files changed, 19 insertions, 5 deletions
diff --git a/internal/handlers/timeline.go b/internal/handlers/timeline.go index 9821452..37e688f 100644 --- a/internal/handlers/timeline.go +++ b/internal/handlers/timeline.go @@ -16,6 +16,11 @@ type TimelineData struct { LaterItems []models.TimelineItem Start time.Time Days int + + // Section labels with day of week + TodayLabel string // e.g., "Today - Monday" + TomorrowLabel string // e.g., "Tomorrow - Tuesday" + LaterLabel string // e.g., "Wednesday, Jan 29" } // HandleTimeline renders the timeline view @@ -52,10 +57,19 @@ func (h *Handler) HandleTimeline(w http.ResponseWriter, r *http.Request) { return } + // Compute section labels with day of week + now := config.Now() + today := config.Today() + tomorrow := today.AddDate(0, 0, 1) + dayAfterTomorrow := today.AddDate(0, 0, 2) + // Group items by day section data := TimelineData{ - Start: start, - Days: days, + Start: start, + Days: days, + TodayLabel: "Today - " + now.Format("Monday"), + TomorrowLabel: "Tomorrow - " + tomorrow.Format("Monday"), + LaterLabel: dayAfterTomorrow.Format("Monday, Jan 2") + "+", } for _, item := range items { switch item.DaySection { diff --git a/web/templates/partials/timeline-tab.html b/web/templates/partials/timeline-tab.html index aeaba40..5f32530 100644 --- a/web/templates/partials/timeline-tab.html +++ b/web/templates/partials/timeline-tab.html @@ -9,7 +9,7 @@ {{if .TodayItems}} <div> <h2 class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/90 sticky top-0 bg-black/20 backdrop-blur-md py-2 z-10 rounded-lg px-2"> - <span>📅</span> Today + <span>📅</span> {{.TodayLabel}} </h2> <div class="space-y-2 relative pl-4 border-l border-white/10 ml-2"> {{range .TodayItems}} @@ -23,7 +23,7 @@ {{if .TomorrowItems}} <details class="group"> <summary class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/70 cursor-pointer hover:text-white/90 sticky top-0 bg-black/20 backdrop-blur-md py-2 z-10 rounded-lg px-2 list-none"> - <span>🗓️</span> Tomorrow + <span>🗓️</span> {{.TomorrowLabel}} <span class="text-sm font-normal text-white/50">({{len .TomorrowItems}} items)</span> <svg class="w-4 h-4 ml-auto transform transition-transform group-open:rotate-180" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path> @@ -41,7 +41,7 @@ {{if .LaterItems}} <details class="group"> <summary class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/60 cursor-pointer hover:text-white/80 sticky top-0 bg-black/20 backdrop-blur-md py-2 z-10 rounded-lg px-2 list-none"> - <span>📆</span> Later + <span>📆</span> {{.LaterLabel}} <span class="text-sm font-normal text-white/40">({{len .LaterItems}} items)</span> <svg class="w-4 h-4 ml-auto transform transition-transform group-open:rotate-180" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path> |
