gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7ef3cb3b7ef3cb3bMerge branch 'records-st55' into mainTracker7ef3cb3b/components/show.hl

33.1 KB

  1. // components/show.hl — a title's own page (tracker.worldapi.org#4): since tracker#21 (mission 068) `/series/:slug`, `/movies/:slug`
  2. // and `/shows/:slug` (the last through project.hl showsRoute: a show is rendered there, a series or movie answers 301 to its
  3. // own address). tracker#20: the heading is "<Type> | <title>" — Series / Show / Movie in the type's colour (styles.hl
  4. // `type-*`), the title white. Creator's words:
  5. // "the poster on the left, right of it the title of the show, the genre pills, below the plot summary,
  6. // below that the artists just as normal links, separated with comma color red, genres are blue" (the
  7. // header) — "then all seasons in reverse order, latest on top, below them collapsable their episodes,
  8. // episodes first the round check icon, if the episode was watched by the user looking its solid, if
  9. // not its regular, then the episode number, then the title. the last season is not collapsed. click on
  10. // the check adds a watch. the season also has a check, if the season is checked or unchecked all its
  11. // episodes get checked or unchecked. artists link to /person/<artist-slug> the genre to /genre/<genre-slug>."
  12. //
  13. // THE ROWS ARE ONE FLAT LIST, not a nested for-loop over seasons > episodes: the vendored build may
  14. // still lack the fix for hybriel#86 (a nested for over a reassigned outer list keeps stale inner
  15. // cells) — a single-level `for (row of rows)` with a `kind` field, reassigned whole on every click,
  16. // is the same proven-safe shape components/main.hl's own header and ident's inbox.hl already use.
  17. // The rows are keyed records (hybriel#331, tracker#56): `id` is the key, `@id` marks the lookup. Closing a season is ONE upsert of its
  18. // row and a `remove(id = …)` per episode row (lib/shows.hl closeSeasonRows); opening, filling and the watch toggles write the whole
  19. // list in its new order (the framework keeps the nodes of the rows that stay).
  20. // `rows` is rebuilt from scratch (seasons/episodes refetched by id, watch rows refetched) on every
  21. // toggle — cheap: a show has at most a few dozen episodes per season.
  22. //
  23. // Mission 047 (the creator, 2026-10-01): a caret at the season header's right edge (down = open, right = collapsed); episode
  24. // rows not indented; on a phone the title first, then the poster at full width, then genres/plot/cast; a Follow toggle
  25. // next to the title (tracker#34, mission 030: under the poster, as wide as the poster; next to the title the status pill, #35). SIGNED OUT the checks and Follow are visible too: a click opens the "sign in" modal (modal.hl, copied
  26. // from components.hybriel) and writes nothing.
  27. //
  28. // tracker.worldapi.org#17 (mission 057): the caret points DOWN while a season is closed and UP while it is open. Opening a
  29. // season shows SKELETON rows at once (min(episodes, 8), a CSS shimmer, styles.hl) and then its episodes from the face
  30. // `showSeasonEpisodes`, which takes NO session: a face with `session` makes hl:web re-mount the whole page on the server and
  31. // ship every session-derived member back as a `sync` (WebFramework.hl `inbound`) — that, not the episodes, was most of the
  32. // old 250–450 ms (real data). The watched state comes from `watchedEpisodes` (this show's watched episodes per season, rendered
  33. // with the page and re-synced after every watch face). Closing is client-only (no request). An ADULT show (only its
  34. // followers see it) keeps the session face `showRows`: the public face refuses adult seasons.
  35. //
  36. // tracker.worldapi.org#12: link icons under the title — the show on TMDB, IMDb, TheTVDB, TVmaze (a movie: TMDB + IMDb),
  37. // only for the ids it has (shows.hl externalLinksOf), each in a new tab.
  38. //
  39. // mission 058: #22 every episode row shows its air date (`release`, 'YYYY-MM-DD' like /my/unwatched; none → empty). #23 a
  40. // season's check is DERIVED: solid exactly when every one of its episodes is watched (a season without episodes: its own
  41. // season watch) — unchecking one episode turns the season off with the face's answer, checking it again turns it on; the
  42. // season click watches all when not all are watched, else unwatches all. #24 a MOVIE's page has its own watched check
  43. // (watch `targetType = 'movie'`, target = the title's id; face `showToggleMovie`), signed out → the sign-in modal.
  44. //
  45. // tracker.worldapi.org#26: an INCOMPLETE title (one a person page added from a filmography — details.hl `needsDetails`) shows
  46. // what it has plus skeletons (poster, cast line, season rows for a series) and completes itself WITHOUT a reload: the
  47. // invisible `showProbe` (endless short CSS animation — hl:web has no mount hook, the person page's trick) calls the face
  48. // `showComplete` until it is done — one step per call (details.hl completeStep: TMDB details + ids + cast; a series' seasons/
  49. // episodes in parts; poster, TVmaze) — and the last answer's parts replace the skeletons. No session (no page re-mount); adult
  50. // refused.
  51. //
  52. // tracker.worldapi.org#28: the WHOLE cast and the key crew (details.hl stores them: a series' cast of every season, main cast
  53. // first by episode count, then "Guest stars"; crew = Created by / Directed by / Written by / Screenplay / Story / Music). The
  54. // cast shows its first `castShown` (20) and a "Show all (N)" toggle, each crew job its first `crewShown` (6) and one "Show all
  55. // crew (N)" toggle — CLIENT-SIDE (the rows are all rendered, CSS hides the rest; `castClass`/`crewClass`, no request). Names
  56. // link to /person/<slug>; the character in brackets after the name (CSS `attr(data-role)` — one element per name: the SSR's
  57. // line breaks inside a wrapper element put a space before the comma).
  58. parent './main.hl'
  59. import Modal from './modal.hl'
  60. import FranchiseWidget from './franchisewidget.hl'
  61. import { appTitle } from '../lib/app.hl'
  62. import { userIdOfSession, loginHref } from '../lib/users.hl'
  63. import { showBySlug, showById, seasonsOfShow, posterName, externalLinksOf, summaryOf, initialCollapsed, genreRowsOf, castShown, castRowsOf, castCountOf, crewRowsOf, crewHiddenOf, crewCountOf, buildRows, openingRows, closeSeasonRows, filledRows, franchiseWidgetsOf, pageShowOf, rowsOfSlug, watchedEpisodesOfSlug, slugInfoOf, castOfSlug, crewOfSlug, showRowsOf, showSeasonEpisodesOf, showToggleEpisodeOf, showToggleSeasonOf, showToggleMovieOf, showToggleFollowOf } from '../lib/shows.hl'
  64. import { needsDetails, completeStep, completeLine, persistDetails } from '../lib/details.hl'
  65. import { textArg } from '../lib/util.hl'
  66. import { warmReady, warmText } from '../lib/warm.hl'
  67. // tracker#26: the page loads this title's full details on open
  68. // the face's work: ONE step of completing the title (details.hl completeStep — a series takes a few; a second viewer drives the
  69. // same job or finds it complete); when done, every part of the page that changes — the rows without anyone's watch state (a
  70. // title that was incomplete had no episodes to watch)
  71. static completedPageOf = (&slug) => {
  72. let show = showBySlug(&slug)
  73. if (show == null || show.adult == true) { return { error = 'no such show' } }
  74. if (needsDetails(&show)) {
  75. r = completeStep(&show.id)
  76. if (r.retry || r.adult == true) { return { error = r.error != '' ? r.error : 'no such show' } }
  77. if (!r.done) { return { done = false steps = r.sum.steps } }
  78. if (!r.skipped) {
  79. persistDetails()
  80. console.log('details on open: ' + completeLine(&show.title, &r.sum))
  81. }
  82. show = showById(&show.id)
  83. }
  84. cl = initialCollapsed(seasonsOfShow(&show))
  85. pn = posterName(&show)
  86. crew = crewRowsOf(&show)
  87. cast = castRowsOf(show)
  88. return { done = true title = show.title summary = summaryOf(&show) poster = pn genreRows = genreRowsOf(&show) castRows = cast
  89. castCount = castCountOf(&cast) castMore = castCountOf(&cast) > castShown crewRows = crew crewCount = crewCountOf(&crew) crewMore = crewHiddenOf(&crew) > 0
  90. linkRows = externalLinksOf(&show) collapsed = cl rows = buildRows(&show, null, cl) }
  91. }
  92. // ---- reactive members -----------------------------------------------------------------------
  93. slug = null
  94. session = null
  95. userId = userIdOfSession(&session)
  96. signedIn = userId != null
  97. // SESSION SYNC (mission 047; since hybriel #121/#122, mission 056): a face taking `session` answers with a `sync` of every
  98. // member derived from session that reaches an import (here `showRow`, `found`, `following`, `rows`, …), re-derived on the
  99. // server with the page's route params but the MOUNT's other state — so client state (`collapsed`) must never derive from
  100. // them. `me` stays the plain copy mission 047 introduced.
  101. me = userId
  102. showRow = pageShowOf(&slug, &me)
  103. found = showRow != null
  104. notFound = showRow == null
  105. // the Follow toggle: "Follow" = the inverted button (accent text on a surface, no border since tracker#32), "Following" = the
  106. // filled one (the theme's `primary`)
  107. following = found ? showRow.following : false
  108. followClass = following ? 'follow primary' : 'follow inverted'
  109. followText = following ? 'Following' : 'Follow'
  110. signInHref = loginHref
  111. // #24: a movie's watched check (same icon/classes as the episodes); the classes written out, not `watchClassOf` (an import of
  112. // the mpackdb-backed watches.hl cannot run in the browser when the member is re-derived there)
  113. isMovie = found && showRow.type == 'movie'
  114. movieWatched = isMovie ? showRow.movieWatched : false
  115. movieWatchClass = movieWatched ? 'checkicon solid' : 'checkicon regular'
  116. movieWatchText = movieWatched ? 'Watched' : 'Not watched'
  117. signInText = isMovie ? 'You need to sign in to follow movies and mark them watched.' : 'You need to sign in to follow shows and mark episodes.'
  118. title = found ? showRow.title : ''
  119. // tracker#35: the status pill next to a series' title — TVmaze's status, else TMDB's (shows.hl statusOf); none on a movie
  120. statusText = found ? showRow.statusText : ''
  121. hasStatus = statusText != ''
  122. // tracker#33: a movie's release date + runtime (movieFactsOf)
  123. factsText = found ? showRow.facts : ''
  124. hasFacts = factsText != ''
  125. statusClass = found ? 'pill ' + (showRow.statusTone == 'running' ? 'success' : (showRow.statusTone == 'pending' ? 'warning' : ((showRow.statusTone == 'canceled' || showRow.statusTone == 'ended') ? 'danger' : 'quiet'))) : 'pill quiet'
  126. // tracker#20: "Series | Reacher" — the kind from the slug (pure strings here: they are re-derived in the browser too)
  127. slugInfo = slugInfoOf(&slug)
  128. pageKind = slugInfo.kind
  129. typeText = pageKind == 'movie' ? 'Movie' : (pageKind == 'show' ? 'Show' : 'Series')
  130. typeClass = 'type-word type-' + pageKind
  131. // tracker#18: the creator's own text, else TMDB's, else TVmaze's (pageShowOf → shows.hl summaryOf)
  132. summary = found && showRow.summary != null ? showRow.summary : ''
  133. poster = found ? showRow.poster : null
  134. hasPoster = poster != null
  135. posterUrl = hasPoster ? '/posters/' + poster : ''
  136. // mission 060 (tracker.worldapi.org#27): the short id under the poster (none yet while the backfill has not reached it)
  137. shortId = found ? showRow.shortId : ''
  138. hasShortId = shortId != ''
  139. genreRows = found ? showRow.genreRows : []
  140. hasGenres = genreRows.length > 0
  141. // mission 062: cast + crew from the SLUG (`castOfSlug`, `crewOfSlug`), never from `showRow` — a member derived from the session is
  142. // re-derived and re-SENT after every watch/follow click (SESSION SYNC above): The Simpsons' 300 names took 0.7 s per click
  143. castRows = castOfSlug(&slug)
  144. hasCast = castRows.length > 0
  145. // tracker#28: "Show all (N)" — the toggles' state is CLIENT state: literals, never derived from `showRow` (session sync)
  146. castCount = castCountOf(&castRows)
  147. castMore = castCount > castShown
  148. castAllText = 'Show all (' + castCount + ')'
  149. castClass = 'collapsed'
  150. crewRows = crewOfSlug(&slug)
  151. hasCrew = crewRows.length > 0
  152. crewCount = crewCountOf(&crewRows)
  153. crewMore = crewHiddenOf(&crewRows) > 0
  154. crewAllText = 'Show all crew (' + crewCount + ')'
  155. crewClass = 'collapsed'
  156. linkRows = found ? showRow.linkRows : []
  157. franchiseWidgets = found ? franchiseWidgetsOf(&showRow) : []
  158. hasLinks = linkRows.length > 0
  159. // NOT from `showRow`/`found`: they read the session (via `me`), so a member derived from them is re-derived on the server
  160. // after every session face with the MOUNT's state — `collapsed` (client state) would snap back to the initial seasons (mission
  161. // 056: the 2nd episode click in a re-opened season did nothing). The season ids of a hidden page are no secret.
  162. collapsed = slugInfo.collapsed
  163. // mission 062: has this page opened/closed a season (client state) — then a watch face sends its own rows (toggleEpisode)
  164. collapsedChanged = false
  165. rows = found ? rowsOfSlug(&slug, &me, &collapsed) : []
  166. hasRows = rows.length > 0
  167. watchedEpisodes = found ? watchedEpisodesOfSlug(&slug, &me) : {}
  168. // an adult page (followers only) opens its seasons through the session face `showRows`
  169. adultShow = found && showRow.adult == true
  170. // tracker#26: incomplete → skeletons + the probe until `showComplete` answered
  171. completing = found ? showRow.completing : false
  172. // tracker#33: a title TMDB has no poster for (The Remaining) shows the placeholder in the poster's place — the column was empty
  173. // but for the short id, the page looked unfinished; while an incomplete title loads, the skeleton instead
  174. posterLoading = completing && !hasPoster
  175. noPoster = !hasPoster && !completing
  176. completeBusy = false
  177. isSeries = found && showRow.type != 'movie'
  178. skeletonSeasons = ['1', '2', '3']
  179. __title = found ? title + ' — ' + appTitle : appTitle
  180. // tracker#41 (mission 037b): the title's own address (og:url in the served head) — under a moved slug (a merged duplicate's, a
  181. // former one: lib/shows.hl showBySlug finds the keeper) this page IS the keeper's, and the head names the keeper's address; hl:web
  182. // has no page-level <link rel="canonical">. From the slug alone (slugInfo), not from the session.
  183. canonicalPath = slugInfo.canonical
  184. __meta = canonicalPath != '' ? [{ property = 'og:url' content = canonicalPath }] : []
  185. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'titles'
  186. // stage is there this page says so instead of showing half a map
  187. warming = !warmReady('titles')
  188. warmNote = warming ? warmText() : ''
  189. // Component styles use the shared theme variables.
  190. Style {
  191. showPage {
  192. display = 'block'
  193. }
  194. showHeader {
  195. display = 'flex'
  196. flexDirection = 'column'
  197. gap = '.6rem'
  198. marginBottom = '1.2rem'
  199. @media {
  200. minWidth = '40rem'
  201. flexDirection = 'row'
  202. alignItems = 'flex-start'
  203. gap = '1rem'
  204. marginBottom = '1.5rem'
  205. }
  206. }
  207. showPoster {
  208. display = 'block'
  209. width = '100%'
  210. img {
  211. display = 'block'
  212. width = '100%'
  213. height = 'auto'
  214. borderRadius = 'var(--radius-large)'
  215. aspectRatio = '2 / 3'
  216. objectFit = 'cover'
  217. background = 'var(--color-surface)'
  218. }
  219. @media {
  220. minWidth = '40rem'
  221. flex = 'none'
  222. width = '10rem'
  223. }
  224. }
  225. showMeta {
  226. display = 'contents'
  227. overflowWrap = 'anywhere'
  228. @media {
  229. minWidth = '40rem'
  230. display = 'block'
  231. flex = '1'
  232. 'min-width' = '0'
  233. }
  234. }
  235. showTitle {
  236. order = '-1'
  237. display = 'flex'
  238. flexWrap = 'wrap'
  239. alignItems = 'center'
  240. gap = '.4rem .6rem'
  241. h1 {
  242. flex = '0 1 auto'
  243. minWidth = '0'
  244. margin = '0'
  245. }
  246. '.pill' {
  247. flex = 'none'
  248. }
  249. @media {
  250. minWidth = '40rem'
  251. marginBottom = '1rem'
  252. }
  253. }
  254. 'button.follow' {
  255. display = 'block'
  256. width = '100%'
  257. marginTop = '.5rem'
  258. padding = '.4rem .8rem'
  259. fontSize = '.95rem'
  260. }
  261. showFacts {
  262. flexBasis = '100%'
  263. fontSize = '.95rem'
  264. color = 'var(--color-text-muted)'
  265. }
  266. showLinks {
  267. order = '-1'
  268. display = 'flex'
  269. flexWrap = 'wrap'
  270. gap = '.4rem'
  271. }
  272. movieWatch {
  273. order = '-1'
  274. display = 'flex'
  275. alignItems = 'center'
  276. gap = '.4rem'
  277. @media {
  278. minWidth = '40rem'
  279. margin = '-.4rem 0 .8rem'
  280. }
  281. }
  282. movieWatchLabel {
  283. fontSize = '.95rem'
  284. color = 'var(--color-text)'
  285. }
  286. showGenres {
  287. display = 'flex'
  288. flexWrap = 'wrap'
  289. gap = '.4rem'
  290. margin = '.5rem 0'
  291. }
  292. showSummary {
  293. display = 'block'
  294. margin = '.5rem 0'
  295. fontSize = '.95rem'
  296. color = 'var(--color-text)'
  297. @media {
  298. minWidth = '40rem'
  299. fontSize = '1rem'
  300. }
  301. }
  302. showCrew {
  303. display = 'block'
  304. margin = '.5rem 0'
  305. crewLabel {
  306. firstChild {
  307. marginTop = '0'
  308. }
  309. }
  310. }
  311. showCast {
  312. display = 'block'
  313. margin = '.5rem 0'
  314. }
  315. castHeading {
  316. display = 'block'
  317. fontSize = '.75rem'
  318. letterSpacing = '.04em'
  319. textTransform = 'uppercase'
  320. color = 'var(--color-text-muted)'
  321. }
  322. crewLabel {
  323. display = 'block'
  324. marginTop = '.35rem'
  325. fontSize = '.75rem'
  326. letterSpacing = '.04em'
  327. textTransform = 'uppercase'
  328. color = 'var(--color-text-muted)'
  329. }
  330. castLabel {
  331. display = 'block'
  332. margin = '.4rem 0 .1rem'
  333. fontSize = '.75rem'
  334. letterSpacing = '.04em'
  335. textTransform = 'uppercase'
  336. color = 'var(--color-text-muted)'
  337. }
  338. '.artist-link' {
  339. color = 'var(--color-type5)'
  340. }
  341. '.crew-link' {
  342. color = 'var(--color-type5)'
  343. }
  344. 'a.artist-link::after' {
  345. content = "attr(data-role) ', '"
  346. color = 'var(--color-text-muted)'
  347. }
  348. 'a.crew-link::after' {
  349. content = "', '"
  350. color = 'var(--color-text-muted)'
  351. }
  352. 'a.artist-link.end::after' {
  353. content = 'attr(data-role)'
  354. }
  355. 'show-cast.collapsed' {
  356. 'a.artist-link.cut::after' {
  357. content = 'attr(data-role)'
  358. }
  359. '.more' {
  360. display = 'none'
  361. }
  362. whenAll {
  363. display = 'none'
  364. }
  365. }
  366. 'a.crew-link.end::after' {
  367. content = 'none'
  368. }
  369. 'show-crew.collapsed' {
  370. 'a.crew-link.cut::after' {
  371. content = 'none'
  372. }
  373. '.more' {
  374. display = 'none'
  375. }
  376. whenAll {
  377. display = 'none'
  378. }
  379. }
  380. buttonShowall {
  381. display = 'block'
  382. margin = '.3rem 0 0'
  383. padding = '.15rem 0'
  384. fontSize = '.85rem'
  385. color = 'var(--color-accent)'
  386. background = 'transparent'
  387. hover {
  388. background = 'transparent'
  389. textDecoration = 'underline'
  390. }
  391. }
  392. 'show-cast.all' {
  393. whenCollapsed {
  394. display = 'none'
  395. }
  396. }
  397. 'show-crew.all' {
  398. whenCollapsed {
  399. display = 'none'
  400. }
  401. }
  402. showSeasons {
  403. display = 'block'
  404. }
  405. seasonRow {
  406. display = 'flex'
  407. alignItems = 'center'
  408. gap = '.6rem'
  409. padding = '.5rem 0'
  410. borderTop = '1px solid ' + 'var(--color-border)' // functional: the season foldable's line
  411. 'button.checkicon' {
  412. margin = '-.3125rem 0'
  413. }
  414. }
  415. buttonSeasonToggle {
  416. flex = '1'
  417. minWidth = '0'
  418. display = 'flex'
  419. alignItems = 'center'
  420. gap = '.6rem'
  421. justifyContent = 'flex-start'
  422. padding = '0'
  423. color = 'var(--color-text)'
  424. background = 'transparent'
  425. border = '0'
  426. fontWeight = '600'
  427. cursor = 'pointer'
  428. textAlign = 'left'
  429. margin = '-.3125rem 0'
  430. }
  431. seasonCount {
  432. fontWeight = '400'
  433. fontSize = '.85rem'
  434. color = 'var(--color-text-muted)'
  435. }
  436. seasonCaret {
  437. flex = 'none'
  438. alignSelf = 'center'
  439. display = 'grid'
  440. marginLeft = 'auto'
  441. color = 'var(--color-text-muted)'
  442. transition = 'transform .15s'
  443. svg {
  444. display = 'block'
  445. fill = 'none'
  446. stroke = 'currentColor'
  447. strokeWidth = '2'
  448. strokeLinecap = 'round'
  449. strokeLinejoin = 'round'
  450. }
  451. }
  452. 'season-row.expanded' {
  453. seasonCaret {
  454. transform = 'rotate(180deg)'
  455. }
  456. }
  457. episodeRow {
  458. display = 'flex'
  459. alignItems = 'center'
  460. gap = '.6rem'
  461. minHeight = '2.125rem'
  462. padding = '0'
  463. 'button.checkicon' {
  464. margin = '-.3125rem 0'
  465. }
  466. }
  467. episodeNumber {
  468. flex = 'none'
  469. width = '1.6rem'
  470. color = 'var(--color-text-muted)'
  471. fontVariantNumeric = 'tabular-nums'
  472. }
  473. episodeTitle {
  474. flex = '1'
  475. minWidth = '0'
  476. overflowWrap = 'anywhere'
  477. }
  478. episodeDate {
  479. flex = 'none'
  480. fontSize = '.85rem'
  481. color = 'var(--color-text-muted)'
  482. fontVariantNumeric = 'tabular-nums'
  483. }
  484. skeletonRow {
  485. display = 'flex'
  486. alignItems = 'center'
  487. gap = '.6rem'
  488. minHeight = '2.125rem'
  489. padding = '0'
  490. }
  491. skeletonCheck {
  492. display = 'block'
  493. borderRadius = 'var(--radius-small)'
  494. background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'
  495. backgroundSize = '400% 100%'
  496. animation = 'tracker-shimmer 1.4s linear infinite'
  497. flex = 'none'
  498. width = '1.375rem'
  499. height = '1.375rem'
  500. borderRadius = '50%'
  501. margin = '0 .6875rem'
  502. }
  503. skeletonNumber {
  504. display = 'block'
  505. borderRadius = 'var(--radius-small)'
  506. background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'
  507. backgroundSize = '400% 100%'
  508. animation = 'tracker-shimmer 1.4s linear infinite'
  509. flex = 'none'
  510. width = '1.6rem'
  511. height = '1rem'
  512. }
  513. skeletonTitle {
  514. display = 'block'
  515. borderRadius = 'var(--radius-small)'
  516. background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'
  517. backgroundSize = '400% 100%'
  518. animation = 'tracker-shimmer 1.4s linear infinite'
  519. flex = '1'
  520. maxWidth = '60%'
  521. height = '1rem'
  522. }
  523. 'skeleton-row:nth-of-type(even)' {
  524. skeletonTitle {
  525. maxWidth = '42%'
  526. }
  527. }
  528. skeletonPoster {
  529. display = 'block'
  530. borderRadius = 'var(--radius-large)'
  531. background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'
  532. backgroundSize = '400% 100%'
  533. animation = 'tracker-shimmer 1.4s linear infinite'
  534. width = '100%'
  535. aspectRatio = '2 / 3'
  536. }
  537. skeletonCast {
  538. display = 'block'
  539. borderRadius = 'var(--radius-large)'
  540. background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'
  541. backgroundSize = '400% 100%'
  542. animation = 'tracker-shimmer 1.4s linear infinite'
  543. width = '70%'
  544. height = '1rem'
  545. margin = '.5rem 0'
  546. }
  547. showLoading {
  548. display = 'block'
  549. marginTop = '1rem'
  550. }
  551. showProbe {
  552. position = 'fixed'
  553. left = '0'
  554. top = '0'
  555. width = '1px'
  556. height = '1px'
  557. opacity = '0'
  558. pointerEvents = 'none'
  559. animation = 'tracker-person-tick .1s linear infinite'
  560. }
  561. '@keyframes tracker-shimmer' {
  562. 'from' {
  563. backgroundPosition = '100% 0'
  564. }
  565. to {
  566. backgroundPosition = '0% 0'
  567. }
  568. }
  569. }
  570. View {
  571. showPage {
  572. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  573. if (notFound) {
  574. article { class = "main"
  575. h1 { "Not found" }
  576. p { "This show doesn't exist." }
  577. }
  578. }
  579. if (found) {
  580. showHeader {
  581. showPoster {
  582. if (hasPoster) { img { src = posterUrl alt = title } }
  583. if (noPoster) { img { class = "no-poster" src = "/posters/none" alt = "no poster" } }
  584. if (posterLoading) { skeletonPoster { "aria-hidden" = "true" } }
  585. // tracker#34: Follow directly under the poster, as wide as the poster (creator: "the follow button should go below
  586. // the picture … and expand to the size o the poster")
  587. button { id = "follow" type = "button" class = followClass followText on click(e) { emit toggleFollow(e) } }
  588. if (hasShortId) { shortIdLabel { id = "shortid" title = "Short id" shortId } }
  589. }
  590. showMeta {
  591. showTitle {
  592. h1 { class = "typed" typeWord { class = typeClass typeText } typeSep { "|" } typeName { title } }
  593. if (hasStatus) { span { class = statusClass statusText } }
  594. if (hasFacts) { showFacts { id = "moviefacts" factsText } }
  595. }
  596. if (isMovie) {
  597. movieWatch {
  598. button { id = "moviewatch" type = "button" class = movieWatchClass "aria-label" = "mark movie watched"
  599. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  600. circle { cx = "12" cy = "12" r = "10" }
  601. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  602. }
  603. on click(e) { emit toggleMovie(e) }
  604. }
  605. movieWatchLabel { movieWatchText }
  606. }
  607. }
  608. if (hasLinks) {
  609. showLinks {
  610. for (l of linkRows) { a { class = "pill quiet extlink" href = l.href target = "_blank" rel = "noopener" title = l.title "aria-label" = l.title "data-site" = l.site l.label } }
  611. }
  612. }
  613. // mission 025: the franchise widget right under the title/poster block — on a phone (showMeta dissolves, see styles.hl)
  614. // after the poster and before the genres, plot and cast; from 40rem in the right column under the title
  615. FranchiseWidget { widgets = franchiseWidgets }
  616. if (hasGenres) {
  617. showGenres {
  618. for (g of genreRows) { a { class = "pill type-4 genre-pill" href = g.href g.name } }
  619. }
  620. }
  621. showSummary { summary }
  622. if (hasCrew) {
  623. showCrew { class = crewClass
  624. for (r of crewRows) {
  625. if (r.isLabel) { crewLabel { r.text } }
  626. if (r.isPerson) { a { class = r.itemClass href = r.href r.name } }
  627. }
  628. if (crewMore) {
  629. button { id = "crewtoggle" type = "button" Style.buttonShowall class = "quiet"
  630. whenCollapsed { crewAllText }
  631. whenAll { "Show less" }
  632. on click(e) { emit toggleCrewAll(e) }
  633. }
  634. }
  635. }
  636. }
  637. if (hasCast) {
  638. showCast { class = castClass
  639. castHeading { "Cast" }
  640. for (c of castRows) {
  641. if (c.isLabel) { castLabel { class = c.itemClass c.text } }
  642. if (c.isPerson) { a { class = c.itemClass href = c.href "data-role" = c.roleText c.name } }
  643. }
  644. if (castMore) {
  645. button { id = "casttoggle" type = "button" Style.buttonShowall class = "quiet"
  646. whenCollapsed { castAllText }
  647. whenAll { "Show less" }
  648. on click(e) { emit toggleCastAll(e) }
  649. }
  650. }
  651. }
  652. }
  653. if (completing) { skeletonCast { "aria-hidden" = "true" } }
  654. }
  655. }
  656. if (completing) {
  657. showLoading { id = "showloading" "aria-busy" = "true"
  658. if (isSeries) {
  659. for (k of skeletonSeasons) {
  660. skeletonRow { "aria-hidden" = "true"
  661. skeletonCheck { }
  662. skeletonTitle { }
  663. }
  664. }
  665. }
  666. showProbe { "aria-hidden" = "true" on animationiteration(e) { emit completeTick(e) } }
  667. }
  668. }
  669. if (hasRows) {
  670. showSeasons {
  671. for (row of rows) {
  672. if (row.isSeason) {
  673. seasonRow { class = row.rowClass
  674. button { type = "button" class = row.watchClass value = row.id "aria-label" = "mark season watched"
  675. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  676. circle { cx = "12" cy = "12" r = "10" }
  677. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  678. }
  679. on click(e) { emit toggleSeason(row.id) }
  680. }
  681. button { type = "button" Style.buttonSeasonToggle value = row.id
  682. seasonLabel { row.label }
  683. seasonCount { row.episodeCountText }
  684. seasonCaret { "aria-hidden" = "true"
  685. svg { viewBox = "0 0 24 24" width = "20" height = "20"
  686. path { d = "M6 9 L12 15 L18 9" }
  687. }
  688. }
  689. on click(e) { emit toggleCollapse(row.id) }
  690. }
  691. }
  692. }
  693. if (row.isEpisode) {
  694. episodeRow {
  695. button { type = "button" class = row.watchClass value = row.id "aria-label" = "mark episode watched"
  696. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  697. circle { cx = "12" cy = "12" r = "10" }
  698. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  699. }
  700. on click(e) { emit toggleEpisode(row.id) }
  701. }
  702. episodeNumber { row.episodeNumber }
  703. episodeTitle { row.title }
  704. episodeDate { row.airDate }
  705. }
  706. }
  707. if (row.isSkeleton) {
  708. skeletonRow { "aria-hidden" = "true"
  709. skeletonCheck { }
  710. skeletonNumber { }
  711. skeletonTitle { }
  712. }
  713. }
  714. }
  715. }
  716. }
  717. Modal { id = "signin" title = "Sign in"
  718. p { signInText }
  719. footer {
  720. button { type = "button" value = "close" "Close" }
  721. a { id = "signin-link" class = "button primary" href = signInHref "Sign in with ident" }
  722. }
  723. }
  724. }
  725. }
  726. }
  727. // Every rebuild of `rows` happens SERVER-SIDE, never by calling `buildRows` from a client handler:
  728. // a member function whose body reaches an hl:mpackdb-backed import (seasonsOfShow, episodesOfSeason,
  729. // watchesOfUser, …) compiles to nothing on the client (no case ever assigns it — a genuine Hybriel
  730. // gap, filed under `issues`) even though the client bundle still calls it, so `this.buildRows(...)`
  731. // throws "not a function" in the browser. The client here only ever ASSIGNS the `rows` the server
  732. // already built (`rows = r.rows`) — never calls a tainted local helper itself. `slug` goes along so
  733. // the face can refetch the show without depending on implicit access to a sibling member.
  734. //
  735. // tracker#17: opening shows the skeleton rows BEFORE the request; the answer replaces them unless the season was closed
  736. // meanwhile (then nothing). An error closes the season again. Closing never asks the server.
  737. on toggleCollapse(seasonId) {
  738. collapsedChanged = true
  739. m = collapsed
  740. if (collapsed[seasonId] != true) {
  741. m[seasonId] = true
  742. collapsed = m
  743. closeSeasonRows(&rows, &seasonId)
  744. return null
  745. }
  746. m[seasonId] = false
  747. collapsed = m
  748. rows = openingRows(&rows, seasonId)
  749. if (adultShow) {
  750. a = emit server showRows(slug, collapsed)
  751. if (collapsed[seasonId] == true) { return null }
  752. if (a == null || a.error != null) { m[seasonId] = true collapsed = m closeSeasonRows(&rows, &seasonId) return null }
  753. rows = a.rows
  754. return null
  755. }
  756. r = emit server showSeasonEpisodes('' + seasonId)
  757. if (collapsed[seasonId] == true) { return null }
  758. if (r == null || r.error != null) { m[seasonId] = true collapsed = m closeSeasonRows(&rows, &seasonId) return null }
  759. rows = filledRows(&rows, seasonId, &r.episodes, watchedEpisodes)
  760. }
  761. // tracker#26: the probe's tick — `showComplete` step by step until `done` (once per page: `completeBusy`; other requests are
  762. // served between two calls); the last answer replaces the skeletons. A lost answer (null) lets the next tick go on where the
  763. // server is; an error (TMDB down, adult) ends the loading and keeps what the page has.
  764. on completeTick(e) {
  765. if (completeBusy || !completing) { return null }
  766. completeBusy = true
  767. s = slug
  768. let r = emit server showComplete(s)
  769. while (r != null && r.error == null && r.done != true && slug == s) { r = emit server showComplete(s) }
  770. completeBusy = false
  771. if (r == null || slug != s) { return null }
  772. if (r.error != null) { completing = false return null }
  773. title = r.title
  774. summary = r.summary
  775. poster = r.poster
  776. genreRows = r.genreRows
  777. castRows = r.castRows
  778. castCount = r.castCount
  779. castMore = r.castMore
  780. castAllText = 'Show all (' + r.castCount + ')'
  781. crewRows = r.crewRows
  782. crewCount = r.crewCount
  783. crewMore = r.crewMore
  784. crewAllText = 'Show all crew (' + r.crewCount + ')'
  785. linkRows = r.linkRows
  786. collapsed = r.collapsed
  787. collapsedChanged = true
  788. rows = r.rows
  789. completing = false
  790. }
  791. // tracker#28: the cast / crew "Show all" toggles — client-only, no request (CSS shows the hidden names)
  792. on toggleCastAll(e) {
  793. castClass = castClass == 'all' ? 'collapsed' : 'all'
  794. }
  795. on toggleCrewAll(e) {
  796. crewClass = crewClass == 'all' ? 'collapsed' : 'all'
  797. }
  798. // signed out: the modal, nothing is sent
  799. // mission 062: the new `rows` come with the SAME ack as the session sync (SESSION SYNC above: `rows` derives from the session) —
  800. // but that sync is built with the MOUNT's open seasons. So the face sends its own rows only once this page opened/closed a season
  801. // (`collapsedChanged`, or a completed title); else they came twice (a second buildRows + 14 kB on The Simpsons: ~40 ms per click)
  802. on toggleEpisode(episodeId) {
  803. if (!signedIn) { document.getElementById('signin').showModal() return null }
  804. r = emit server showToggleEpisode(slug, '' + episodeId, collapsed, collapsedChanged)
  805. if (r == null || r.error != null) { return null }
  806. if (r.rows != null) { rows = r.rows }
  807. }
  808. on toggleSeason(seasonId) {
  809. if (!signedIn) { document.getElementById('signin').showModal() return null }
  810. r = emit server showToggleSeason(slug, '' + seasonId, collapsed, collapsedChanged)
  811. if (r == null || r.error != null) { return null }
  812. if (r.rows != null) { rows = r.rows }
  813. }
  814. // #24: the movie's own check — signed out the modal, nothing sent
  815. on toggleMovie(e) {
  816. if (!signedIn) { document.getElementById('signin').showModal() return null }
  817. r = emit server showToggleMovie(slug)
  818. if (r == null || r.error != null) { return null }
  819. movieWatched = r.watched
  820. movieWatchClass = r.watched ? 'checkicon solid' : 'checkicon regular'
  821. movieWatchText = r.watched ? 'Watched' : 'Not watched'
  822. }
  823. on toggleFollow(e) {
  824. if (!signedIn) { document.getElementById('signin').showModal() return null }
  825. r = emit server showToggleFollow(slug)
  826. if (r == null || r.error != null) { return null }
  827. following = r.following
  828. followClass = r.following ? 'follow primary' : 'follow inverted'
  829. followText = r.following ? 'Following' : 'Follow'
  830. }
  831. // ---- the faces (the trailing `session` is always the server's: hybriel#16) ----
  832. // tracker#26: complete an incomplete title and answer the page's parts — public data, NO session (no page re-mount)
  833. on server showComplete(slug) {
  834. return completedPageOf(textArg(&slug))
  835. }
  836. // every row for these open/closed seasons — only an ADULT show's page still uses it (its followers; tracker#17)
  837. on server showRows(slug, collapsed, session) {
  838. uid = userIdOfSession(&session)
  839. return showRowsOf(slug, collapsed, uid)
  840. }
  841. // tracker#17: one season's episodes, in order — public data, so NO `session` (no page re-mount, no sync: the fast path).
  842. // Refuses a season of an adult title (those pages use showRows above).
  843. on server showSeasonEpisodes(seasonId) {
  844. return showSeasonEpisodesOf(seasonId)
  845. }
  846. on server showToggleEpisode(slug, episodeId, collapsed, withRows, session) {
  847. uid = userIdOfSession(&session)
  848. return showToggleEpisodeOf(slug, episodeId, collapsed, withRows, uid)
  849. }
  850. on server showToggleSeason(slug, seasonId, collapsed, withRows, session) {
  851. uid = userIdOfSession(&session)
  852. return showToggleSeasonOf(slug, seasonId, collapsed, withRows, uid)
  853. }
  854. // #24: a movie's watched check (only a movie: a series is watched by its episodes)
  855. on server showToggleMovie(slug, session) {
  856. uid = userIdOfSession(&session)
  857. return showToggleMovieOf(slug, uid)
  858. }
  859. on server showToggleFollow(slug, session) {
  860. uid = userIdOfSession(&session)
  861. return showToggleFollowOf(slug, uid)
  862. }

