gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0bb027da0bb027daconductor: caramboleyo is the user, not owner/creatorApollo0bb027da/components/album.hl

2.2 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 playingId = ''
  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 jbRows(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(e) {
  40. emit jbShuffle({ kind = 'list' ctx = albumCtx })
  41. return null
  42. }
  43. picked = (rowId, index) => {
  44. playingId = rowId
  45. emit jbPlay(albumCtx, index, rowId)
  46. emit albumLoad(index, 0)
  47. }
  48. View {
  49. jbScreen {
  50. VirtualList { itemCount = listTotal rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = playingId scrollTop = savedTop onScroll = rememberTop thumbs = "false" listLabel = "Songs of the album"
  51. jbHead { class = "jb-album"
  52. if (hasCover) { img { id = "cover" src = info.img alt = coverAlt } }
  53. if (noCover) { div { class = "jb-nocover" 'aria-hidden' = "true" } }
  54. h1 { id = "name" info.name }
  55. p { info.artist }
  56. p { info.line }
  57. button { id = "shuffle" type = "button" on click(e) { emit albumShuffle(e) } "Shuffle" }
  58. }
  59. }
  60. }
  61. }

Branches

Latest commits

  • 0bb027daconductor: caramboleyo is the user, not owner/creatorApollo
  • 04f5d9d5Merge branch 'day41' into mainJukebox
  • 8ed6da45|||PR README: media-player pin df9e7dfmre
  • d5d45fc3|||PR media-player df9e7df (repeat-one fix), sync pin and SOURCEmre
  • 89cdabb1Vendor Hybriel day41 (57054d9e): plugin dirs, set .somre
  • 1fecd6a7Merge branch 'records-day39' into mainJukebox
  • d6b3e068|||PR Records: day39 live (PR #2), mission 011 PR step, statusmre
  • 5fa19e89Merge branch 'day39' into mainJukebox
  • cfe95440|||PR day39 re-vendor: Hybriel 51e921d7 (bin 6b481aa7), ids kebab-case since hybriel#256: quoted state rule and tests use jb-shuffle / jb-repeatmre
  • f3614c9bRe-vendor to Hybriel day39 (51e921d7, bin 6b481aa7)mre
  • 9f5c6532Merge branch 'status-22-pr' into mainJukebox
  • 5838d6c7|||PR STATUS: #22 pending decision, PR-only rulemre
  • 29d2029cRecords: PR-only rule (Kunibert)mre
  • adacb0abRecords: neutral ticket rule, #22 decision recordedmre
  • b2d6f121Records: #308 hold liftedmre
  • 7ab67533Records: day39 on hold (hybriel#308)mre
  • 22f21739Records: note rebase before mergemre
  • f7368ea3Records: mission 011 day39, waits for lisbethmre
  • 9515d2cdRecords: jb20 livemre
  • 019f6601ui gate: comment names the open bug components#27 (workaround, not fixed)mre