diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 17:05:49 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 17:09:41 -1000 |
| commit | dedda31d064ddcb4f857f2db851c5a8c1e19deba (patch) | |
| tree | 2f76f41806727afa54449cdac8672056a5f8615c /internal/models/timeline.go | |
| parent | ec8a9c0ea46dec7d26caa763e3adefcaf3fc7552 (diff) | |
Implement architectural refactors for feature requests #28, #30, #31, #33-38
Phase 1: Bugs as First-Class Atoms (#28)
- Add resolved_at column to bugs table (migration 007)
- Add GetUnresolvedBugs(), ResolveBug(), UnresolveBug() store methods
- Include bugs in Tasks tab via BugToAtom() with completion toggle
- Add unit tests for bug resolution
Phase 2: Timeline as Default + Enhancements (#35, #37)
- Change default tab from tasks to timeline
- Add IsCompleted, DaySection, Source fields to TimelineItem
- Group timeline items by today/tomorrow/later sections
- Add completion checkboxes for tasks/cards, grey completed items
- Collapse tomorrow/later sections by default
Phase 3: Shopping Quick-Add (#33)
- Add user_shopping_items table (migration 008)
- Add SaveUserShoppingItem(), GetUserShoppingItems(), ToggleUserShoppingItem()
- Add HandleShoppingQuickAdd() and HandleShoppingToggle() handlers
- Add quick-add form to shopping tab
Phase 4: Mobile Swipe Navigation (#38)
- Add touch event handlers for swipe left/right tab switching
- 50px threshold triggers tab change
Phase 5: Consistent Background Opacity (#30)
- Add CSS variables for panel/card/input/modal backgrounds
- Update templates to use consistent opacity classes
Phase 6: Tab Reorganization (#37)
- Reorganize tabs: Timeline, Shopping, Conditions as main tabs
- Move Tasks, Planning, Meals under Details dropdown
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/models/timeline.go')
| -rw-r--r-- | internal/models/timeline.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/models/timeline.go b/internal/models/timeline.go index 4a619fa..469cce4 100644 --- a/internal/models/timeline.go +++ b/internal/models/timeline.go @@ -11,6 +11,14 @@ const ( TimelineItemTypeEvent TimelineItemType = "event" ) +type DaySection string + +const ( + DaySectionToday DaySection = "today" + DaySectionTomorrow DaySection = "tomorrow" + DaySectionLater DaySection = "later" +) + type TimelineItem struct { ID string `json:"id"` Type TimelineItemType `json:"type"` @@ -20,4 +28,26 @@ type TimelineItem struct { Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` OriginalItem interface{} `json:"-"` + + // UI enhancement fields + IsCompleted bool `json:"is_completed"` + DaySection DaySection `json:"day_section"` + Source string `json:"source"` // "todoist", "trello", "plantoeat", "calendar" +} + +// ComputeDaySection sets the DaySection based on the item's time +func (item *TimelineItem) ComputeDaySection(now time.Time) { + today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + tomorrow := today.AddDate(0, 0, 1) + dayAfterTomorrow := today.AddDate(0, 0, 2) + + itemDay := time.Date(item.Time.Year(), item.Time.Month(), item.Time.Day(), 0, 0, 0, 0, item.Time.Location()) + + if itemDay.Before(tomorrow) { + item.DaySection = DaySectionToday + } else if itemDay.Before(dayAfterTomorrow) { + item.DaySection = DaySectionTomorrow + } else { + item.DaySection = DaySectionLater + } } |
