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/handlers | |
| 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/handlers')
| -rw-r--r-- | internal/handlers/handlers.go | 4 | ||||
| -rw-r--r-- | internal/handlers/tabs.go | 31 |
2 files changed, 28 insertions, 7 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 8d809ae..e4d6457 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -762,10 +762,10 @@ func (h *Handler) HandleUnifiedAdd(w http.ResponseWriter, r *http.Request) { return } - // Parse due date if provided + // Parse due date if provided (use local timezone) var dueDate *time.Time if dueDateStr != "" { - parsed, err := time.Parse("2006-01-02", dueDateStr) + parsed, err := time.ParseInLocation("2006-01-02", dueDateStr, time.Local) if err == nil { dueDate = &parsed } diff --git a/internal/handlers/tabs.go b/internal/handlers/tabs.go index 7e0b352..bd15710 100644 --- a/internal/handlers/tabs.go +++ b/internal/handlers/tabs.go @@ -88,7 +88,12 @@ func (h *TabsHandler) HandleTasks(w http.ResponseWriter, r *http.Request) { } } - // Sort atoms: by DueDate (earliest first), then by Priority (descending) + // Compute UI fields (IsOverdue, HasSetTime) + for i := range atoms { + atoms[i].ComputeUIFields() + } + + // Sort atoms: by DueDate (earliest first), then by HasSetTime, then by Priority sort.SliceStable(atoms, func(i, j int) bool { // Handle nil due dates (push to end) if atoms[i].DueDate == nil && atoms[j].DueDate != nil { @@ -98,14 +103,30 @@ func (h *TabsHandler) HandleTasks(w http.ResponseWriter, r *http.Request) { return true } - // Both have due dates, sort by date + // Both have due dates if atoms[i].DueDate != nil && atoms[j].DueDate != nil { - if !atoms[i].DueDate.Equal(*atoms[j].DueDate) { - return atoms[i].DueDate.Before(*atoms[j].DueDate) + // Compare by date only (ignore time) + dateI := atoms[i].DueDate.Truncate(24 * time.Hour) + dateJ := atoms[j].DueDate.Truncate(24 * time.Hour) + + if !dateI.Equal(dateJ) { + return dateI.Before(dateJ) + } + + // Same day: tasks with set times come before midnight tasks + if atoms[i].HasSetTime != atoms[j].HasSetTime { + return atoms[i].HasSetTime + } + + // Both have set times or both are midnight, sort by actual time + if atoms[i].HasSetTime && atoms[j].HasSetTime { + if !atoms[i].DueDate.Equal(*atoms[j].DueDate) { + return atoms[i].DueDate.Before(*atoms[j].DueDate) + } } } - // Same due date (or both nil), sort by priority (descending) + // Same due date/time (or both nil), sort by priority (descending) return atoms[i].Priority > atoms[j].Priority }) |
