gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit9c4397c99c4397c9mission HM63mre9c4397c9/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

  • 9c4397c9mission HM63mre
  • 8dfe42c8mission DP62mre
  • e347fef4Merge rv44: tracker#61 #62 on Hybriel day44mre
  • 8274bcf1log: RV44 done, deploy held for the usage windowmre
  • 1ef7a3b1RV44: report day44 gates and migration/restart proofsmre
  • a5f62f6cRV44: re-vendor Hybriel set day44 (source 222edef7, bin 4f0f263e)mre
  • 6159a248Merge branch 'hm62-personindex' into rv44mre
  • a8923d93log: RV44 startedmre
  • cf28cf77mission RV44mre
  • 585782dfLog: tracker#60 Chrome look, STATUS rewrittenmre
  • 147d0172conductor: caramboleyo is the user, not owner/creatorApollo
  • 21dd0cfblog: #60 live measurement, reviewmre
  • 7793cf94HM62b report: person indexes with fixed mpackdbmre
  • b4c8d3a9Document tracker#62 fixed-index migration and GC proofmre
  • 09d66ed5status: #60 livemre
  • 4171672flog: #60 livemre
  • f52862a2log: HM62b startedmre
  • 88fde2c4mission HM62bmre
  • a722e526log: #62 blocked by hybriel#317mre
  • 074a7418log: #62 assigned to Tracker; pending rulemre