1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# [FEATURE] Click task to open editable details
## Description
When I click a task, open details and let me update description.
## User Story
As a user, I want to click a task to view and edit its description inline.
## Technical Context
- Extends existing task display with detail view
- Requires new endpoints for fetching and updating task details
- HTMX-powered modal or slide-out panel
## Test Strategy
### Unit Test (Red)
**File:** `internal/handlers/handlers_test.go`
```go
func TestUpdateTaskDescription(t *testing.T) {
// Setup mock Todoist client
mockClient := &MockTodoistClient{}
handler := NewHandler(mockClient)
// Call update endpoint
req := httptest.NewRequest("PUT", "/tasks/123",
strings.NewReader(`{"description": "Updated desc"}`))
// Assert Todoist API called with correct params
mockClient.AssertCalled(t, "UpdateTask", "123", "Updated desc")
}
```
### E2E Test (Red)
```
1. Click on a task row
2. Assert modal/drawer opens with task details
3. Assert description field is editable
4. Edit description and save
5. Assert modal closes
6. Assert description persisted (re-open to verify)
```
## Proposed Approach
1. **Endpoints:**
- `GET /tasks/{id}/detail` — fetch task with full details
- `PUT /tasks/{id}` — update task (description, etc.)
2. **UI Flow:**
- Click task row triggers `hx-get="/tasks/{id}/detail"`
- Response loads into modal or slide-out panel
- Form with editable description (textarea)
- Save button triggers `hx-put="/tasks/{id}"`
- On success, close modal and optionally update task row
3. **Template:**
- New partial: `partials/task-detail.html`
- Contains: title (read-only or editable), description (editable), due date, labels, save/cancel buttons
4. **API Integration:**
- Update Todoist via API when saving
- Update local cache
## Affected Components
- `internal/handlers/handlers.go` (new endpoints)
- `internal/handlers/handlers_test.go`
- `internal/api/todoist.go` (UpdateTask method if not exists)
- `web/templates/partials/task-detail.html` (new)
- `web/templates/partials/todoist-tasks.html` (add click handler)
- `web/templates/index.html` (modal container if needed)
## Definition of Done
- [ ] Clicking task opens detail view
- [ ] Description field is editable
- [ ] Save persists to Todoist
- [ ] Local cache updated
- [ ] Modal/drawer closes on save
- [ ] Unit tests for update handler
- [ ] E2E test for full flow
|