gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0923398b0923398bMerge branch 'records-1124d' into mainJukebox0923398b/components/album.hl

2.4 KB

  1. // components/album.hl — `/albums/<id>`: one album, the cover large on top, its songs in track order below; a tap plays from that song on.
  2. parent './main.hl'
  3. import VirtualList from './virtual-list/virtual-list.hl'
  4. import { rowsFor, albumInfo } from '../lib/rows.hl'
  5. import { lastScroll, rememberScroll, startRowFor } from '../lib/remember.hl'
  6. id = null
  7. info = albumInfo(id)
  8. __title = info.name + ' · Jukebox'
  9. Hybrid albumCtx = { kind = 'album' album = id }
  10. // where this album was left (lib/remember.hl, keyed by the album's id)
  11. Number savedTop = lastScroll('album:' + id)
  12. Number firstRow = startRowFor(savedTop)
  13. Hybrid firstRows = rowsFor({ kind = 'album' album = id }, firstRow, 100)
  14. Number listTotal = firstRows.total
  15. Hybrid chunk = firstRows.rows
  16. Number chunkFrom = firstRows.offset
  17. String listResetKey = id
  18. String playingId = ''
  19. Boolean hasCover = info.img != ''
  20. Boolean noCover = info.img == ""
  21. String coverAlt = "Cover of " + info.name
  22. on albumLoad(first, wanted) {
  23. let start = first - 20
  24. if (start < 0) { start = 0 }
  25. r = emit server albumRows(albumCtx, start, 100)
  26. listTotal = r.total
  27. chunk = r.rows
  28. chunkFrom = r.offset
  29. return null
  30. }
  31. on server albumRememberScroll(key, top) {
  32. return rememberScroll(key, top)
  33. }
  34. on albumScrolled(top) {
  35. emit server albumRememberScroll('album:' + id, top)
  36. return null
  37. }
  38. rememberTop = (top) => { emit albumScrolled(top) }
  39. loadRange = (first, wanted) => { emit albumLoad(first, wanted) }
  40. on albumShuffle(Hybrid e) {
  41. $parent.jbShuffle({ kind = 'list' ctx = albumCtx })
  42. return null
  43. }
  44. picked = (String rowId, Number index) => {
  45. playingId = rowId
  46. $parent.jbPlay(albumCtx, index, rowId)
  47. emit albumLoad(index, 0)
  48. }
  49. View {
  50. jbScreen {
  51. VirtualList { itemCount = listTotal rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = playingId scrollTop = savedTop onScroll = rememberTop resetKey = listResetKey thumbs = "false" listLabel = "Songs of the album"
  52. jbHead { class = "jb-album"
  53. if (hasCover) { img { id = "cover" src = info.img alt = coverAlt } }
  54. if (noCover) { div { class = "jb-nocover" 'aria-hidden' = "true" } }
  55. h1 { id = "name" info.name }
  56. p { info.artist }
  57. p { info.line }
  58. button { id = "shuffle" type = "button" on click(e) { emit albumShuffle(e) } "Shuffle" }
  59. }
  60. }
  61. }
  62. }
  63. // This screen owns its row request across the server boundary.
  64. on server albumRows(Hybrid ctx, Number offset, Number limit) {
  65. return rowsFor(ctx, offset, limit)
  66. }

Branches

Latest commits

  • 0923398bMerge branch 'records-1124d' into mainJukebox
  • 78f0cc86|||PR records 2026-11-24: inbox-thread rule, "Not playing" confirmed and closedmre
  • c1b153c4Merge branch 'records-1124c' into mainJukebox
  • d7b5e780|||PR Records 2026-11-24 (2): live day72, PR #19 merge, #10 newsmre
  • 43b564dbMerge branch 'records-1124b' into mainJukebox
  • fa86b08c|||PR Records 2026-11-24: LOG, STATUS, missions 020-023mre
  • 0a2ae3daMerge remote-tracking branch 'origin/records-1123' into records-1124mre
  • 9a48cfcaMerge branch 'vendor-theme' into mainJukebox
  • 170d3735Merge branch 'code-order-2' into mainJukebox
  • 3f1918a7|||PR Re-sync layouts theme 4099e64 with Segoe UI firstmre
  • 2e7f6a43Vendor virtual-list 489afcf from components.hybrielmre
  • 0ba85799Merge branch 'reset-classes' into mainJukebox
  • 502eeed5jukebox#20: vendor virtual-list initial resetKey baseline fixmre
  • 6d5ce287|||PR jukebox#9 Centralize songs table reads and writes in db.hlmre
  • dcca21abjukebox#8 Move copies and queue logic into their topicsmre
  • 3b76651cjukebox#20: update virtual-list README pin and resetKey optionsmre
  • bc09e1e8|||PR jukebox#20: reset virtual lists through resetKey (partial validation)mre
  • a3796dc5Records: live step waits for idlemre
  • 3b158e16Records: merges of #9 and #11mre
  • 27204167Merge main into records-1123mre