summaryrefslogtreecommitdiff
path: root/internal/api/todoist.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-21 22:53:37 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-21 22:53:37 -1000
commit583f90c5dedf0235fa45557359b0e6e7dd62b0f0 (patch)
tree304e4527b6668669197fc9ffdf2ffc87566478f0 /internal/api/todoist.go
parentdd4689a71de8f1c0b5a2d483827411a9645ad66a (diff)
Implement 10 UI/UX improvements and bug fixes
- Fix outdated Todoist task URL format (showTask -> app/task) - Fix quick-add date defaulting to tomorrow in evening (client-side JS) - Add tap-to-expand for task descriptions with checkbox completion - Add visual differentiation: overdue (red), future (gray), today (normal) - Sort tasks by urgency: overdue > today-timed > today-allday > future - Keep completed tasks visible with strikethrough until refresh - Add random Unsplash landscape background with content overlay - Hide future tasks behind collapsible fold with count badge - Unified modal menu for Quick Add + Bug Report (Ctrl+K shortcut) - Click task title to edit description in modal Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/api/todoist.go')
-rw-r--r--internal/api/todoist.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/internal/api/todoist.go b/internal/api/todoist.go
index b51fffd..14c6c0b 100644
--- a/internal/api/todoist.go
+++ b/internal/api/todoist.go
@@ -266,7 +266,7 @@ func ConvertSyncItemsToTasks(items []SyncItemResponse, projectMap map[string]str
Priority: item.Priority,
Completed: false,
Labels: item.Labels,
- URL: fmt.Sprintf("https://todoist.com/showTask?id=%s", item.ID),
+ URL: fmt.Sprintf("https://todoist.com/app/task/%s", item.ID),
}
// Parse added_at
@@ -389,6 +389,35 @@ func (c *TodoistClient) CreateTask(ctx context.Context, content, projectID strin
return task, nil
}
+// UpdateTask updates a task with the specified changes
+func (c *TodoistClient) UpdateTask(ctx context.Context, taskID string, updates map[string]interface{}) error {
+ jsonData, err := json.Marshal(updates)
+ if err != nil {
+ return fmt.Errorf("failed to marshal updates: %w", err)
+ }
+
+ url := fmt.Sprintf("%s/tasks/%s", c.baseURL, taskID)
+ req, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewBuffer(jsonData))
+ if err != nil {
+ return fmt.Errorf("failed to create request: %w", err)
+ }
+ req.Header.Set("Authorization", "Bearer "+c.apiKey)
+ req.Header.Set("Content-Type", "application/json")
+
+ resp, err := c.httpClient.Do(req)
+ if err != nil {
+ return fmt.Errorf("failed to update task: %w", err)
+ }
+ defer resp.Body.Close()
+
+ if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent {
+ body, _ := io.ReadAll(resp.Body)
+ return fmt.Errorf("todoist API error (status %d): %s", resp.StatusCode, string(body))
+ }
+
+ return nil
+}
+
// CompleteTask marks a task as complete in Todoist
func (c *TodoistClient) CompleteTask(ctx context.Context, taskID string) error {
// Create POST request to close endpoint