gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitcb38de2bcb38de2blog: swap 503 causemrecb38de2b/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

  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre
  • 2f8030d6log: CB gates greenmre
  • 498bf644log: CB gates startmre
  • f59c2847gc1: bound the five request caches (shows.hl cacheLimit)mre
  • 6ea2c6d6log: morning re-measure 11-04mre
  • 446290f0log: GC1 livemre
  • 8e6aa91dlog: GC1 deploy retrymre
  • 87ad2dc1log: GC1 deployingmre
  • 53f10fb8Merge branch 'gc1-deploy'mre
  • 7fcbf1d2log: GC1 deploy GOmre
  • 1fb6664bcompose: TRACKER_QSTATS=1 (GC1 measurement)mre
  • 6576c1cdgc1: release the people-view scan lists once the view is builtmre
  • 94f8a373gc1: back out the kept episode-id set (no measurable gain on /my/unwatched: 4.69 -> 4.61 GB per 150 loads)mre
  • a1a88bd4gc1: search skips the stale-key string while no entry is stale; /my/unwatched asks a kept id set instead of building a key string per episode rowmre
  • cd830744gc1: dbSearch: no split / map / list copy per candidate (scores from the stored text, top list touched only when the hit can enter)mre
  • 451db7cdgc1: show page and check clicks read the kept watched set instead of building one from a by-value copy of every watchmre
  • ddb4127egc1: TRACKER_QSTATS=1 logs queue and cache sizes every 10 s (measurement only)mre