diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-22 10:09:07 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-22 10:09:07 -1000 |
| commit | 7fd381a242f68b7c6f10db4e3ae0bb3d06e36a16 (patch) | |
| tree | abff0af0a0f3b057d7b1ad6d95dbefdf30c553c3 /issues/011-add-timeline-view.md | |
| parent | 583f90c5dedf0235fa45557359b0e6e7dd62b0f0 (diff) | |
Fix background image CORS issue
Switch from Unsplash Source API to Lorem Picsum which has proper
CORS headers for cross-origin image loading.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'issues/011-add-timeline-view.md')
| -rw-r--r-- | issues/011-add-timeline-view.md | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/issues/011-add-timeline-view.md b/issues/011-add-timeline-view.md new file mode 100644 index 0000000..49e744a --- /dev/null +++ b/issues/011-add-timeline-view.md @@ -0,0 +1,86 @@ +# [FEATURE] Add timeline view + +## Description +Add timeline view. + +## User Story +As a user, I want a timeline/agenda view so I can see my day's schedule visually. + +## Technical Context +- New view aggregating multiple data sources by time +- Requires merging tasks + meals + (future) calendar events +- New tab or view mode in existing UI + +## Test Strategy + +### Unit Test (Red) +**File:** `internal/handlers/handlers_test.go` + +```go +func TestBuildTimeline(t *testing.T) { + tasks := []Task{{Name: "Task 1", DueDate: todayAt(10, 0)}} + meals := []Meal{{Name: "Lunch", Date: today, Type: "lunch"}} // lunch = 12:00 + + timeline := BuildTimeline(tasks, meals) + + assert.Len(t, timeline, 2) + assert.Equal(t, "Task 1", timeline[0].Title) + assert.Equal(t, "Lunch", timeline[1].Title) +} + +func TestTimelineItemsSortedByTime(t *testing.T) { + // Items from different sources + // Assert sorted by timestamp regardless of source +} +``` + +### E2E Test (Red) +Timeline renders with correct order and time markers. + +## Proposed Approach + +1. **Data Structure:** + ```go + type TimelineItem struct { + Time time.Time + Title string + Source string // "task", "meal", "calendar" + Type string // source-specific type + URL string + Metadata map[string]any + } + ``` + +2. **Handler:** + - New endpoint `GET /timeline` or extend tab handler + - Aggregate items from tasks, meals, (future) calendar + - Sort by time ascending + - Group by hour or time block + +3. **UI:** + - Vertical timeline with time gutter on left + - Color-coded by source + - Expandable items for details + +4. **Meal time mapping:** + - breakfast: 08:00 + - lunch: 12:00 + - dinner: 18:00 + - snack: configurable or omit from timeline + +## Affected Components +- `internal/handlers/handlers.go` or `internal/handlers/timeline.go` (new) +- `internal/handlers/handlers_test.go` +- `internal/models/types.go` (TimelineItem struct) +- `web/templates/partials/timeline-tab.html` (new) +- `web/templates/index.html` (add tab) + +## Definition of Done +- [ ] Timeline view accessible from UI +- [ ] Tasks with times appear at correct position +- [ ] Meals appear at appropriate meal times +- [ ] Items sorted chronologically +- [ ] Visual time markers/gutter +- [ ] Color coding by source +- [ ] Unit tests for timeline building +- [ ] E2E test for rendering |
