gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitd8b12d67d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmred8b12d67/components/person.hl

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

Branches

Latest commits

  • d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmre
  • 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