jamtrack/views/dashboard.templ
Frédéric G. MARAND 6f3321371d bug(ux): fix various front end bugs.
- Fixed song add form (3 HTMX bugs: reset on typeahead, wrong query param, artist-only find-or-create)
- Added Played checkbox to add form; inline edit (✎/Save/Cancel) for setlist rows
- View fixes: date format, location name instead of ID in jam list, notes on location detail, song count column, location name links to detail
- Title typeahead + cross-filtering (artist↔title filter each other)
- Fixed datalist accumulation bug: HTMX 2.0 inherits hx-swap from parent; added explicit hx-swap="innerHTML" on both inputs
- Setlist sort by id (ULID = insertion order); created rejected by PocketBase
- Location delete guard: OnRecordDelete hook blocks if jams exist; FK enforcement is app-level not SQLite-level

Loose ends to pick up:
- Focus-after-add not user-confirmed yet (setTimeout approach)
- jams.participants and setlist.position still in DB schema but unused in UI (optional migration to clean up)
- Logout flow and dashboard ranking not browser-tested
2026-06-15 14:12:57 +02:00

44 lines
1.1 KiB
Text

package views
import (
"fmt"
"code.osinet.fr/fgm/jamtrack/internal/query"
)
// Dashboard renders the practice-list ranking table.
templ Dashboard(ranks []query.SongRank, locationID string) {
@Layout("Practice List") {
<div class="level">
<div class="level-left">
<h1 class="title">Practice List</h1>
</div>
<div class="level-right">
<a class="button is-primary" href="/jams/new">+ New Jam</a>
</div>
</div>
if len(ranks) == 0 {
<p class="has-text-grey">No songs logged yet. <a href="/jams/new">Add a jam</a> to get started.</p>
} else {
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Artist</th>
<th>Title</th>
<th class="has-text-right">Played</th>
<th class="has-text-right">Proposed</th>
</tr>
</thead>
<tbody>
for _, r := range ranks {
<tr>
<td>{ r.Artist }</td>
<td>{ r.Title }</td>
<td class="has-text-right">{ fmt.Sprint(r.PlayedCount) }</td>
<td class="has-text-right">{ fmt.Sprint(r.ProposedCount) }</td>
</tr>
}
</tbody>
</table>
}
}
}