# [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 `
` 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