summaryrefslogtreecommitdiff
path: root/issues/001-hide-future-tasks-behind-fold.md
blob: f6012fe93782539886b90b4a77161964c53dd078 (plain)
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
# [FEATURE] Hide future tasks behind a fold

## Description
Hide tasks more than 3-7 days out behind a fold.

## User Story
As a user, I want tasks more than N days out hidden by default so that I can focus on immediate priorities.

## Technical Context
- Affects: `internal/handlers/handlers.go` (task filtering), `web/templates/partials/todoist-tasks.html` or `tasks-tab.html`
- Data already has `due_date`; filtering is a presentation concern

## Test Strategy

### Unit Test (Red)
**File:** `internal/handlers/handlers_test.go`

Test a new filter function `FilterTasksByHorizon(tasks []Task, days int)` returns only tasks within range.

```go
func TestFilterTasksByHorizon(t *testing.T) {
    // Given tasks with varying due dates
    // When filtered with horizon of 7 days
    // Then only tasks within 7 days are in "visible" slice
    // And remaining tasks are in "deferred" slice
}
```

### E2E Test (Red)
Verify collapsed section renders with count badge; click expands to show deferred tasks.

## Proposed Approach

1. Add config param `task_horizon_days` (default 7)
2. Partition tasks in handler into "visible" vs "deferred"
3. Render deferred in a collapsible `<details>` element with HTMX swap
4. Show count badge on collapsed header (e.g., "+12 later")

## Affected Components
- `internal/handlers/handlers.go`
- `internal/config/config.go`
- `web/templates/partials/todoist-tasks.html`
- `web/templates/partials/tasks-tab.html`

## Definition of Done
- [ ] Tasks beyond horizon hidden by default
- [ ] Collapsible UI shows count of hidden tasks
- [ ] Click to expand shows all deferred tasks
- [ ] Horizon days configurable
- [ ] Unit tests pass
- [ ] E2E test confirms behavior