blob: 2a89a4035e15c6b40ce08db96ac8791203f5d7ee (
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
|
{{define "tasks-tab"}}
<div class="space-y-6"
hx-get="/tabs/tasks"
hx-trigger="refresh-tasks from:body"
hx-target="#tab-content"
hx-swap="innerHTML">
<!-- Quick Add Form - Collapsible -->
<section class="bg-white rounded-lg shadow-sm">
<button type="button"
onclick="document.getElementById('quick-add-form').classList.toggle('hidden')"
class="w-full p-3 sm:p-4 text-left flex justify-between items-center">
<span class="font-semibold text-gray-900">+ Quick Add</span>
<span class="text-gray-400 text-sm">tap to expand</span>
</button>
<form id="quick-add-form"
class="hidden p-3 sm:p-4 pt-0 border-t border-gray-100"
hx-post="/unified-add"
hx-swap="none"
hx-on::after-request="if(event.detail.successful) { this.reset(); document.getElementById('trello-fields').style.display = 'none'; }">
<div class="flex flex-wrap gap-2 items-end">
<div class="flex-1 min-w-[150px]">
<input type="text"
name="title"
placeholder="Task name..."
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
required>
</div>
<div>
<input type="date"
name="due_date"
value="{{.Today}}"
class="border border-gray-300 rounded-lg px-2 py-2 text-sm focus:ring-2 focus:ring-primary-500">
</div>
<div>
<select name="source"
class="border border-gray-300 rounded-lg px-2 py-2 text-sm focus:ring-2 focus:ring-primary-500"
onchange="document.getElementById('trello-fields').style.display = this.value === 'trello' ? 'flex' : 'none'">
<option value="todoist">Todoist</option>
<option value="trello">Trello</option>
</select>
</div>
<button type="submit"
class="bg-primary-600 hover:bg-primary-700 text-white px-3 py-2 rounded-lg transition-colors font-medium text-sm">
Add
</button>
</div>
<!-- Trello Fields (Hidden by default) -->
<div id="trello-fields" class="flex flex-wrap gap-2 mt-3" style="display: none;">
<div>
<select name="board_id"
class="border border-gray-300 rounded-lg px-2 py-2 text-sm"
hx-get="/partials/lists"
hx-target="#list-select"
hx-trigger="change"
hx-swap="innerHTML">
<option value="">Select Board...</option>
{{range .Boards}}
<option value="{{.ID}}">{{.Name}}</option>
{{end}}
</select>
</div>
<div>
<select id="list-select" name="list_id" class="border border-gray-300 rounded-lg px-2 py-2 text-sm">
<option value="">Select List...</option>
</select>
</div>
</div>
</form>
</section>
<!-- Tasks List -->
{{if .Atoms}}
<div class="space-y-2">
{{range .Atoms}}
<div class="task-item bg-white rounded-lg p-3 sm:p-4 shadow-sm hover:shadow-md transition-shadow border-l-4 {{.ColorClass}} {{if .IsOverdue}}opacity-50{{end}}"
hx-post="/complete-atom"
hx-trigger="click"
hx-vals='{"id": "{{.ID}}", "source": "{{.Source}}"}'
hx-target="this"
hx-swap="outerHTML"
hx-confirm="Mark as complete?">
<div class="flex items-start gap-2 sm:gap-3">
<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 font-medium {{if .IsOverdue}}text-gray-500{{else}}text-gray-900{{end}} break-words">{{.Title}}</h3>
{{if .URL}}
<a href="{{.URL}}" target="_blank" class="text-primary-600 hover:text-primary-800 flex-shrink-0" onclick="event.stopPropagation()">
<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="flex flex-wrap items-center gap-2 mt-1 text-xs text-gray-400">
{{if .DueDate}}
<span class="{{if .IsOverdue}}text-red-400{{end}}">{{.DueDate.Format "Jan 2"}}{{if .HasSetTime}}, {{.DueDate.Format "3:04pm"}}{{end}}</span>
{{end}}
{{if gt .Priority 2}}
<span class="text-red-500 font-medium">P{{.Priority}}</span>
{{end}}
</div>
</div>
</div>
</div>
{{end}}
</div>
{{else}}
<div class="bg-white/50 rounded-lg p-6 text-center">
<p class="text-gray-500 text-sm">No tasks found.</p>
</div>
{{end}}
</div>
{{end}}
|