summaryrefslogtreecommitdiff
path: root/IMPLEMENTOR.md
diff options
context:
space:
mode:
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.