gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit63d0f2ee63d0f2eejukebox ST1 (jukebox#2): styles of main, songs and search moved into their own Style blocks (styles.hl 81 to 8 rules, pixel-identical at 390 and 1280); artist and album wait for an hl:web fixmre63d0f2ee/components/artist.hl

2.3 KB

  1. // components/artist.hl — `/artists/<id>`: one artist, with a switch between their albums and their songs (both are long lists for some artists, so both are virtual lists).
  2. parent './main.hl'
  3. import { navigate } from 'hl:web'
  4. import VirtualList from './virtual-list/virtual-list.hl'
  5. import { rowsFor, artistInfo } from '../lib/rows.hl'
  6. id = null
  7. info = artistInfo(id)
  8. __title = info.name + ' · Jukebox'
  9. String tab = info.albums > 1 ? 'albums' : 'songs'
  10. Hybrid artistCtx = { kind = info.albums > 1 ? 'artist-albums' : 'artist-songs' artist = id sort = 'artist' }
  11. Hybrid firstRows = rowsFor({ kind = info.albums > 1 ? 'artist-albums' : 'artist-songs' artist = id sort = 'artist' }, 0, 100)
  12. Number listTotal = firstRows.total
  13. Hybrid chunk = firstRows.rows
  14. Number chunkFrom = 0
  15. String playingId = ''
  16. String albumsClass = tab == 'albums' ? 'on' : ''
  17. String songsClass = tab == 'songs' ? 'on' : ''
  18. on artistLoad(first, wanted) {
  19. let start = first - 20
  20. if (start < 0) { start = 0 }
  21. r = emit server jbRows(artistCtx, start, 100)
  22. listTotal = r.total
  23. chunk = r.rows
  24. chunkFrom = r.offset
  25. return null
  26. }
  27. loadRange = (first, wanted) => { emit artistLoad(first, wanted) }
  28. picked = (rowId, index) => {
  29. if (tab == 'albums') { navigate('/albums/' + rowId) } else {
  30. playingId = rowId
  31. emit jbPlay(artistCtx, index)
  32. }
  33. }
  34. on artistShuffle(e) {
  35. emit jbShuffle({ kind = 'list' ctx = { kind = 'artist-songs' artist = id sort = 'artist' } })
  36. return null
  37. }
  38. on artistTab(e) {
  39. tab = e.target.getAttribute('data-tab')
  40. artistCtx = { kind = tab == 'albums' ? 'artist-albums' : 'artist-songs' artist = id sort = 'artist' }
  41. r = emit server jbRows(artistCtx, 0, 100)
  42. listTotal = r.total
  43. chunk = r.rows
  44. chunkFrom = 0
  45. emit vlTop()
  46. return null
  47. }
  48. View {
  49. jbScreen {
  50. jbTabs {
  51. button { type = "button" class = albumsClass 'data-tab' = "albums" on click(e) { emit artistTab(e) } "Albums" }
  52. button { type = "button" class = songsClass 'data-tab' = "songs" on click(e) { emit artistTab(e) } "Songs" }
  53. button { id = "shuffle" type = "button" on click(e) { emit artistShuffle(e) } "Shuffle" }
  54. }
  55. VirtualList { itemCount = listTotal rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = playingId listLabel = "Artist"
  56. jbHead { h1 { id = "name" info.name } p { info.line } }
  57. }
  58. }
  59. }

Branches

Latest commits

  • 63d0f2eejukebox ST1 (jukebox#2): styles of main, songs and search moved into their own Style blocks (styles.hl 81 to 8 rules, pixel-identical at 390 and 1280); artist and album wait for an hl:web fixmre
  • c5b8fde9jukebox JB3b: keyboard gap repro as a reportmre
  • 9daebb4bjukebox JB3b: shuffle, now-playing overlay, next and previous, play counting, media session, gates; keyboard left open (Hybriel gap)mre
  • 59c1373ejukebox JB3 (work in progress): albums without folder and with disc markers folded, compilations, duplicate songs, own play counter, server-side shuffle queuemre
  • 2a4cfc55jukebox: library screens (songs, artists, albums, artist, album, search, favourites), compact player bar, /stream with Range, thumbnails, virtual list vendored, ui gate and real-library checkmre
  • 93a44212jukebox: report, numbers of the full scan, notes on the index key rulemre
  • bf5167dajukebox: index keys without commas (mpackdb loses them after a reopen), comma fixture and gate checksmre
  • 28a82fa2jukebox: README, STATUS, LOG, DECISIONSmre
  • d13987dfjukebox: library scanner, ID3 reader, mpackdb database and JSON API, with fixtures and a gatemre