summaryrefslogtreecommitdiff
path: root/PHASE_2_SURGICAL_PLAN.md
blob: bd761e58c210f29df1dc1cf63f1446e95f6bd711 (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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Phase 2: The Productivity OS (Interactive & Refined)

This phase transforms the dashboard into a primary interface with write capabilities, smart sorting, and a refined "Glassmorphism" UI.

## 1. The Unified Atom Model
**Status:** [ ] Pending

```text
Define `models.Atom` to abstract over Trello, Todoist, Obsidian, and PlanToEat.
Implement mapper functions.

1.  **Model:** Create `internal/models/atom.go` with:
    - AtomSource enum (trello, todoist, obsidian, plantoeat)
    - AtomType enum (task, note, meal)
    - Atom struct with normalized fields (ID, Title, Description, DueDate, Priority, etc.)
    - UI helper fields (SourceIcon, ColorClass)
    - Raw field for preserving original data
2.  **Mappers:** Implement converter functions:
    - TaskToAtom(Task) -> Atom
    - CardToAtom(Card) -> Atom
    - NoteToAtom(Note) -> Atom
    - MealToAtom(Meal) -> Atom
3.  **Priority Mapping:** Normalize priority scales to 1-4 (Low to Urgent)
4.  **Color Mapping:** Assign brand colors (Trello=Blue, Todoist=Red, Obsidian=Purple, PlanToEat=Green)
```

## 2. Information Architecture: The 4-Tab Split
**Status:** [x] Complete

```text
Refactor the frontend and router to support 4 distinct tabs.

1.  **Templates:** Update `web/templates/index.html` navigation to:
    - Tasks (Todoist + Due Trello)
    - Planning (Trello Boards)
    - Notes (Obsidian)
    - Meals (PlanToEat)
2.  **Handlers:** Create/Update handlers in `internal/handlers/tabs.go` (new file):
    - `HandleTasksTab`: Aggregates Todoist + Trello cards with due dates.
    - `HandlePlanningTab`: Returns Trello boards (excluding cards shown in Tasks?).
    - `HandleMealsTab`: Returns PlanToEat data.
3.  **Router:** Register new routes `/tabs/tasks`, `/tabs/planning`, `/tabs/meals`.
```

## 3. Trello: Smart Sorting & Logic
**Status:** [x] Complete

```text
Enhance Trello sorting in `internal/api/trello.go` and `internal/store/sqlite.go`.

1.  **Backend:** Update `GetBoardsWithCards` to sort by:
    - Primary: Has active cards?
    - Secondary: Newest card modification date (requires parsing Trello ID hex timestamp).
    - Tertiary: Number of cards.
2.  **Store:** Update SQL query in `GetBoards` to reflect this sort order.
```

## 4. Todoist: "Due First" Sorting
**Status:** [ ] Pending

```text
Ensure Todoist tasks are sorted by urgency.

1.  **Store:** Edit `internal/store/sqlite.go` -> `GetTasks`.
2.  **Query:** Update ORDER BY clause:
    - `CASE WHEN due_date IS NULL THEN 1 ELSE 0 END` (Due dates first)
    - `due_date ASC` (Earliest first)
    - `priority DESC` (High priority next)
```

## 5. Obsidian: Search & Categorization
**Status:** [ ] Pending

```text
Enhance Obsidian to support search and categorization.

1.  **Backend:** Edit `internal/api/obsidian.go`.
    - Add `SearchNotes(query string)`.
    - Add logic to group notes by tags (e.g., #planning, #task, #meal).
2.  **Frontend:** Add a Search Bar to the Notes tab.
    - HTMX trigger: `hx-get="/tabs/notes/search" hx-trigger="keyup changed delay:500ms"`.
```

## 6. Visual Overhaul: "Muted Landscape"
**Status:** [ ] Pending

```text
Apply the new visual design.

1.  **CSS:** Update Tailwind config for "muted" palette.
2.  **Layout:** Add a full-screen background image container.
3.  **Components:** Update cards to use `bg-white/80 backdrop-blur-md` (Glassmorphism).
```

## 7. Write Operations (The "Primary Interface" Goal)
**Status:** [ ] Pending

```text
Implement the interactive features.

1.  **Trello:** Implement `UpdateCard` (Archive) and "Mark Complete" button.
2.  **Obsidian:** Implement `CreateNote` (Quick Capture) and "New Note" form.
```

## 8. Mobile PWA
**Status:** [ ] Pending

```text
Make it installable.

1.  Create `web/static/manifest.json`.
2.  Add icons.
3.  Link manifest in `index.html`.
```