gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6a6d71ea6a6d71eaLog: gitoria membershipmre6a6d71ea/components/person.hl

8.0 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 → its page: /series/, /shows/ or /movies/<slug>).
  3. // The show page's cast and the search's people link here. tracker.worldapi.org#20: the heading is "Person | <name>" (the type word
  4. // in the person colour, styles.hl `type-*`), each row's kind word in its type's colour.
  5. //
  6. // FIRST VISIT of a person we don't have complete yet (people.hl `needsFill`): the page shows what we have plus "Loading
  7. // filmography…" and fills in WITHOUT a reload — the face `personFill` does ONE step per call (1st: TMDB person + credits,
  8. // then 40 titles per call, the last marks the person complete) and the handler calls it until it says `done`; between two
  9. // calls hl:web serves every other request. hl:web gives a page no "mounted" hook, so the first call comes from a tick like
  10. // a probe: the invisible `personProbe` runs an endless short CSS animation
  11. // (styles.hl) and its `animationiteration` starts the fill (once — `busy`). A failed fill shows why; the next visit tries again.
  12. //
  13. // mission 060 (tracker.worldapi.org#27): the person's short id (shortids.hl) under the photo (no photo: under the facts).
  14. //
  15. // HYBRIEL TRAPS: no session here at all (the fill needs no sign-in — one TMDB request per person, ever), so hybriel#121/#122
  16. // can't bite; every list is replaced whole. Helpers are LOCAL statics (an imported mpackdb helper straight in a member's
  17. // initializer came back wrong after a client-side navigation — components/show.hl `followingOf`).
  18. parent './main.hl'
  19. import { appTitle } from '../lib/app.hl'
  20. import { personBySlug, personFillStep, pageOf } from '../lib/people.hl'
  21. import { warmReady, warmText } from '../lib/warm.hl'
  22. import { textArg } from '../lib/util.hl'
  23. // everything the page shows for one slug
  24. // one fill step for the person of this slug; the last answers the whole page again
  25. static fillOf = (&slug) => {
  26. p = personBySlug(&slug)
  27. if (p == null) { return { error = 'no such person' } }
  28. r = personFillStep(&p.id)
  29. if (r.error != null) { return { error = r.error } }
  30. if (r.done != true) { return { done = false pos = r.pos total = r.total } }
  31. out = pageOf(&slug)
  32. out.done = true
  33. out.added = r.added
  34. return out
  35. }
  36. // ---- reactive members -----------------------------------------------------------------------
  37. slug = null
  38. start = pageOf(&slug)
  39. found = start.found
  40. notFound = !start.found
  41. name = start.name
  42. photoUrl = start.photoUrl
  43. hasPhoto = photoUrl != ''
  44. // mission 060 (tracker.worldapi.org#27): the short id under the photo — no photo: under the name and facts
  45. shortId = start.shortId
  46. hasShortId = shortId != ''
  47. shortIdInMeta = hasShortId && !hasPhoto
  48. born = start.born
  49. hasBorn = born != ''
  50. died = start.died
  51. hasDied = died != ''
  52. bio = start.bio
  53. hasBio = bio != ''
  54. bioClass = 'short'
  55. rows = start.rows
  56. hasRows = rows.length > 0
  57. loading = start.loading
  58. loadText = 'Loading filmography…'
  59. busy = false
  60. fillError = ''
  61. hasFillError = fillError != ''
  62. noRows = found && !loading && rows.length == 0 && fillError == ''
  63. __title = found ? name + ' — ' + appTitle : appTitle
  64. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'
  65. // stage is there this page says so instead of showing half a map
  66. warming = !warmReady('all')
  67. warmNote = warming ? warmText() : ''
  68. // Component styles use the shared theme variables.
  69. Style {
  70. personMeta {
  71. display = 'block'
  72. minWidth = '0'
  73. overflowWrap = 'anywhere'
  74. shortIdLabel {
  75. textAlign = 'left'
  76. }
  77. }
  78. personPage {
  79. display = 'block'
  80. }
  81. personHeader {
  82. display = 'flex'
  83. alignItems = 'flex-start'
  84. gap = '.8rem'
  85. marginBottom = '1rem'
  86. @media {
  87. minWidth = '40rem'
  88. gap = '1rem'
  89. }
  90. }
  91. personPhoto {
  92. flex = 'none'
  93. display = 'block'
  94. width = '6rem'
  95. img {
  96. display = 'block'
  97. width = '100%'
  98. height = 'auto'
  99. aspectRatio = '2 / 3'
  100. objectFit = 'cover'
  101. borderRadius = 'var(--radius-large)'
  102. background = 'var(--color-surface)'
  103. }
  104. @media {
  105. minWidth = '40rem'
  106. width = '10rem'
  107. }
  108. }
  109. personFact {
  110. display = 'block'
  111. fontSize = '.95rem'
  112. color = 'var(--color-text-muted)'
  113. }
  114. personBio {
  115. display = 'block'
  116. margin = '0 0 1rem'
  117. fontSize = '.95rem'
  118. whiteSpace = 'pre-line'
  119. cursor = 'pointer'
  120. }
  121. 'person-bio.short' {
  122. display = '-webkit-box'
  123. overflow = 'hidden'
  124. '-webkit-line-clamp' = '4'
  125. '-webkit-box-orient' = 'vertical'
  126. }
  127. personLoading {
  128. display = 'block'
  129. padding = '.6rem 0'
  130. color = 'var(--color-text-muted)'
  131. animation = 'tracker-person-pulse 1.2s ease-in-out infinite alternate'
  132. }
  133. personProbe {
  134. position = 'fixed'
  135. left = '0'
  136. top = '0'
  137. width = '1px'
  138. height = '1px'
  139. opacity = '0'
  140. pointerEvents = 'none'
  141. animation = 'tracker-person-tick .1s linear infinite'
  142. }
  143. '@keyframes tracker-person-pulse' {
  144. 'from' {
  145. opacity = '1'
  146. }
  147. to {
  148. opacity = '.45'
  149. }
  150. }
  151. filmRows {
  152. display = 'block'
  153. }
  154. aFilmRow {
  155. display = 'flex'
  156. alignItems = 'center'
  157. gap = '.8rem'
  158. padding = '.45rem 0'
  159. color = 'var(--color-text)'
  160. hover {
  161. textDecoration = 'none'
  162. filmTitle {
  163. color = 'var(--color-accent)'
  164. }
  165. }
  166. }
  167. filmRole {
  168. fontSize = '.85rem'
  169. color = 'var(--color-type5)'
  170. overflowWrap = 'anywhere'
  171. empty {
  172. display = 'none'
  173. }
  174. }
  175. filmYear {
  176. empty {
  177. display = 'none'
  178. }
  179. }
  180. }
  181. View {
  182. personPage { "data-loading" = loading
  183. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  184. if (notFound) {
  185. article { class = "main"
  186. h1 { "Not found" }
  187. p { "This person doesn't exist." }
  188. }
  189. }
  190. if (found) {
  191. personHeader {
  192. if (hasPhoto) {
  193. personPhoto {
  194. img { src = photoUrl alt = name }
  195. if (hasShortId) { shortIdLabel { id = "shortid" title = "Short id" shortId } }
  196. }
  197. }
  198. personMeta {
  199. h1 { class = "typed" typeWord { class = "type-word type-person" "Person" } typeSep { "|" } typeName { name } }
  200. if (hasBorn) { personFact { class = "born" born } }
  201. if (hasDied) { personFact { class = "died" died } }
  202. if (shortIdInMeta) { shortIdLabel { id = "shortid" title = "Short id" shortId } }
  203. }
  204. }
  205. // a SHORT bio: four lines (styles.hl), a click shows all of it
  206. if (hasBio) { personBio { class = bioClass title = "Show all" bio on click(e) { emit toggleBio(e) } } }
  207. h2 { class = "film-heading" "Filmography" }
  208. if (loading) {
  209. personLoading { id = "personloading" loadText
  210. personProbe { "aria-hidden" = "true" on animationiteration(e) { emit fillTick(e) } }
  211. }
  212. }
  213. if (hasFillError) { p { id = "fillerror" class = "message" fillError } }
  214. if (noRows) { p { id = "nofilms" class = "muted" "No shows or movies known." } }
  215. if (hasRows) {
  216. filmRows {
  217. for (row of rows) {
  218. a { Style.aFilmRow href = row.href
  219. img { class = "film-poster" src = row.posterUrl alt = "" loading = "lazy" }
  220. filmText {
  221. filmTitle { row.title }
  222. filmMeta {
  223. filmYear { row.year }
  224. filmType { class = row.typeClass row.typeLabel }
  225. }
  226. filmRole { row.role }
  227. }
  228. }
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. // the probe's tick: the fill, step by step, until done (once per page — `busy`); a lost answer (null) just waits for the
  236. // next tick and goes on where the server is
  237. on fillTick(e) {
  238. if (busy || !loading) { return null }
  239. busy = true
  240. s = slug
  241. let r = emit server personFill(s)
  242. while (r != null && r.error == null && r.done != true && slug == s) {
  243. loadText = 'Loading filmography… ' + r.pos + ' of ' + r.total + ' titles'
  244. r = emit server personFill(s)
  245. }
  246. busy = false
  247. if (r == null || slug != s) { return null }
  248. if (r.error != null) {
  249. loading = false
  250. fillError = 'Could not load the filmography: ' + r.error
  251. return null
  252. }
  253. photoUrl = r.photoUrl
  254. born = r.born
  255. died = r.died
  256. bio = r.bio
  257. rows = r.rows
  258. loading = false
  259. }
  260. on toggleBio(e) {
  261. bioClass = bioClass == 'short' ? 'full' : 'short'
  262. }
  263. // ---- the face (a unique name: hl:web dispatches faces by name across all files) ----
  264. on server personFill(slug) {
  265. return fillOf(textArg(&slug))
  266. }

Branches

Latest commits

  • 6a6d71eaLog: gitoria membershipmre
  • 8b842dc8Log + CONDUCTOR: gitoria PR switch-onmre
  • 6bb7c20estatus: window 2026-11-09mre
  • 5db84974Log: Apollo window GO, AP56b started, BS1 copy removedmre
  • e84586a7Mission AP56bmre
  • 15917f03Record PR workflow rule (gitoria#50)mre
  • 942ac995status: paused workers statemre
  • 44b934e5log: respawn cleanupmre
  • 03a80097Log: Anton GC A/Bmre
  • c7cdef62Log: Apollo STOP, workers pausedmre
  • d0c083fbLog: usage stopmre
  • c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmre
  • 1eb6f1a1Missions AP56, BS1mre
  • 4871f8adLog: AP52 live on day52, browser gate greenmre
  • d9bf2988Merge ap52: day52, tracker#58 server argument, #51 modal close rule, #56 keyed season rowsmre
  • c4a60ef2Log: RT52 retest passed, AP52 startedmre
  • 83760a55Browser gate: search results belong to the address form of the typed text (tracker#52 navigate replace)mre
  • 6e951d91AP52: show-page rows are keyed records; closing a season is one upsert and removes (tracker#56, hybriel#331)mre
  • 3bb4ccddAP52: modal close button refers to its nested rule with Style.buttonModalX (tracker#51, hybriel#333)mre
  • ba16933fAP52: login callback and title route are static handlers taking the server as third argument (tracker#58, hybriel#332)mre