gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit86fe543086fe5430log: HM62 startedmre86fe5430/components/genre.hl

2.8 KB

  1. // components/genre.hl — `/genres/:genre`, `/genres/:genre/page/:page` (mission 058, tracker.worldapi.org#25): the /movies and
  2. // /shows list narrowed to one genre — its movies AND series together, newest first (catalog.hl genre lists: a movie by its
  3. // release, a series by its newest released episode), 24 per page, poster + title (+ year), adult titles hidden like there.
  4. // The creator: "/genres/:genre pages look like the shows and movies list page just narrowed to their genre but show both
  5. // movies and shows with that genre". The genre pills on a show page link here (`/genre/<x>` answers 301 to it, project.hl).
  6. // The grid and the pagination: components/tilelist.hl.
  7. parent './main.hl'
  8. import TileList from './tilelist.hl'
  9. import { appTitle } from '../project.hl'
  10. import { genreBySlug } from '../lib/shows.hl'
  11. import { genrePage, genreCount } from '../lib/catalog.hl'
  12. import { warmReady, warmText } from '../lib/warm.hl'
  13. // static: an mpackdb-backed helper must be `static` (hybriel#115/#116)
  14. static genreOf = (&slug) => { return genreBySlug(&slug) }
  15. static listingOf = (&g, &raw) => { return g != null ? genrePage(&g.id, &raw) : { page = 1 pages = 1 tiles = [] } }
  16. static countOf = (&g) => { return g != null ? genreCount(&g.id) : 0 }
  17. genre = null
  18. page = null
  19. genreRow = genreOf(&genre)
  20. found = genreRow != null
  21. notFound = genreRow == null
  22. name = found ? genreRow.name : ''
  23. listing = listingOf(&genreRow, &page)
  24. tiles = listing.tiles
  25. pageNo = listing.page
  26. pageCount = listing.pages
  27. total = countOf(&genreRow)
  28. countText = total + (total == 1 ? ' title' : ' titles') + ', newest first · page ' + pageNo + ' of ' + pageCount
  29. hasTiles = total > 0
  30. noTiles = found && total == 0
  31. basePath = found ? '/genres/' + genreRow.urlSegment : '/genres'
  32. __title = found ? (pageNo > 1 ? name + ', page ' + pageNo + ' — ' + appTitle : name + ' — ' + appTitle) : appTitle
  33. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'catalog'
  34. // stage is there this page says so instead of showing half a map
  35. warming = !warmReady('catalog')
  36. warmNote = warming ? warmText() : ''
  37. View {
  38. listPage { id = "genre-page"
  39. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  40. if (notFound) {
  41. h1 { "Not found" }
  42. p { "This genre doesn't exist." }
  43. }
  44. // tracker.worldapi.org#20: "Genre | Action", the type word in the genre colour, the name white
  45. if (found) { h1 { class = "typed" typeWord { class = "type-word type-genre" "Genre" } typeSep { "|" } typeName { name } } }
  46. if (noTiles) { p { class = "muted" "Nothing in this genre yet." } }
  47. if (hasTiles) { p { class = "muted list-count" countText } }
  48. // always there (no `if` around a composed component, like /movies): empty for an unknown genre, no pager on one page
  49. TileList { tiles = tiles page = pageNo pages = pageCount basePath = basePath }
  50. }
  51. }

Branches

Latest commits

  • 86fe5430log: HM62 startedmre
  • 755307bbmission HM62mre
  • 4b2f2995HM61 report: tracker#61 packed people ordermre
  • 48faa84flog: #60 deploy startedmre
  • 90734c6cMerge branch 'hm60-shortids'mre
  • e0db0d1bHM60 report: tracker#60 packed short-ID ownersmre
  • 3c79b576Pack short-ID ownership into byte buffersmre
  • e822524bstatus wordingmre
  • 1c7f0480log: HM60/HM61 startedmre
  • 2841d215missions HM60 HM61mre
  • 289c6ce4HM1 report: heap object breakdownmre
  • 2e7d6257log: HM1 startedmre
  • 2f790465mission HM1: heap object breakdownmre
  • a18957falog: evening re-measure after CBmre
  • aac9a98dlog: evening re-measure startmre
  • 45163bd4log: person/tmdb error hypothesismre
  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre