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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Personal Dashboard</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<link rel="stylesheet" href="/static/css/output.css">
<style>
:root {
--panel-bg: rgba(0, 0, 0, 0.4);
--card-bg: rgba(255, 255, 255, 0.05);
--card-bg-hover: rgba(255, 255, 255, 0.1);
--input-bg: rgba(0, 0, 0, 0.4);
--modal-bg: rgba(0, 0, 0, 0.8);
--modal-overlay: rgba(0, 0, 0, 0.7);
}
.text-shadow { text-shadow: 0 0 8px black, 0 0 8px black; }
.text-shadow-sm { text-shadow: 0 0 4px black; }
/* CSS variable-based backgrounds */
.bg-panel { background-color: var(--panel-bg); }
.bg-card { background-color: var(--card-bg); }
.bg-card-hover:hover { background-color: var(--card-bg-hover); }
.bg-input { background-color: var(--input-bg); }
.bg-modal { background-color: var(--modal-bg); }
.bg-modal-overlay { background-color: var(--modal-overlay); }
</style>
</head>
<body class="min-h-screen bg-gray-900 text-white" style="background-image: url('{{.BackgroundURL}}'); background-size: cover; background-position: center; background-attachment: fixed;" hx-headers='{"X-CSRF-Token": "{{.CSRFToken}}"}'>
<div class="content-max-width py-3 sm:py-6">
<!-- Minimal Header -->
<header class="flex mb-4 sm:mb-6 justify-between items-center no-print text-shadow-sm">
<button onclick="refreshData()"
class="text-white/70 hover:text-white transition-colors p-1"
title="Refresh">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
</svg>
</button>
<span class="text-sm text-white/70 tracking-wider font-light" id="last-updated">{{.LastUpdated.Format "3:04 PM"}}</span>
<form method="POST" action="/logout">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<button type="submit" class="text-white/70 hover:text-white transition-colors text-xs tracking-wide">Logout</button>
</form>
</header>
<!-- Tab Navigation -->
<div class="mb-4 sm:mb-6 no-print">
<nav class="flex space-x-1 bg-panel backdrop-blur-sm rounded-xl p-1 text-shadow-sm">
<!-- Main Tabs -->
<button
class="tab-button {{if eq .ActiveTab "timeline"}}tab-button-active{{end}}"
hx-get="/tabs/timeline"
hx-target="#tab-content"
hx-push-url="?tab=timeline"
onclick="setActiveTab(this)">
🗓️ Timeline
</button>
<button
class="tab-button {{if eq .ActiveTab "shopping"}}tab-button-active{{end}}"
hx-get="/tabs/shopping"
hx-target="#tab-content"
hx-push-url="?tab=shopping"
onclick="setActiveTab(this)">
🛒 Shopping
</button>
<a href="/conditions"
class="tab-button"
target="_blank">
🌋 Conditions
</a>
<!-- Details Dropdown -->
<div class="relative" id="details-dropdown">
<button
class="tab-button {{if or (eq .ActiveTab "tasks") (eq .ActiveTab "planning") (eq .ActiveTab "meals")}}tab-button-active{{end}}"
onclick="toggleDetailsDropdown(event)">
📁 Details
<svg class="w-3 h-3 ml-1 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</button>
<div id="details-menu" class="hidden absolute top-full left-0 mt-1 bg-panel backdrop-blur-sm rounded-lg p-1 min-w-[140px] z-20">
<button
class="w-full text-left tab-button {{if eq .ActiveTab "tasks"}}tab-button-active{{end}}"
hx-get="/tabs/tasks"
hx-target="#tab-content"
hx-push-url="?tab=tasks"
onclick="setActiveTab(this); closeDetailsDropdown();">
✓ Tasks
</button>
<button
class="w-full text-left tab-button {{if eq .ActiveTab "planning"}}tab-button-active{{end}}"
hx-get="/tabs/planning"
hx-target="#tab-content"
hx-push-url="?tab=planning"
onclick="setActiveTab(this); closeDetailsDropdown();">
📋 Planning
</button>
<button
class="w-full text-left tab-button {{if eq .ActiveTab "meals"}}tab-button-active{{end}}"
hx-get="/tabs/meals"
hx-target="#tab-content"
hx-push-url="?tab=meals"
onclick="setActiveTab(this); closeDetailsDropdown();">
🍽️ Meals
</button>
</div>
</div>
</nav>
</div>
<!-- Tab Content -->
<div id="tab-content"
hx-get="/tabs/{{.ActiveTab}}"
hx-trigger="load"
hx-swap="innerHTML">
<div class="text-center py-8">
<div class="inline-block animate-pulse text-gray-600">Loading...</div>
</div>
</div>
</div>
<!-- Unified Action Button (FAB) -->
<button onclick="openActionModal()"
class="fixed bottom-4 right-4 bg-black/60 hover:bg-black/80 backdrop-blur-sm text-white p-4 rounded-full no-print"
style="box-shadow: 0 0 12px black;"
title="Quick Actions (Ctrl+K)">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg>
</button>
<!-- Unified Action Modal -->
<div id="action-modal" class="hidden fixed inset-0 bg-modal-overlay flex items-center justify-center p-4 z-50">
<div class="bg-modal backdrop-blur-sm rounded-lg max-w-md w-full max-h-[80vh] overflow-hidden" style="box-shadow: 0 0 20px black;">
<div class="p-4 border-b border-white/10 flex justify-between items-center">
<div class="flex gap-2">
<button onclick="switchActionTab('add')" id="tab-add"
class="px-3 py-1 rounded-lg text-sm font-medium bg-white/20 text-white">
✓ Task
</button>
<button onclick="switchActionTab('shopping')" id="tab-shopping"
class="px-3 py-1 rounded-lg text-sm font-medium text-white/60 hover:bg-white/10">
🛒 Shopping
</button>
<button onclick="switchActionTab('bug')" id="tab-bug"
class="px-3 py-1 rounded-lg text-sm font-medium text-white/60 hover:bg-white/10">
🐛 Bug
</button>
</div>
<button onclick="closeActionModal()" class="text-white/40 hover:text-white">✕</button>
</div>
<!-- Quick Add Tab -->
<div id="panel-add" class="p-4">
<form hx-post="/unified-add"
hx-swap="none"
hx-on::after-request="if(event.detail.successful) { this.reset(); closeActionModal(); htmx.trigger(document.body, 'refresh-tasks'); }">
<input type="text"
name="title"
placeholder="Task name..."
class="w-full bg-input border border-white/20 rounded-lg px-3 py-2 text-sm text-white placeholder-white/50 mb-3"
required
autofocus>
<div class="flex gap-2 mb-3">
<input type="date"
name="due_date"
id="modal-add-date"
class="flex-1 bg-input border border-white/20 rounded-lg px-3 py-2 text-sm text-white">
<select name="source" class="bg-input border border-white/20 rounded-lg px-3 py-2 text-sm text-white">
<option value="todoist">Todoist</option>
<option value="trello">Trello</option>
</select>
</div>
<button type="submit"
class="w-full bg-white/20 hover:bg-white/30 text-white px-4 py-2 rounded-lg text-sm font-medium">
Add Task
</button>
</form>
</div>
<!-- Shopping Tab -->
<div id="panel-shopping" class="p-4 hidden">
<form hx-post="/unified-add"
hx-swap="none"
hx-on::after-request="if(event.detail.successful) { this.reset(); closeActionModal(); htmx.trigger(document.body, 'refresh-tasks'); }">
<input type="hidden" name="source" value="trello">
<input type="text"
name="title"
placeholder="Item name..."
class="w-full bg-input border border-white/20 rounded-lg px-3 py-2 text-sm text-white placeholder-white/50 mb-3"
required>
<select name="list_id"
id="shopping-list-select"
class="w-full bg-input border border-white/20 rounded-lg px-3 py-2 text-sm text-white mb-3"
required>
<option value="">Loading stores...</option>
</select>
<button type="submit"
class="w-full bg-green-900/50 hover:bg-green-900/70 text-green-300 px-4 py-2 rounded-lg text-sm font-medium">
Add to Shopping List
</button>
</form>
</div>
<!-- Bug Report Tab -->
<div id="panel-bug" class="p-4 hidden">
<form hx-post="/bugs"
hx-target="#bug-list"
hx-swap="innerHTML"
hx-on::after-request="if(event.detail.successful) { this.reset(); closeActionModal(); }">
<textarea name="description"
placeholder="Describe the bug..."
class="w-full bg-input border border-white/20 rounded-lg px-3 py-2 text-sm text-white placeholder-white/50 mb-3 h-24"
required></textarea>
<button type="submit"
class="w-full bg-red-900/50 hover:bg-red-900/70 text-red-300 px-4 py-2 rounded-lg text-sm font-medium">
Submit Bug Report
</button>
</form>
<div class="mt-4 border-t border-white/10 pt-4">
<h3 class="text-sm font-medium text-white/70 mb-2">Recent Reports</h3>
<div id="bug-list"
class="max-h-32 overflow-y-auto"
hx-get="/bugs"
hx-trigger="load">
<p class="text-white/40 text-sm">Loading...</p>
</div>
</div>
</div>
</div>
</div>
<script>
function openActionModal() {
document.getElementById('action-modal').classList.remove('hidden');
var dateInput = document.getElementById('modal-add-date');
if (dateInput) {
var d = new Date();
dateInput.value = d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
}
setTimeout(function() {
var input = document.querySelector('#panel-add input[name="title"]');
if (input && !document.getElementById('panel-add').classList.contains('hidden')) input.focus();
}, 100);
}
function closeActionModal() {
document.getElementById('action-modal').classList.add('hidden');
}
function switchActionTab(tab) {
document.getElementById('panel-add').classList.toggle('hidden', tab !== 'add');
document.getElementById('panel-shopping').classList.toggle('hidden', tab !== 'shopping');
document.getElementById('panel-bug').classList.toggle('hidden', tab !== 'bug');
// Task tab styling
document.getElementById('tab-add').classList.toggle('bg-white/20', tab === 'add');
document.getElementById('tab-add').classList.toggle('text-white', tab === 'add');
document.getElementById('tab-add').classList.toggle('text-white/60', tab !== 'add');
// Shopping tab styling
document.getElementById('tab-shopping').classList.toggle('bg-green-900/50', tab === 'shopping');
document.getElementById('tab-shopping').classList.toggle('text-green-300', tab === 'shopping');
document.getElementById('tab-shopping').classList.toggle('text-white/60', tab !== 'shopping');
// Bug tab styling
document.getElementById('tab-bug').classList.toggle('bg-red-900/50', tab === 'bug');
document.getElementById('tab-bug').classList.toggle('text-red-300', tab === 'bug');
document.getElementById('tab-bug').classList.toggle('text-white/60', tab !== 'bug');
// Load shopping lists when switching to shopping tab
if (tab === 'shopping') {
loadShoppingLists();
}
}
function loadShoppingLists() {
var select = document.getElementById('shopping-list-select');
if (select.options.length <= 1) {
fetch('/partials/shopping-lists')
.then(function(r) { return r.text(); })
.then(function(html) {
select.innerHTML = html;
if (select.options.length > 0) {
select.selectedIndex = 0;
}
})
.catch(function(e) { console.error('Failed to load shopping lists:', e); });
}
}
// Keyboard shortcut: Ctrl+K or Cmd+K
document.addEventListener('keydown', function(e) {
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
e.preventDefault();
var modal = document.getElementById('action-modal');
if (modal.classList.contains('hidden')) {
openActionModal();
} else {
closeActionModal();
}
}
if (e.key === 'Escape') {
closeActionModal();
closeTaskModal();
}
});
function closeTaskModal() {
document.getElementById('task-edit-modal').classList.add('hidden');
}
// Details dropdown functions
function toggleDetailsDropdown(e) {
e.stopPropagation();
var menu = document.getElementById('details-menu');
menu.classList.toggle('hidden');
}
function closeDetailsDropdown() {
document.getElementById('details-menu').classList.add('hidden');
}
// Close dropdown when clicking outside
document.addEventListener('click', function(e) {
var dropdown = document.getElementById('details-dropdown');
if (dropdown && !dropdown.contains(e.target)) {
closeDetailsDropdown();
}
});
</script>
<!-- Task Edit Modal -->
<div id="task-edit-modal" class="hidden fixed inset-0 bg-modal-overlay flex items-center justify-center p-4 z-50">
<div class="bg-modal backdrop-blur-sm rounded-lg max-w-md w-full max-h-[80vh] overflow-hidden" style="box-shadow: 0 0 20px black;">
<div class="p-4 border-b border-white/10 flex justify-between items-center">
<h2 class="font-medium text-white">Edit Task</h2>
<button onclick="closeTaskModal()" class="text-white/40 hover:text-white">✕</button>
</div>
<div id="task-edit-content">
<p class="p-4 text-white/50 text-sm">Loading...</p>
</div>
</div>
</div>
<script src="/static/js/htmx.min.js"></script>
<script src="/static/js/app.js"></script>
</body>
</html>
|