gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitf14db671f14db671tracker#22-#25 (mission 058): episode air dates, season check = all episodes watched, movie watched check (+ /my/movies count), /genres/<genre> pages (movies + series, newest first, paginated); gate 238, tests/realdata-058.mjs, README + STATUSmref14db671/components/person.hl

5.3 KB

  1. // components/person.hl — `/person/<slug>` (tracker.worldapi.org#16): a person's page — name, photo, born/died, bio, then
  2. // the filmography (poster, title, year, role; series and movies, newest first, each → /shows/<slug>). The show page's cast
  3. // and the search's people link here.
  4. //
  5. // FIRST VISIT of a person we don't have complete yet (people.hl `needsFill`): the page shows what we have plus "Loading
  6. // filmography…" and fills in WITHOUT a reload — the face `personFill` does ONE step per call (1st: TMDB person + credits,
  7. // then 40 titles per call, the last marks the person complete) and the handler calls it until it says `done`; between two
  8. // calls hl:web serves every other request. hl:web gives a page no "mounted" hook, so the first call comes from a tick like
  9. // the shell's offline probe (components/main.hl): the invisible `personProbe` runs an endless short CSS animation
  10. // (styles.hl) and its `animationiteration` starts the fill (once — `busy`). A failed fill shows why; the next visit tries again.
  11. //
  12. // HYBRIEL TRAPS: no session here at all (the fill needs no sign-in — one TMDB request per person, ever), so hybriel#121/#122
  13. // can't bite; every list is replaced whole. Helpers are LOCAL statics (an imported mpackdb helper straight in a member's
  14. // initializer came back wrong after a client-side navigation — components/show.hl `followingOf`).
  15. parent './main.hl'
  16. import { appTitle } from '../project.hl'
  17. import { personBySlug, personInfoOf, filmographyOf, needsFill, personFillStep } from '../people.hl'
  18. // everything the page shows for one slug
  19. static pageOf = (slug) => {
  20. let p = personBySlug(slug)
  21. if (p == null) { return { found = false name = '' photoUrl = '' born = '' died = '' bio = '' rows = [] loading = false } }
  22. let info = personInfoOf(p)
  23. return { found = true name = info.name photoUrl = info.photoUrl born = info.born died = info.died bio = info.bio
  24. rows = filmographyOf(p) loading = needsFill(p) }
  25. }
  26. // one fill step for the person of this slug; the last answers the whole page again
  27. static fillOf = (slug) => {
  28. let p = personBySlug(slug)
  29. if (p == null) { return { error = 'no such person' } }
  30. let r = personFillStep(p.id)
  31. if (r.error != null) { return { error = r.error } }
  32. if (r.done != true) { return { done = false pos = r.pos total = r.total } }
  33. let out = pageOf(slug)
  34. out.done = true
  35. out.added = r.added
  36. return out
  37. }
  38. // ---- reactive members -----------------------------------------------------------------------
  39. slug = null
  40. start = pageOf(slug)
  41. found = start.found
  42. notFound = !start.found
  43. name = start.name
  44. photoUrl = start.photoUrl
  45. hasPhoto = photoUrl != ''
  46. born = start.born
  47. hasBorn = born != ''
  48. died = start.died
  49. hasDied = died != ''
  50. bio = start.bio
  51. hasBio = bio != ''
  52. bioClass = 'short'
  53. rows = start.rows
  54. hasRows = rows.length > 0
  55. loading = start.loading
  56. loadText = 'Loading filmography…'
  57. busy = false
  58. fillError = ''
  59. hasFillError = fillError != ''
  60. noRows = found && !loading && rows.length == 0 && fillError == ''
  61. __title = found ? name + ' — ' + appTitle : appTitle
  62. View {
  63. personPage { "data-loading" = loading
  64. if (notFound) {
  65. article { class = "main"
  66. h1 { "Not found" }
  67. p { "This person doesn't exist." }
  68. }
  69. }
  70. if (found) {
  71. personHeader {
  72. if (hasPhoto) { personPhoto { img { src = photoUrl alt = name } } }
  73. personMeta {
  74. h1 { name }
  75. if (hasBorn) { personFact { class = "born" born } }
  76. if (hasDied) { personFact { class = "died" died } }
  77. }
  78. }
  79. // a SHORT bio: four lines (styles.hl), a click shows all of it
  80. if (hasBio) { personBio { class = bioClass title = "Show all" bio on click(e) { emit toggleBio(e) } } }
  81. h2 { class = "film-heading" "Filmography" }
  82. if (loading) {
  83. personLoading { id = "personloading" loadText
  84. personProbe { "aria-hidden" = "true" on animationiteration(e) { emit fillTick(e) } }
  85. }
  86. }
  87. if (hasFillError) { p { id = "fillerror" class = "message" fillError } }
  88. if (noRows) { p { id = "nofilms" class = "muted" "No shows or movies known." } }
  89. if (hasRows) {
  90. filmRows {
  91. for (row of rows) {
  92. a { class = "film-row" href = row.href
  93. img { class = "film-poster" src = row.posterUrl alt = "" loading = "lazy" }
  94. filmText {
  95. filmTitle { row.title }
  96. filmMeta {
  97. filmYear { row.year }
  98. filmType { row.typeLabel }
  99. }
  100. filmRole { row.role }
  101. }
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. // the probe's tick: the fill, step by step, until done (once per page — `busy`); a lost answer (null) just waits for the
  110. // next tick and goes on where the server is
  111. on fillTick(e) {
  112. if (busy || !loading) { return null }
  113. busy = true
  114. let s = slug
  115. let r = emit server personFill(s)
  116. while (r != null && r.error == null && r.done != true && slug == s) {
  117. loadText = 'Loading filmography… ' + r.pos + ' of ' + r.total + ' titles'
  118. r = emit server personFill(s)
  119. }
  120. busy = false
  121. if (r == null || slug != s) { return null }
  122. if (r.error != null) {
  123. loading = false
  124. fillError = 'Could not load the filmography: ' + r.error
  125. return null
  126. }
  127. photoUrl = r.photoUrl
  128. born = r.born
  129. died = r.died
  130. bio = r.bio
  131. rows = r.rows
  132. loading = false
  133. }
  134. on toggleBio(e) {
  135. bioClass = bioClass == 'short' ? 'full' : 'short'
  136. }
  137. // ---- the face (a unique name: hl:web dispatches faces by name across all files) ----
  138. on server personFill(slug) {
  139. return fillOf(slug != null ? '' + slug : '')
  140. }

Branches

Latest commits

  • f14db671tracker#22-#25 (mission 058): episode air dates, season check = all episodes watched, movie watched check (+ /my/movies count), /genres/<genre> pages (movies + series, newest first, paginated); gate 238, tests/realdata-058.mjs, README + STATUSmre
  • 1704ec45tracker#17 (mission 057): season caret down/up, skeleton rows while a season loads, sessionless showSeasonEpisodes face (no page re-mount), client-only close; gate 214, tests/realdata-057.mjs, README + STATUSmre
  • f2fe3e36mission 056: README + STATUS (merge, fixes, Hybriel 8590df63, real-data check), tests/realdata-056.mjs, tools/check-public-slugs.hlmre
  • f40c250emission 056: re-vendor hybriel master 8590df63 (#121, #122); an adult title's page is Not found for non-followers; gate: leave the page before stopping the servermre
  • 2b7fdd6cmission 056: signed-out header one row on phones ("Log in", nowrap), backfill skips adult titles' posters, gate checksmre
  • 2c53d5efMerge branch 't16-person' (tracker#16 person pages) into main; filmography shows only public titles (054 adult flag), gate race fix (backfill start line)mre
  • c171227emission 054: hide adult/unknown titles from the public lists and the search; in-app adult-flag backfill (TMDB details + poster per title, resumes), gate + real-data proofmre
  • 139fafd8tracker#16: short bio (4 lines, click = all), real-data check script, README + STATUSmre
  • 93be9476tracker#16: person pages /person/<slug> with the filmography fetched from TMDB on the first visit (step by step), gatemre
  • 47a3cae6STATUS: mission 053 merge commit idsmre
  • dcc5eecaMerge branch 't14-search'mre
  • 03edc783Merge branch 't15-tvmaze'mre
  • 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
  • 6bb2daf1tracker#13: homepage (tiles, intro, latest movies/shows), /shows, /movies/page/N, /my/movies; lists cached in memorymre
  • b8bd1157tracker#14: README + STATUS (search, real-data numbers, gate, merge notes)mre
  • 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
  • 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre
  • cbdc4ea7tracker#12: link icons TMDB/IMDb/TVDB/TVmaze; sync fills missing ids (TVmaze lookup); movies fetched via /movie/mre
  • b105bcd8tracker#11: Hybriel master ff51cf46 (checks no longer vanish), mobile-first styles, carets, follow button, sign-in modal, inverted check, orange castmre
  • 31b758aatracker#10: installable app (manifest, service worker, offline shell), own icon + faviconmre