diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-20 21:38:18 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-20 21:38:18 -1000 |
| commit | dd4689a71de8f1c0b5a2d483827411a9645ad66a (patch) | |
| tree | dca7bae311ceeac5eddae2213834d36c576676d4 /internal/models/atom.go | |
| parent | a38ce269cc9283556621b5447eb3a0caf697eae9 (diff) | |
UI improvements and bug fixes
- Gray out overdue tasks (past today)
- Sort tasks with specific times before midnight-due tasks
- Fix timezone bug in quick add (use local timezone)
- Remove "Personal Dashboard" header, minimal refresh/logout bar
- Change Todoist icon from checkmark to red circle
- Show due time when set (not just date)
- Compact task list styling
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/models/atom.go')
| -rw-r--r-- | internal/models/atom.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/internal/models/atom.go b/internal/models/atom.go index fe40962..b3a384a 100644 --- a/internal/models/atom.go +++ b/internal/models/atom.go @@ -36,11 +36,30 @@ type Atom struct { // UI Helpers (to be populated by mappers) SourceIcon string // e.g., "trello-icon.svg" or emoji ColorClass string // e.g., "border-blue-500" + IsOverdue bool // True if due date is before today + HasSetTime bool // True if due time is not midnight (has specific time) // Original Data (for write operations) Raw interface{} } +// ComputeUIFields calculates IsOverdue and HasSetTime based on DueDate +func (a *Atom) ComputeUIFields() { + if a.DueDate == nil { + return + } + + now := time.Now() + today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + + // Check if overdue (due date is before today) + dueDay := time.Date(a.DueDate.Year(), a.DueDate.Month(), a.DueDate.Day(), 0, 0, 0, 0, a.DueDate.Location()) + a.IsOverdue = dueDay.Before(today) + + // Check if has set time (not midnight) + a.HasSetTime = a.DueDate.Hour() != 0 || a.DueDate.Minute() != 0 +} + // TaskToAtom converts a Todoist Task to an Atom func TaskToAtom(t Task) Atom { // Todoist priority: 1 (normal) to 4 (urgent) @@ -63,7 +82,7 @@ func TaskToAtom(t Task) Atom { DueDate: t.DueDate, CreatedAt: t.CreatedAt, Priority: priority, - SourceIcon: "✓", // Checkmark emoji for tasks + SourceIcon: "🔴", // Red circle for Todoist ColorClass: "border-red-500", Raw: t, } |
