summaryrefslogtreecommitdiff
path: root/IMPLEMENTOR.md
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-26 16:49:44 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-26 16:49:44 -1000
commit42a4e32daca13b518e64e5821080ff3d6adf0e39 (patch)
tree639c790e25b961ecf51ab6ea75206bc3432f1548 /IMPLEMENTOR.md
parent8de1b5cb8915ed9a6e32566431d05fafafeb338d (diff)
Use configured timezone throughout codebase
- Add config/timezone.go with timezone utilities: - SetDisplayTimezone(), GetDisplayTimezone() - Now(), Today() - current time/date in display TZ - ParseDateInDisplayTZ(), ToDisplayTZ() - parsing helpers - Initialize timezone at startup in main.go - Update all datetime logic to use configured timezone: - handlers/handlers.go - all time.Now() calls - handlers/timeline.go - date parsing - handlers/timeline_logic.go - now calculation - models/atom.go - ComputeUIFields() - models/timeline.go - ComputeDaySection() - api/plantoeat.go - meal date parsing - api/todoist.go - due date parsing - api/trello.go - due date parsing This ensures all dates/times display correctly regardless of server timezone setting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'IMPLEMENTOR.md')
-rw-r--r--IMPLEMENTOR.md47
1 files changed, 47 insertions, 0 deletions
diff --git a/IMPLEMENTOR.md b/IMPLEMENTOR.md
new file mode 100644
index 0000000..ba77c2b
--- /dev/null
+++ b/IMPLEMENTOR.md
@@ -0,0 +1,47 @@
+# Implementation Plan: Timeline Feature
+
+## Phase 1: Database Layer (Store)
+**Goal:** Enable fetching data by date range.
+
+1. **Update Interface:** Modify `internal/store/store.go` to add:
+ * `GetTasksByDateRange(start, end time.Time) ([]models.Task, error)`
+ * `GetMealsByDateRange(start, end time.Time) ([]models.Meal, error)`
+ * `GetCardsByDateRange(start, end time.Time) ([]models.Card, error)`
+2. **Update Implementation:** Modify `internal/store/sqlite.go` to implement these methods using SQL queries.
+3. **Test:** Create/Update `internal/store/store_test.go` to verify the queries work correctly.
+
+## Phase 2: Core Logic & Models
+**Goal:** Aggregate and normalize data into a timeline structure.
+
+1. **Create Models:** Create `internal/models/timeline.go` with `TimelineItem` and `TimelineItemType`.
+2. **Create Logic:** Create `internal/handlers/timeline_logic.go`.
+ * Implement `BuildTimeline(store Store, calendarClient *api.GoogleCalendarClient, start, end time.Time)`.
+ * **Logic:**
+ * Fetch Tasks, Meals, Cards from Store.
+ * Fetch Events from Calendar Client.
+ * Convert all to `TimelineItem`.
+ * **Apply Meal Defaults:**
+ * If `MealType` == "breakfast" -> Set time to 08:00
+ * If `MealType` == "lunch" -> Set time to 12:00
+ * If `MealType` == "dinner" -> Set time to 19:00
+ * Else -> Set time to 12:00
+ * Sort items by `Time`.
+3. **Test:** Create `internal/handlers/timeline_logic_test.go` to test merging and sorting (TDD).
+
+## Phase 3: HTTP Handler & Routing
+**Goal:** Expose the timeline via HTTP.
+
+1. **Create Handler:** Create `internal/handlers/timeline.go`.
+ * Inject `Store` and `GoogleCalendarClient`.
+ * Parse query params (`start`, `days`).
+ * Call `BuildTimeline`.
+ * Render template.
+2. **Register Route:** Update `cmd/dashboard/main.go` to map `/timeline` to the new handler.
+
+## Phase 4: UI
+**Goal:** Visualize the timeline.
+
+1. **Create Template:** Create `web/templates/partials/timeline-tab.html`.
+ * Iterate over items grouped by day.
+ * Show time, icon, title, and details.
+2. **Update Main View:** Update `web/templates/index.html` to add the "Timeline" tab and HTMX trigger.