Branches

Latest commits

  • 7ef3cb3bMerge branch 'records-st55' into mainTracker
  • fec2e080|||PR records: STATUS HM55Tracker
  • 8e174918Merge branch 'records-hm55b' into mainTracker
  • b1ecee57|||PR records: HM55 stateTracker
  • 28eab08cMerge branch 'records-hm55' into mainTracker
  • d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
  • 3059f86cMerge branch 'records-design-rule' into mainTracker
  • 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
  • d1390692Merge branch 'records-dp75b' into mainTracker
  • a4d1a7d2|||PR records: later steps checked, branch auditTracker
  • e070e16fMerge branch 'records-dp75' into mainTracker
  • 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
  • bfc4ea4dMerge branch 'ap62' into mainTracker
  • 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker
  • b9c7c3c8Merge branch 'records-dp74' into mainTracker
  • 85cfb4ae|||PR records: AP61 day61, DP74 liveTracker
  • b1496147Merge branch 'ap61' into mainTracker
  • 2047955bMerge branch 'u12-gateports' into mainTracker
  • c8da40f3|||PR AP61: re-vendor Hybriel set day61 (source a05af47c, bin a11042e5)Tracker
  • 4e018678|||PR deploy.sh: gates use Tracker's ports 8716-8719 and LC_ALL=C; README: 2 backups keptTracker