blob: ae48f330009b256b100dd972f4e22a7350ae53fc (
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
{{define "planning-tab"}}
<div class="space-y-6 text-shadow-sm"
hx-get="/tabs/planning"
hx-trigger="refresh-tasks from:body"
hx-target="#tab-content"
hx-swap="innerHTML">
<!-- Scheduled Section (Events + Timed Tasks) -->
{{if .Scheduled}}
<div>
<h2 class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/90">
<span>⏰</span> Scheduled
</h2>
<div class="space-y-2">
{{range .Scheduled}}
<div class="bg-white/5 hover:bg-white/10 transition-colors rounded-lg border border-white/5 border-l-4 {{if eq .Type "event"}}border-l-blue-500{{else}}border-l-green-500{{end}}">
<div class="flex items-start gap-3 p-3">
<span class="text-lg flex-shrink-0 mt-0.5">{{.SourceIcon}}</span>
<div class="flex-1 min-w-0">
<div class="flex items-start justify-between gap-2">
<h3 class="text-sm text-white font-medium break-words">{{.Title}}</h3>
{{if .URL}}
<a href="{{.URL}}" target="_blank" class="text-white/50 hover:text-white flex-shrink-0">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
</svg>
</a>
{{end}}
</div>
<div class="text-xs text-white/50 mt-1">
{{if eq .Type "event"}}
{{if eq (.Start.Format "15:04") "00:00"}}
All Day
{{else}}
{{.Start.Format "3:04 PM"}} - {{.End.Format "3:04 PM"}}
{{end}}
{{else}}
{{.Start.Format "3:04 PM"}}
{{end}}
</div>
</div>
</div>
</div>
{{end}}
</div>
</div>
{{end}}
<!-- Unscheduled Section (Tasks due today without time) -->
{{if .Unscheduled}}
<div>
<h2 class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/90">
<span>📝</span> Today
</h2>
<div class="grid gap-2 sm:grid-cols-2">
{{range .Unscheduled}}
<div class="bg-white/5 hover:bg-white/10 transition-colors rounded-lg border border-white/5">
<div class="flex items-start gap-2 p-3">
<input type="checkbox"
hx-post="/complete-atom"
hx-vals='{"id": "{{.ID}}", "source": "{{.Source}}"}'
hx-target="closest div.rounded-lg"
hx-swap="outerHTML"
class="mt-1 h-5 w-5 rounded bg-black/40 border-white/30 text-white/80 focus:ring-white/30 cursor-pointer flex-shrink-0">
<span class="text-lg flex-shrink-0">{{.SourceIcon}}</span>
<div class="flex-1 min-w-0">
<div class="flex items-start justify-between gap-2">
<h3 class="text-sm text-white font-medium break-words {{if .IsOverdue}}text-amber-300{{end}}">{{.Title}}</h3>
{{if .URL}}
<a href="{{.URL}}" target="_blank" class="text-white/50 hover:text-white flex-shrink-0">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
</svg>
</a>
{{end}}
</div>
{{if gt .Priority 2}}
<span class="text-xs text-amber-300/80">P{{.Priority}}</span>
{{end}}
</div>
</div>
</div>
{{end}}
</div>
</div>
{{end}}
<!-- Quick Add Section -->
<div class="bg-white/5 backdrop-blur-sm rounded-lg p-4 border border-white/10">
<h2 class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/90">
<span>+</span> Quick Add
</h2>
<form hx-post="/unified-add"
hx-swap="none"
hx-on::after-request="if(event.detail.successful) { this.reset(); htmx.trigger(document.body, 'refresh-tasks'); }">
<div class="space-y-3">
<div class="flex gap-2">
<input type="text"
name="title"
placeholder="Add a task for today..."
class="flex-1 bg-black/40 border border-white/20 rounded-lg px-3 py-2 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-white/30 focus:border-transparent"
required>
<input type="hidden" name="due_date" value="{{.Today}}">
<input type="hidden" name="source" value="todoist">
<button type="submit"
class="bg-white/20 hover:bg-white/30 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors">
Add
</button>
</div>
{{if .Projects}}
<select name="project_id"
class="w-full bg-black/40 border border-white/20 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-white/30 focus:border-transparent">
<option value="">Select project (optional)...</option>
{{range .Projects}}
<option value="{{.ID}}">{{.Name}}</option>
{{end}}
</select>
{{end}}
</div>
</form>
</div>
<!-- Upcoming Section (Next 3 days) -->
{{if .Upcoming}}
<div>
<h2 class="text-lg font-semibold mb-3 flex items-center gap-2 text-white/90">
<span>📆</span> Upcoming
</h2>
<div class="space-y-2">
{{range .Upcoming}}
<div class="bg-white/5 hover:bg-white/10 transition-colors rounded-lg border border-white/5 opacity-70">
<div class="flex items-start gap-3 p-3">
<span class="text-lg flex-shrink-0 mt-0.5">{{.SourceIcon}}</span>
<div class="flex-1 min-w-0">
<div class="flex items-start justify-between gap-2">
<h3 class="text-sm text-white/80 font-medium break-words">{{.Title}}</h3>
{{if .URL}}
<a href="{{.URL}}" target="_blank" class="text-white/40 hover:text-white/70 flex-shrink-0">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
</svg>
</a>
{{end}}
</div>
<div class="text-xs text-white/40 mt-1">
{{.Start.Format "Mon, Jan 2"}}
{{if eq .Type "event"}}
{{if ne (.Start.Format "15:04") "00:00"}}
at {{.Start.Format "3:04 PM"}}
{{end}}
{{else}}
{{if or (ne .Start.Hour 0) (ne .Start.Minute 0)}}
at {{.Start.Format "3:04 PM"}}
{{end}}
{{end}}
</div>
</div>
</div>
</div>
{{end}}
</div>
</div>
{{end}}
<!-- Empty state if nothing scheduled -->
{{if and (not .Scheduled) (not .Unscheduled) (not .Upcoming)}}
<div class="text-center py-8 text-white/50">
<p>No scheduled items for the next few days.</p>
</div>
{{end}}
</div>
{{end}}
|