From 6651dc17110a558342a4ef0a97a5b37adbfa04c7 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Thu, 16 Jul 2026 07:03:03 +0000 Subject: Show a scheduled-vs-available indicator on the web timeline's Today section Task 11 of the task-budgets-and-availability plan: reuse the computeBudgetStatus helper (Task 8) in HandleTimeline so the dashboard's Today section header shows scheduled/available minutes when a budget-tracked task exists. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01PQaPGQVSfmKUiHXB87qRTC --- internal/handlers/timeline.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/handlers/timeline.go') diff --git a/internal/handlers/timeline.go b/internal/handlers/timeline.go index 9656d4c..9284451 100644 --- a/internal/handlers/timeline.go +++ b/internal/handlers/timeline.go @@ -101,6 +101,10 @@ type TimelineData struct { // Current time for "now" line NowHour int NowMinute int + + // Opt-in budget/availability indicator for Today -- nil when no + // budget-tracked task exists (see computeBudgetStatus). + BudgetStatus *models.BudgetStatus } // HandleTimeline renders the timeline view @@ -204,6 +208,12 @@ func (h *Handler) HandleTimeline(w http.ResponseWriter, r *http.Request) { data.TomorrowHours = append(data.TomorrowHours, h) } + budgetStatus, err := h.computeBudgetStatus(now) + if err != nil { + log.Printf("Warning: failed to compute budget status: %v", err) + } + data.BudgetStatus = budgetStatus + HTMLResponse(w, h.renderer, "timeline-tab", data) } -- cgit v1.2.3