gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit20131f5120131f51|||PR HM55b record incomplete episode-toggle bisectTracker20131f51/components/show.hl

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

Branches

Latest commits

  • 20131f51|||PR HM55b record incomplete episode-toggle bisectTracker
  • 17feb7abHM55 WIP: hm54-fill re-applied on main; browser gate fails at ep3 toggleTracker
  • 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
  • 0b86324aMerge branch 'records-dp73' into mainTracker
  • 9ce5f59b|||PR records: DP73 live 613ae0e; deploy.sh keeps 2 backupsTracker