dashboard.templ 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package views
  2. import (
  3. "fmt"
  4. "code.osinet.fr/fgm/jamtrack/internal/query"
  5. )
  6. // Dashboard renders the practice-list ranking table.
  7. templ Dashboard(ranks []query.SongRank, locationID string) {
  8. @Layout("Practice List") {
  9. <div class="level">
  10. <div class="level-left">
  11. <h1 class="title">Practice List</h1>
  12. </div>
  13. <div class="level-right">
  14. <a class="button is-primary" href="/jams/new">+ New Jam</a>
  15. </div>
  16. </div>
  17. if len(ranks) == 0 {
  18. <p class="has-text-grey">No songs logged yet. <a href="/jams/new">Add a jam</a> to get started.</p>
  19. } else {
  20. <table class="table is-fullwidth is-striped is-hoverable">
  21. <thead>
  22. <tr>
  23. <th>Artist</th>
  24. <th>Title</th>
  25. <th class="has-text-right">Played</th>
  26. <th class="has-text-right">Proposed</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. for _, r := range ranks {
  31. <tr>
  32. <td>{ r.Artist }</td>
  33. <td>{ r.Title }</td>
  34. <td class="has-text-right">{ fmt.Sprint(r.PlayedCount) }</td>
  35. <td class="has-text-right">{ fmt.Sprint(r.ProposedCount) }</td>
  36. </tr>
  37. }
  38. </tbody>
  39. </table>
  40. }
  41. }
  42. }