gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchticket-10a557ac53jukebox#10 review fixes: README file map names lib/background.hl, on Error(Hybrid e) per L10mreticket-10/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. Boolean hasCover = info.img != ''
  19. Boolean noCover = info.img == ""
  20. String coverAlt = "Cover of " + info.name
  21. on albumLoad(first, wanted) {
  22. let start = first - 20
  23. if (start < 0) { start = 0 }
  24. r = emit server albumRows(albumCtx, start, 100)
  25. listTotal = r.total
  26. chunk = r.rows
  27. chunkFrom = r.offset
  28. return null
  29. }
  30. on server albumRememberScroll(key, top) {
  31. return rememberScroll(key, top)
  32. }
  33. on albumScrolled(top) {
  34. emit server albumRememberScroll('album:' + id, top)
  35. return null
  36. }
  37. rememberTop = (top) => { emit albumScrolled(top) }
  38. loadRange = (first, wanted) => { emit albumLoad(first, wanted) }
  39. on albumShuffle(Hybrid e) {
  40. $parent.jbShuffle({ kind = 'list' ctx = albumCtx })
  41. return null
  42. }
  43. picked = (String rowId, Number index) => {
  44. $parent.jbPlay(albumCtx, index, rowId)
  45. emit albumLoad(index, 0)
  46. }
  47. View {
  48. jbScreen {
  49. VirtualList { itemCount = listTotal rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = $parent.nowId scrollTop = savedTop onScroll = rememberTop resetKey = listResetKey thumbs = "false" listLabel = "Songs of the album"
  50. jbHead { class = "jb-album"
  51. if (hasCover) { img { id = "cover" src = info.img alt = coverAlt } }
  52. if (noCover) { div { class = "jb-nocover" 'aria-hidden' = "true" } }
  53. h1 { id = "name" info.name }
  54. p { info.artist }
  55. p { info.line }
  56. button { id = "shuffle" type = "button" on click(e) { emit albumShuffle(e) } "Shuffle" }
  57. }
  58. }
  59. }
  60. }
  61. // This screen owns its row request across the server boundary.
  62. on server albumRows(Hybrid ctx, Number offset, Number limit) {
  63. return rowsFor(ctx, offset, limit)
  64. }

Branches

Latest commits

  • a557ac53jukebox#10 review fixes: README file map names lib/background.hl, on Error(Hybrid e) per L10mre
  • 3503b648|||PR jukebox#10: move startup and scan wiring out of project.hl into lib/background.hlmre
  • 536d7c58Merge branch 'playing-row' into mainJukebox
  • 05c3578c|||PR Keep each playing row bound to the shell song on day76mre
  • eaa7e6d6Vendor Hybriel day76 for live parent member readsmre
  • 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