feat: Sprint 1 — host model, mock store, dashboard CRUD, HTMX partials

This commit is contained in:
swanadiva
2026-07-07 13:15:56 +07:00
parent 43a19b723a
commit d771925727
7 changed files with 278 additions and 16 deletions
+6 -11
View File
@@ -8,7 +8,7 @@
<span class="w-5 h-5 bg-primary/20 rounded flex items-center justify-center text-xs font-bold"></span>
<span class="text-xs font-medium text-on-surface-variant uppercase tracking-wide">Active Connections</span>
</div>
<span class="text-2xl font-bold text-on-surface">0</span>
<span class="text-2xl font-bold text-on-surface">{{.Active}}</span>
</div>
<div class="rounded-xl bg-white border border-outline-variant/30 p-4">
<div class="flex items-center gap-2 text-secondary mb-1">
@@ -22,7 +22,7 @@
<span class="w-5 h-5 bg-tertiary/20 rounded flex items-center justify-center text-xs font-bold">#</span>
<span class="text-xs font-medium text-on-surface-variant uppercase tracking-wide">Saved Hosts</span>
</div>
<span class="text-2xl font-bold text-on-surface">0</span>
<span class="text-2xl font-bold text-on-surface">{{len .Hosts}}</span>
</div>
</div>
@@ -30,13 +30,13 @@
<div class="relative flex-1 max-w-md">
<input type="search" name="q" placeholder="Search hosts..."
hx-get="/hosts?q=..." hx-trigger="keyup delay:200ms"
hx-target="#host-list"
hx-target="#host-list" hx-include="[name='filter']"
class="w-full pl-9 pr-3 py-2 rounded-lg border border-outline-variant/50
bg-white text-sm text-on-surface placeholder-on-surface-variant
focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50">
</div>
<select name="filter"
hx-get="/hosts?filter={value}" hx-target="#host-list"
hx-get="/hosts?filter={value}" hx-trigger="change" hx-target="#host-list"
class="px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface
focus:outline-none focus:ring-2 focus:ring-primary/30">
<option value="all">All</option>
@@ -57,12 +57,7 @@
</div>
</div>
<div id="host-list" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
<div class="rounded-xl border-2 border-dashed border-outline-variant/30 p-8 flex flex-col items-center justify-center text-on-surface-variant/50 hover:border-primary/30 hover:text-primary/50 transition-colors cursor-pointer"
@click="console.log('add host')">
<svg class="w-8 h-8 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
<span class="text-sm font-medium">Add New Host</span>
</div>
</div>
{{template "host_list" .}}
</div>
{{template "host_modal" .}}
{{end}}