gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb10f00c8b10f00c8tracker#39: double episodes — migrated episodes whose TMDB id TMDB replaced are adopted by their number in the sync (old id -> migratedTmdbId); merge.hl step 3 merges each season's doubles at start (keeper: most watches > synced > first; watches moved/parked; tombstones into mergedEpisodes, nothing deleted); tools/count-duplicate-episodes.hl; gate fixture + paths-m039; live copy 850 -> 0 in 64 s; gates 373/0, 32/0, 52/0mreb10f00c8/components/show.hl

39.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. // `rows` is rebuilt from scratch (seasons/episodes refetched by id, watch rows refetched) on every
  18. // toggle — cheap: a show has at most a few dozen episodes per season.
  19. //
  20. // Mission 047 (the creator, 2026-10-01): a caret at the season header's right edge (down = open, right = collapsed); episode
  21. // rows not indented; on a phone the title first, then the poster at full width, then genres/plot/cast; a Follow toggle
  22. // 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
  23. // from components.hybriel) and writes nothing.
  24. //
  25. // tracker.worldapi.org#17 (mission 057): the caret points DOWN while a season is closed and UP while it is open. Opening a
  26. // season shows SKELETON rows at once (min(episodes, 8), a CSS shimmer, styles.hl) and then its episodes from the face
  27. // `showSeasonEpisodes`, which takes NO session: a face with `session` makes hl:web re-mount the whole page on the server and
  28. // ship every session-derived member back as a `sync` (WebFramework.hl `inbound`) — that, not the episodes, was most of the
  29. // old 250–450 ms (real data). The watched state comes from `watchedEpisodes` (this show's watched episodes per season, rendered
  30. // with the page and re-synced after every watch face). Closing is client-only (no request). An ADULT show (only its
  31. // followers see it) keeps the session face `showRows`: the public face refuses adult seasons.
  32. //
  33. // tracker.worldapi.org#12: link icons under the title — the show on TMDB, IMDb, TheTVDB, TVmaze (a movie: TMDB + IMDb),
  34. // only for the ids it has (shows.hl externalLinksOf), each in a new tab.
  35. //
  36. // mission 058: #22 every episode row shows its air date (`release`, 'YYYY-MM-DD' like /my/unwatched; none → empty). #23 a
  37. // season's check is DERIVED: solid exactly when every one of its episodes is watched (a season without episodes: its own
  38. // season watch) — unchecking one episode turns the season off with the face's answer, checking it again turns it on; the
  39. // season click watches all when not all are watched, else unwatches all. #24 a MOVIE's page has its own watched check
  40. // (watch `targetType = 'movie'`, target = the title's id; face `showToggleMovie`), signed out → the sign-in modal.
  41. //
  42. // tracker.worldapi.org#26: an INCOMPLETE title (one a person page added from a filmography — details.hl `needsDetails`) shows
  43. // what it has plus skeletons (poster, cast line, season rows for a series) and completes itself WITHOUT a reload: the
  44. // invisible `showProbe` (endless short CSS animation — hl:web has no mount hook, the person page's trick) calls the face
  45. // `showComplete` until it is done — one step per call (details.hl completeStep: TMDB details + ids + cast; a series' seasons/
  46. // episodes in parts; poster, TVmaze) — and the last answer's parts replace the skeletons. No session (no page re-mount); adult
  47. // refused.
  48. //
  49. // tracker.worldapi.org#28: the WHOLE cast and the key crew (details.hl stores them: a series' cast of every season, main cast
  50. // first by episode count, then "Guest stars"; crew = Created by / Directed by / Written by / Screenplay / Story / Music). The
  51. // cast shows its first `castShown` (20) and a "Show all (N)" toggle, each crew job its first `crewShown` (6) and one "Show all
  52. // crew (N)" toggle — CLIENT-SIDE (the rows are all rendered, CSS hides the rest; `castClass`/`crewClass`, no request). Names
  53. // link to /person/<slug>; the character in brackets after the name (CSS `attr(data-role)` — one element per name: the SSR's
  54. // line breaks inside a wrapper element put a space before the comma).
  55. parent './main.hl'
  56. import Modal from './modal.hl'
  57. import FranchiseWidget from './franchisewidget.hl'
  58. import { appTitle } from '../project.hl'
  59. import { userIdOfSession, loginHref } from '../lib/users.hl'
  60. import { isFollowing, toggleFollowed } from '../lib/follows.hl'
  61. import { showBySlug, showById, genreById, personById, seasonsOfShow, episodesOfSeason, seasonById, posterName, externalLinksOf, summaryOf, titleKind, statusOf } from '../lib/shows.hl'
  62. import { watchesOfUser, isWatched, watchedSet, watchClassOf, seasonAllWatched, toggleWatched, toggleSeasonWatched } from '../lib/watches.hl'
  63. import { needsDetails, completeStep, completeLine, persistDetails } from '../lib/details.hl'
  64. import { widgetsOf } from '../lib/franchises.hl'
  65. import { listOr } from '../lib/util.hl'
  66. // ---- pure helpers ----------------------------------------------------------------------------
  67. // `static`, like calendar.hl's `soonOf` — a PLAIN instance member function that calls an
  68. // hl:mpackdb-backed import (seasonsOfShow, episodesOfSeason, watchesOfUser, …) comes back null
  69. // when called from an `on server` face (confirmed by running the gate: "'buildRows' is not
  70. // callable — it holds null" at the face's call site, even though the SAME call works fine as a
  71. // member's own initializer at the top of this file). `static` is the proven-safe shape (calendar's
  72. // `soonOf`, called from `calLoad`/`calSettingsLoad`, an mpackdb-backed helper exactly like this one).
  73. static initialCollapsed = (&seasons) => {
  74. m = {}
  75. let i = 0
  76. while (i < seasons.length) {
  77. if (i > 0) { m[seasons[i].id] = true }
  78. i = i + 1
  79. }
  80. return m
  81. }
  82. static genreRowsOf = (&show) => {
  83. out = []
  84. for (gid of show.genres) {
  85. let g = genreById(gid)
  86. if (g != null) { out.push({ id = g.id name = g.name href = '/genres/' + g.urlSegment }) }
  87. }
  88. return out
  89. }
  90. // tracker#28: how many names show before "Show all" (cast; per crew job)
  91. static castShown = 20
  92. static crewShown = 6
  93. // the cast as flat rows (no nested for, see THE ROWS above): `isPerson` rows { name, href, roleText (' (Character)' or ''),
  94. // itemClass } and before the first guest one `isLabel` row "Guest stars". itemClass: `more` = hidden until "Show all", `end` =
  95. // no comma after it (the last of a group), `cut` = the last one shown while collapsed (no comma then)
  96. static castRowsOf = (show) => {
  97. people = []
  98. for (c of listOr(show.cast)) {
  99. let p = c != null && c.person != null ? personById(c.person) : null
  100. // mission 062: a guest without a person record — the link creates it on the first open (project.hl guestRoute)
  101. if (p != null) { people.push({ name = c.actor != null ? c.actor : p.name href = '/person/' + p.urlSegment role = c.character != null ? c.character : '' guest = c.guest == true }) }
  102. else if (c != null && c.person == null && c.tmdbId != null && c.actor != null) { people.push({ name = c.actor href = '/person/tmdb/' + c.tmdbId + '?show=' + show.id role = c.character != null ? c.character : '' guest = true }) }
  103. }
  104. out = []
  105. let k = 0
  106. let guests = false
  107. while (k < people.length) {
  108. let c = people[k]
  109. if (c.guest && !guests && k > 0) {
  110. guests = true
  111. out.push({ isLabel = true isPerson = false text = 'Guest stars' name = '' href = '' roleText = '' itemClass = k >= castShown ? 'more' : '' })
  112. }
  113. let last = k == people.length - 1 || (people[k + 1].guest && !c.guest)
  114. let cls = (k >= castShown ? ' more' : '') + (last ? ' end' : '') + (k == castShown - 1 ? ' cut' : '')
  115. out.push({ isLabel = false isPerson = true text = '' name = c.name href = c.href roleText = c.role != '' ? ' (' + c.role + ')' : '' itemClass = 'artist-link' + cls })
  116. k = k + 1
  117. }
  118. return out
  119. }
  120. static castCountOf = (&rows) => {
  121. let n = 0
  122. for (r of rows) { if (r.isPerson) { n = n + 1 } }
  123. return n
  124. }
  125. static crewLabels = { creator = 'Created by' director = 'Directed by' writer = 'Written by' screenplay = 'Screenplay' story = 'Story' composer = 'Music' }
  126. // the crew as flat rows: per job (in stored order) an `isLabel` row, then its people (itemClass as for the cast, `more` after
  127. // the first crewShown of a job)
  128. static crewRowsOf = (&show) => {
  129. people = []
  130. for (c of listOr(show.crew)) {
  131. let p = c != null ? personById(c.person) : null
  132. if (p != null && crewLabels[c.job] != null) { people.push({ name = c.name != null ? c.name : p.name href = '/person/' + p.urlSegment job = c.job }) }
  133. }
  134. out = []
  135. let k = 0
  136. let inJob = 0
  137. while (k < people.length) {
  138. let c = people[k]
  139. if (k == 0 || people[k - 1].job != c.job) {
  140. inJob = 0
  141. out.push({ isLabel = true isPerson = false text = crewLabels[c.job] name = '' href = '' itemClass = '' })
  142. }
  143. let last = k == people.length - 1 || people[k + 1].job != c.job
  144. out.push({ isLabel = false isPerson = true text = '' name = c.name href = c.href itemClass = 'crew-link' + (inJob >= crewShown ? ' more' : '') + (last ? ' end' : '') + (inJob == crewShown - 1 ? ' cut' : '') })
  145. inJob = inJob + 1
  146. k = k + 1
  147. }
  148. return out
  149. }
  150. // how many crew names are hidden while collapsed (0 = no toggle) and how many there are
  151. static crewHiddenOf = (&rows) => {
  152. let n = 0
  153. for (r of rows) { if (r.isPerson && r.itemClass.includes(' more')) { n = n + 1 } }
  154. return n
  155. }
  156. static crewCountOf = (&rows) => {
  157. let n = 0
  158. for (r of rows) { if (r.isPerson) { n = n + 1 } }
  159. return n
  160. }
  161. // a View attribute must be a literal, a member or a field path — never an inline expression — so
  162. // every ternary (watched -> icon class, collapsed -> row class) is resolved HERE, once, into a
  163. // plain field the View just reads (row.watchClass, row.rowClass); `watchClassOf` itself lives in
  164. // watches.hl (shared with /unwatched and /schedule, "reuse, don't copy")
  165. // #22: an episode's air date as the lists show it ('YYYY-MM-DD'), '' when it has none
  166. static airDateOf = (&e) => { return e.release != null && hlTypeName(e.release) == 'String' ? e.release : '' }
  167. static buildRows = (&show, &uid, collapsed) => {
  168. watched = watchedSet(uid != null ? watchesOfUser(uid) : [])
  169. out = []
  170. for (s of seasonsOfShow(show)) {
  171. let isCollapsed = collapsed[s.id] == true
  172. let label = s.title != null && s.title != '' ? s.title : 'Season ' + s.seasonNumber
  173. let seasonWatched = seasonAllWatched(s, watched)
  174. out.push({ kind = 'season' isSeason = true isEpisode = false isSkeleton = false id = s.id skeletonCount = s.episodes.length < 8 ? s.episodes.length : 8 label = label episodeCountText = s.episodes.length == 1 ? '1 episode' : s.episodes.length + ' episodes' watched = seasonWatched watchClass = watchClassOf(seasonWatched) collapsed = isCollapsed rowClass = isCollapsed ? 'collapsed' : 'expanded' })
  175. if (!isCollapsed) {
  176. for (e of episodesOfSeason(s)) {
  177. let epWatched = watched['episode:' + e.id] == true
  178. out.push({ kind = 'episode' isSeason = false isEpisode = true isSkeleton = false id = e.id seasonId = s.id episodeNumber = e.episodeNumber title = e.title != null ? e.title : '' airDate = airDateOf(e) watched = epWatched watchClass = watchClassOf(epWatched) })
  179. }
  180. }
  181. }
  182. return out
  183. }
  184. // what the client marks the rows of a season it opens with (tracker#17) — only this show's, never the user's whole watch
  185. // list (every member is shipped to the browser). Per season with a watched episode: `{ all, except }` — `all` = most of
  186. // it is watched, then `except` holds the UNwatched ids, else the watched ones (a fully watched 142-episode season is
  187. // `{ all = true except = {} }`, not 142 ids). No entry = nothing watched.
  188. static watchedEpisodesOf = (&show, &uid) => {
  189. m = {}
  190. if (uid == null) { return m }
  191. watched = watchedSet(watchesOfUser(uid))
  192. for (s of seasonsOfShow(show)) {
  193. let yes = {}
  194. let no = {}
  195. let n = 0
  196. for (eid of s.episodes) {
  197. if (watched['episode:' + eid] == true) { yes[eid] = true n = n + 1 } else { no[eid] = true }
  198. }
  199. if (n > 0) { m[s.id] = n * 2 > s.episodes.length ? { all = true except = no } : { all = false except = yes } }
  200. }
  201. return m
  202. }
  203. // is this episode watched, by that per-season shape (client-side, pure)
  204. static watchedIn = (&entry, &episodeId) => {
  205. if (entry == null) { return false }
  206. listed = entry.except[episodeId] == true
  207. return entry.all ? !listed : listed
  208. }
  209. // ---- the rows as the CLIENT changes them (tracker#17) — pure: no import is reached, so they run in the browser ----------
  210. // (`watchClassOf` is an import of the mpackdb-backed watches.hl, so `filledRows` writes its two classes itself)
  211. static seasonRowAs = (&row, &isCollapsed) => {
  212. return { kind = 'season' isSeason = true isEpisode = false isSkeleton = false id = row.id skeletonCount = row.skeletonCount label = row.label episodeCountText = row.episodeCountText watched = row.watched watchClass = row.watchClass collapsed = isCollapsed rowClass = isCollapsed ? 'collapsed' : 'expanded' }
  213. }
  214. // the season opened: its caret up at once, `skeletonCount` placeholder rows under it
  215. static openingRows = (&rows, seasonId) => {
  216. out = []
  217. for (row of rows) {
  218. if (row.isSeason && row.id == seasonId) {
  219. out.push(seasonRowAs(row, false))
  220. let i = 0
  221. while (i < row.skeletonCount) {
  222. out.push({ kind = 'skeleton' isSeason = false isEpisode = false isSkeleton = true id = seasonId + '-skeleton-' + i seasonId = seasonId })
  223. i = i + 1
  224. }
  225. } else { out.push(row) }
  226. }
  227. return out
  228. }
  229. // the season closed: its episode (and skeleton) rows gone, caret down
  230. static closedRows = (&rows, &seasonId) => {
  231. out = []
  232. for (row of rows) {
  233. if (row.isSeason && row.id == seasonId) { out.push(seasonRowAs(row, true)) }
  234. else if (!row.isSeason && row.seasonId == seasonId) { }
  235. else { out.push(row) }
  236. }
  237. return out
  238. }
  239. // the episodes arrived: they replace the season's skeleton rows. No skeleton of it left (closed meanwhile, or a watch face
  240. // already rebuilt every row) → the rows stay as they are (no double rows)
  241. static filledRows = (&rows, seasonId, &episodes, watched) => {
  242. out = []
  243. let done = false
  244. for (row of rows) {
  245. if (row.isSkeleton && row.seasonId == seasonId) {
  246. if (!done) {
  247. for (e of episodes) {
  248. let w = watchedIn(watched[seasonId], e.id)
  249. out.push({ kind = 'episode' isSeason = false isEpisode = true isSkeleton = false id = e.id seasonId = seasonId episodeNumber = e.episodeNumber title = e.title airDate = e.airDate watched = w watchClass = w ? 'checkicon solid' : 'checkicon regular' })
  250. }
  251. done = true
  252. }
  253. } else { out.push(row) }
  254. }
  255. return out
  256. }
  257. // a LOCAL static like buildRows (an imported mpackdb helper called straight from a member's initializer came back false
  258. // after a client-side navigation to the page — the gate's follow check)
  259. static followingOf = (&show, &uid) => { return uid != null && isFollowing(uid, show.id) }
  260. // #24: has this user watched this movie (a watch `movie:<title id>`)?
  261. static movieWatchedOf = (&show, &uid) => { return uid != null && isWatched(watchesOfUser(uid), 'movie', show.id) }
  262. // mission 056: an ADULT title's page (TMDB's flag `adult == true`, mission 054) is "Not found" for everyone who does not
  263. // follow it (signed out too); a follower sees it as before. Unknown (`null`) is not hidden here — only in the lists.
  264. // With hybriel ≥ 73267707 (#121/#122) `showRow`/`found` are server sites re-derived after every session face with the page's
  265. // slug, so an Unfollow on the page hides it at once (the gate proves it; the old build left the page up until a reload).
  266. // Mission 054's try (`found = … && !adultHiddenFor(showRow, me)`, `collapsed`/`rows` from `found`) broke the checks.
  267. static adultHiddenFor = (&show, &uid) => { return show.adult == true && !followingOf(show, uid) }
  268. // the page's show — null when there is none OR it is hidden for this user: every member is shipped to the browser, so the
  269. // row of a hidden title must never be one
  270. static visibleShow = (&slug, &uid) => {
  271. s = showBySlug(slug)
  272. return s != null && adultHiddenFor(s, uid) ? null : s
  273. }
  274. // tracker.worldapi.org#19 (mission 066): the franchise widget(s), one per timeline the title is in (components/franchisewidget.hl)
  275. static franchiseWidgetsOf = (&show) => { return widgetsOf(show.id) }
  276. // mission 062: what the page shows of the title, as a SMALL object — `showRow` reads the session, so hl:web ships it with the page
  277. // AND re-sends it after every watch/follow click (SESSION SYNC below): the whole record was ~1 MB on The Simpsons (300 cast + crew
  278. // entries). null = not found / hidden.
  279. static pageShowOf = (&slug, &uid) => {
  280. s = visibleShow(slug, uid)
  281. if (s == null) { return null }
  282. movie = s.type == 'movie'
  283. st = statusOf(s)
  284. return { id = s.id title = s.title summary = summaryOf(s) type = s.type adult = s.adult == true shortId = s.shortId != null ? '' + s.shortId : '' statusText = st.text statusTone = st.tone
  285. poster = posterName(s) genreRows = genreRowsOf(s) linkRows = externalLinksOf(s) completing = completingOf(s) following = followingOf(s, uid)
  286. movieWatched = movie ? movieWatchedOf(s, uid) : false }
  287. }
  288. // the seasons/episodes rows and the per-season watch state by the slug (the record itself stays on the server)
  289. static rowsOfSlug = (&slug, &uid, &collapsed) => {
  290. s = showBySlug(slug)
  291. return s != null ? buildRows(s, uid, collapsed) : []
  292. }
  293. static watchedEpisodesOfSlug = (&slug, &uid) => {
  294. s = showBySlug(slug)
  295. return s != null ? watchedEpisodesOf(s, uid) : {}
  296. }
  297. // the initial open/closed seasons and the title's kind (tracker#20/#21: the heading's type word) from the SLUG alone (not from
  298. // `showRow`, which reads the session — see `collapsed`) — one slug lookup for both
  299. static slugInfoOf = (&slug) => {
  300. s = showBySlug(slug)
  301. return s != null ? { collapsed = initialCollapsed(seasonsOfShow(s)) kind = titleKind(s) } : { collapsed = {} kind = 'series' }
  302. }
  303. // mission 062: the cast and crew rows by the SLUG alone (not from `showRow`, which reads the session — see `castRows`). An
  304. // ADULT title (its page only for its followers) shows none: every member is shipped to the browser, and adult titles never get
  305. // credits anyway (details.hl skips them; at most a migrated cast)
  306. static publicShowOf = (&slug) => {
  307. s = showBySlug(slug)
  308. return s != null && s.adult != true ? s : null
  309. }
  310. static castOfSlug = (&slug) => {
  311. s = publicShowOf(slug)
  312. return s != null ? castRowsOf(s) : []
  313. }
  314. static crewOfSlug = (&slug) => {
  315. s = publicShowOf(slug)
  316. return s != null ? crewRowsOf(s) : []
  317. }
  318. // tracker#26: the page loads this title's full details on open
  319. static completingOf = (&show) => { return needsDetails(show) }
  320. // the face's work: ONE step of completing the title (details.hl completeStep — a series takes a few; a second viewer drives the
  321. // same job or finds it complete); when done, every part of the page that changes — the rows without anyone's watch state (a
  322. // title that was incomplete had no episodes to watch)
  323. static completedPageOf = (&slug) => {
  324. let show = showBySlug(slug)
  325. if (show == null || show.adult == true) { return { error = 'no such show' } }
  326. if (needsDetails(show)) {
  327. let r = completeStep(show.id)
  328. if (r.retry || r.adult == true) { return { error = r.error != '' ? r.error : 'no such show' } }
  329. if (!r.done) { return { done = false steps = r.sum.steps } }
  330. if (!r.skipped) {
  331. persistDetails()
  332. console.log('details on open: ' + completeLine(show.title, r.sum))
  333. }
  334. show = showById(show.id)
  335. }
  336. cl = initialCollapsed(seasonsOfShow(show))
  337. pn = posterName(show)
  338. crew = crewRowsOf(show)
  339. cast = castRowsOf(show)
  340. return { done = true title = show.title summary = summaryOf(show) poster = pn genreRows = genreRowsOf(show) castRows = cast
  341. castCount = castCountOf(cast) castMore = castCountOf(cast) > castShown crewRows = crew crewCount = crewCountOf(crew) crewMore = crewHiddenOf(crew) > 0
  342. linkRows = externalLinksOf(show) collapsed = cl rows = buildRows(show, null, cl) }
  343. }
  344. // ---- reactive members -----------------------------------------------------------------------
  345. slug = null
  346. session = null
  347. userId = userIdOfSession(session)
  348. signedIn = userId != null
  349. // SESSION SYNC (mission 047; since hybriel #121/#122, mission 056): a face taking `session` answers with a `sync` of every
  350. // member derived from session that reaches an import (here `showRow`, `found`, `following`, `rows`, …), re-derived on the
  351. // server with the page's route params but the MOUNT's other state — so client state (`collapsed`) must never derive from
  352. // them. `me` stays the plain copy mission 047 introduced.
  353. me = userId
  354. showRow = pageShowOf(slug, me)
  355. found = showRow != null
  356. notFound = showRow == null
  357. // the Follow toggle: "Follow" = the inverted button (accent text on a surface, no border since tracker#32), "Following" = the
  358. // filled one (the theme's `primary`)
  359. following = found ? showRow.following : false
  360. followClass = following ? 'follow primary' : 'follow inverted'
  361. followText = following ? 'Following' : 'Follow'
  362. signInHref = loginHref
  363. // #24: a movie's watched check (same icon/classes as the episodes); the classes written out, not `watchClassOf` (an import of
  364. // the mpackdb-backed watches.hl cannot run in the browser when the member is re-derived there)
  365. isMovie = found && showRow.type == 'movie'
  366. movieWatched = isMovie ? showRow.movieWatched : false
  367. movieWatchClass = movieWatched ? 'checkicon solid' : 'checkicon regular'
  368. movieWatchText = movieWatched ? 'Watched' : 'Not watched'
  369. 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.'
  370. title = found ? showRow.title : ''
  371. // tracker#35: the status pill next to a series' title — TVmaze's status, else TMDB's (shows.hl statusOf); none on a movie
  372. statusText = found ? showRow.statusText : ''
  373. hasStatus = statusText != ''
  374. statusClass = found ? 'status-pill status-' + showRow.statusTone : 'status-pill'
  375. // tracker#20: "Series | Reacher" — the kind from the slug (pure strings here: they are re-derived in the browser too)
  376. slugInfo = slugInfoOf(slug)
  377. pageKind = slugInfo.kind
  378. typeText = pageKind == 'movie' ? 'Movie' : (pageKind == 'show' ? 'Show' : 'Series')
  379. typeClass = 'type-word type-' + pageKind
  380. // tracker#18: the creator's own text, else TMDB's, else TVmaze's (pageShowOf → shows.hl summaryOf)
  381. summary = found && showRow.summary != null ? showRow.summary : ''
  382. poster = found ? showRow.poster : null
  383. hasPoster = poster != null
  384. posterUrl = hasPoster ? '/posters/' + poster : ''
  385. // mission 060 (tracker.worldapi.org#27): the short id under the poster (none yet while the backfill has not reached it)
  386. shortId = found ? showRow.shortId : ''
  387. hasShortId = shortId != ''
  388. genreRows = found ? showRow.genreRows : []
  389. hasGenres = genreRows.length > 0
  390. // mission 062: cast + crew from the SLUG (`castOfSlug`, `crewOfSlug`), never from `showRow` — a member derived from the session is
  391. // re-derived and re-SENT after every watch/follow click (SESSION SYNC above): The Simpsons' 300 names took 0.7 s per click
  392. castRows = castOfSlug(slug)
  393. hasCast = castRows.length > 0
  394. // tracker#28: "Show all (N)" — the toggles' state is CLIENT state: literals, never derived from `showRow` (session sync)
  395. castCount = castCountOf(castRows)
  396. castMore = castCount > castShown
  397. castAllText = 'Show all (' + castCount + ')'
  398. castClass = 'collapsed'
  399. crewRows = crewOfSlug(slug)
  400. hasCrew = crewRows.length > 0
  401. crewCount = crewCountOf(crewRows)
  402. crewMore = crewHiddenOf(crewRows) > 0
  403. crewAllText = 'Show all crew (' + crewCount + ')'
  404. crewClass = 'collapsed'
  405. linkRows = found ? showRow.linkRows : []
  406. franchiseWidgets = found ? franchiseWidgetsOf(showRow) : []
  407. hasLinks = linkRows.length > 0
  408. // NOT from `showRow`/`found`: they read the session (via `me`), so a member derived from them is re-derived on the server
  409. // after every session face with the MOUNT's state — `collapsed` (client state) would snap back to the initial seasons (mission
  410. // 056: the 2nd episode click in a re-opened season did nothing). The season ids of a hidden page are no secret.
  411. collapsed = slugInfo.collapsed
  412. // mission 062: has this page opened/closed a season (client state) — then a watch face sends its own rows (toggleEpisode)
  413. collapsedChanged = false
  414. rows = found ? rowsOfSlug(slug, me, collapsed) : []
  415. hasRows = rows.length > 0
  416. watchedEpisodes = found ? watchedEpisodesOfSlug(slug, me) : {}
  417. // an adult page (followers only) opens its seasons through the session face `showRows`
  418. adultShow = found && showRow.adult == true
  419. // tracker#26: incomplete → skeletons + the probe until `showComplete` answered
  420. completing = found ? showRow.completing : false
  421. // tracker#33: a title TMDB has no poster for (The Remaining) shows the placeholder in the poster's place — the column was empty
  422. // but for the short id, the page looked unfinished; while an incomplete title loads, the skeleton instead
  423. posterLoading = completing && !hasPoster
  424. noPoster = !hasPoster && !completing
  425. completeBusy = false
  426. isSeries = found && showRow.type != 'movie'
  427. skeletonSeasons = ['1', '2', '3']
  428. __title = found ? title + ' — ' + appTitle : appTitle
  429. View {
  430. showPage {
  431. if (notFound) {
  432. article { class = "main"
  433. h1 { "Not found" }
  434. p { "This show doesn't exist." }
  435. }
  436. }
  437. if (found) {
  438. showHeader {
  439. showPoster {
  440. if (hasPoster) { img { src = posterUrl alt = title } }
  441. if (noPoster) { img { class = "no-poster" src = "/posters/none" alt = "no poster" } }
  442. if (posterLoading) { skeletonPoster { "aria-hidden" = "true" } }
  443. // tracker#34: Follow directly under the poster, as wide as the poster (creator: "the follow button should go below
  444. // the picture … and expand to the size o the poster")
  445. button { id = "follow" type = "button" class = followClass followText on click(e) { emit toggleFollow(e) } }
  446. if (hasShortId) { shortIdLabel { id = "shortid" title = "Short id" shortId } }
  447. }
  448. showMeta {
  449. showTitle {
  450. h1 { class = "typed" typeWord { class = typeClass typeText } typeSep { "|" } typeName { title } }
  451. if (hasStatus) { statusPill { class = statusClass statusText } }
  452. }
  453. if (isMovie) {
  454. movieWatch {
  455. button { id = "moviewatch" type = "button" class = movieWatchClass "aria-label" = "mark movie watched"
  456. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  457. circle { cx = "12" cy = "12" r = "10" }
  458. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  459. }
  460. on click(e) { emit toggleMovie(e) }
  461. }
  462. movieWatchLabel { movieWatchText }
  463. }
  464. }
  465. if (hasLinks) {
  466. showLinks {
  467. for (l of linkRows) { a { class = "extlink" href = l.href target = "_blank" rel = "noopener" title = l.title "aria-label" = l.title "data-site" = l.site l.label } }
  468. }
  469. }
  470. // mission 025: the franchise widget right under the title/poster block — on a phone (showMeta dissolves, see styles.hl)
  471. // after the poster and before the genres, plot and cast; from 40rem in the right column under the title
  472. FranchiseWidget { widgets = franchiseWidgets }
  473. if (hasGenres) {
  474. showGenres {
  475. for (g of genreRows) { a { class = "genre-pill" href = g.href g.name } }
  476. }
  477. }
  478. showSummary { summary }
  479. if (hasCrew) {
  480. showCrew { class = crewClass
  481. for (r of crewRows) {
  482. if (r.isLabel) { crewLabel { r.text } }
  483. if (r.isPerson) { a { class = r.itemClass href = r.href r.name } }
  484. }
  485. if (crewMore) {
  486. button { id = "crewtoggle" type = "button" class = "quiet showall"
  487. whenCollapsed { crewAllText }
  488. whenAll { "Show less" }
  489. on click(e) { emit toggleCrewAll(e) }
  490. }
  491. }
  492. }
  493. }
  494. if (hasCast) {
  495. showCast { class = castClass
  496. castHeading { "Cast" }
  497. for (c of castRows) {
  498. if (c.isLabel) { castLabel { class = c.itemClass c.text } }
  499. if (c.isPerson) { a { class = c.itemClass href = c.href "data-role" = c.roleText c.name } }
  500. }
  501. if (castMore) {
  502. button { id = "casttoggle" type = "button" class = "quiet showall"
  503. whenCollapsed { castAllText }
  504. whenAll { "Show less" }
  505. on click(e) { emit toggleCastAll(e) }
  506. }
  507. }
  508. }
  509. }
  510. if (completing) { skeletonCast { "aria-hidden" = "true" } }
  511. }
  512. }
  513. if (completing) {
  514. showLoading { id = "showloading" "aria-busy" = "true"
  515. if (isSeries) {
  516. for (k of skeletonSeasons) {
  517. skeletonRow { "aria-hidden" = "true"
  518. skeletonCheck { }
  519. skeletonTitle { }
  520. }
  521. }
  522. }
  523. showProbe { "aria-hidden" = "true" on animationiteration(e) { emit completeTick(e) } }
  524. }
  525. }
  526. if (hasRows) {
  527. showSeasons {
  528. for (row of rows) {
  529. if (row.isSeason) {
  530. seasonRow { class = row.rowClass
  531. button { type = "button" class = row.watchClass value = row.id "aria-label" = "mark season watched"
  532. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  533. circle { cx = "12" cy = "12" r = "10" }
  534. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  535. }
  536. on click(e) { emit toggleSeason(row.id) }
  537. }
  538. button { type = "button" class = "season-toggle" value = row.id
  539. seasonLabel { row.label }
  540. seasonCount { row.episodeCountText }
  541. seasonCaret { "aria-hidden" = "true"
  542. svg { viewBox = "0 0 24 24" width = "20" height = "20"
  543. path { d = "M6 9 L12 15 L18 9" }
  544. }
  545. }
  546. on click(e) { emit toggleCollapse(row.id) }
  547. }
  548. }
  549. }
  550. if (row.isEpisode) {
  551. episodeRow {
  552. button { type = "button" class = row.watchClass value = row.id "aria-label" = "mark episode watched"
  553. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  554. circle { cx = "12" cy = "12" r = "10" }
  555. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  556. }
  557. on click(e) { emit toggleEpisode(row.id) }
  558. }
  559. episodeNumber { row.episodeNumber }
  560. episodeTitle { row.title }
  561. episodeDate { row.airDate }
  562. }
  563. }
  564. if (row.isSkeleton) {
  565. skeletonRow { "aria-hidden" = "true"
  566. skeletonCheck { }
  567. skeletonNumber { }
  568. skeletonTitle { }
  569. }
  570. }
  571. }
  572. }
  573. }
  574. Modal { id = "signin" title = "Sign in"
  575. p { signInText }
  576. footer {
  577. button { type = "button" value = "close" "Close" }
  578. a { id = "signin-link" class = "button primary" href = signInHref "Sign in with ident" }
  579. }
  580. }
  581. }
  582. }
  583. }
  584. // Every rebuild of `rows` happens SERVER-SIDE, never by calling `buildRows` from a client handler:
  585. // a member function whose body reaches an hl:mpackdb-backed import (seasonsOfShow, episodesOfSeason,
  586. // watchesOfUser, …) compiles to nothing on the client (no case ever assigns it — a genuine Hybriel
  587. // gap, filed under `issues`) even though the client bundle still calls it, so `this.buildRows(...)`
  588. // throws "not a function" in the browser. The client here only ever ASSIGNS the `rows` the server
  589. // already built (`rows = r.rows`) — never calls a tainted local helper itself. `slug` goes along so
  590. // the face can refetch the show without depending on implicit access to a sibling member.
  591. //
  592. // tracker#17: opening shows the skeleton rows BEFORE the request; the answer replaces them unless the season was closed
  593. // meanwhile (then nothing). An error closes the season again. Closing never asks the server.
  594. on toggleCollapse(seasonId) {
  595. collapsedChanged = true
  596. m = collapsed
  597. if (collapsed[seasonId] != true) {
  598. m[seasonId] = true
  599. collapsed = m
  600. rows = closedRows(rows, seasonId)
  601. return null
  602. }
  603. m[seasonId] = false
  604. collapsed = m
  605. rows = openingRows(rows, seasonId)
  606. if (adultShow) {
  607. let a = emit server showRows(slug, collapsed)
  608. if (collapsed[seasonId] == true) { return null }
  609. if (a == null || a.error != null) { m[seasonId] = true collapsed = m rows = closedRows(rows, seasonId) return null }
  610. rows = a.rows
  611. return null
  612. }
  613. let r = emit server showSeasonEpisodes('' + seasonId)
  614. if (collapsed[seasonId] == true) { return null }
  615. if (r == null || r.error != null) { m[seasonId] = true collapsed = m rows = closedRows(rows, seasonId) return null }
  616. rows = filledRows(rows, seasonId, r.episodes, watchedEpisodes)
  617. }
  618. // tracker#26: the probe's tick — `showComplete` step by step until `done` (once per page: `completeBusy`; other requests are
  619. // served between two calls); the last answer replaces the skeletons. A lost answer (null) lets the next tick go on where the
  620. // server is; an error (TMDB down, adult) ends the loading and keeps what the page has.
  621. on completeTick(e) {
  622. if (completeBusy || !completing) { return null }
  623. completeBusy = true
  624. s = slug
  625. let r = emit server showComplete(s)
  626. while (r != null && r.error == null && r.done != true && slug == s) { r = emit server showComplete(s) }
  627. completeBusy = false
  628. if (r == null || slug != s) { return null }
  629. if (r.error != null) { completing = false return null }
  630. title = r.title
  631. summary = r.summary
  632. poster = r.poster
  633. genreRows = r.genreRows
  634. castRows = r.castRows
  635. castCount = r.castCount
  636. castMore = r.castMore
  637. castAllText = 'Show all (' + r.castCount + ')'
  638. crewRows = r.crewRows
  639. crewCount = r.crewCount
  640. crewMore = r.crewMore
  641. crewAllText = 'Show all crew (' + r.crewCount + ')'
  642. linkRows = r.linkRows
  643. collapsed = r.collapsed
  644. collapsedChanged = true
  645. rows = r.rows
  646. completing = false
  647. }
  648. // tracker#28: the cast / crew "Show all" toggles — client-only, no request (CSS shows the hidden names)
  649. on toggleCastAll(e) {
  650. castClass = castClass == 'all' ? 'collapsed' : 'all'
  651. }
  652. on toggleCrewAll(e) {
  653. crewClass = crewClass == 'all' ? 'collapsed' : 'all'
  654. }
  655. // signed out: the modal, nothing is sent
  656. // mission 062: the new `rows` come with the SAME ack as the session sync (SESSION SYNC above: `rows` derives from the session) —
  657. // 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
  658. // (`collapsedChanged`, or a completed title); else they came twice (a second buildRows + 14 kB on The Simpsons: ~40 ms per click)
  659. on toggleEpisode(episodeId) {
  660. if (!signedIn) { document.getElementById('signin').showModal() return null }
  661. let r = emit server showToggleEpisode(slug, '' + episodeId, collapsed, collapsedChanged)
  662. if (r == null || r.error != null) { return null }
  663. if (r.rows != null) { rows = r.rows }
  664. }
  665. on toggleSeason(seasonId) {
  666. if (!signedIn) { document.getElementById('signin').showModal() return null }
  667. let r = emit server showToggleSeason(slug, '' + seasonId, collapsed, collapsedChanged)
  668. if (r == null || r.error != null) { return null }
  669. if (r.rows != null) { rows = r.rows }
  670. }
  671. // #24: the movie's own check — signed out the modal, nothing sent
  672. on toggleMovie(e) {
  673. if (!signedIn) { document.getElementById('signin').showModal() return null }
  674. let r = emit server showToggleMovie(slug)
  675. if (r == null || r.error != null) { return null }
  676. movieWatched = r.watched
  677. movieWatchClass = r.watched ? 'checkicon solid' : 'checkicon regular'
  678. movieWatchText = r.watched ? 'Watched' : 'Not watched'
  679. }
  680. on toggleFollow(e) {
  681. if (!signedIn) { document.getElementById('signin').showModal() return null }
  682. let r = emit server showToggleFollow(slug)
  683. if (r == null || r.error != null) { return null }
  684. following = r.following
  685. followClass = r.following ? 'follow primary' : 'follow inverted'
  686. followText = r.following ? 'Following' : 'Follow'
  687. }
  688. // ---- the faces (the trailing `session` is always the server's: hybriel#16) ----
  689. // tracker#26: complete an incomplete title and answer the page's parts — public data, NO session (no page re-mount)
  690. on server showComplete(slug) {
  691. return completedPageOf(slug != null ? '' + slug : '')
  692. }
  693. // every row for these open/closed seasons — only an ADULT show's page still uses it (its followers; tracker#17)
  694. on server showRows(slug, collapsed, session) {
  695. show = showBySlug(slug)
  696. uid = userIdOfSession(session)
  697. if (show == null || adultHiddenFor(show, uid)) { return { error = 'no such show' } }
  698. return { ok = true rows = buildRows(show, uid, collapsed) }
  699. }
  700. // tracker#17: one season's episodes, in order — public data, so NO `session` (no page re-mount, no sync: the fast path).
  701. // Refuses a season of an adult title (those pages use showRows above).
  702. on server showSeasonEpisodes(seasonId) {
  703. if (seasonId == null || hlTypeName(seasonId) != 'String') { return { error = 'no such season' } }
  704. season = seasonById(seasonId)
  705. if (season == null) { return { error = 'no such season' } }
  706. show = showById(season.show)
  707. if (show == null || show.adult == true) { return { error = 'no such season' } }
  708. out = []
  709. for (e of episodesOfSeason(season)) { out.push({ id = e.id episodeNumber = e.episodeNumber title = e.title != null ? e.title : '' airDate = airDateOf(e) }) }
  710. return { ok = true episodes = out }
  711. }
  712. on server showToggleEpisode(slug, episodeId, collapsed, withRows, session) {
  713. show = showBySlug(slug)
  714. if (show == null) { return { error = 'no such show' } }
  715. uid = userIdOfSession(session)
  716. if (uid == null) { return { error = 'you are not signed in' } }
  717. if (adultHiddenFor(show, uid)) { return { error = 'no such show' } }
  718. if (toggleWatched(uid, 'episode', episodeId) == null) { return { error = 'could not save the watch' } }
  719. return withRows == true ? { ok = true rows = buildRows(show, uid, collapsed) } : { ok = true }
  720. }
  721. on server showToggleSeason(slug, seasonId, collapsed, withRows, session) {
  722. show = showBySlug(slug)
  723. if (show == null) { return { error = 'no such show' } }
  724. uid = userIdOfSession(session)
  725. if (uid == null) { return { error = 'you are not signed in' } }
  726. if (adultHiddenFor(show, uid)) { return { error = 'no such show' } }
  727. season = seasonById(seasonId)
  728. if (season == null) { return { error = 'no such season' } }
  729. // #23: not all episodes watched → watch them all; all watched → unwatch them all (lib/watches.hl)
  730. if (toggleSeasonWatched(uid, season) == null) { return { error = 'could not save the watch' } }
  731. return withRows == true ? { ok = true rows = buildRows(show, uid, collapsed) } : { ok = true }
  732. }
  733. // #24: a movie's watched check (only a movie: a series is watched by its episodes)
  734. on server showToggleMovie(slug, session) {
  735. show = showBySlug(slug)
  736. if (show == null || show.type != 'movie') { return { error = 'no such movie' } }
  737. uid = userIdOfSession(session)
  738. if (uid == null) { return { error = 'you are not signed in' } }
  739. if (adultHiddenFor(show, uid)) { return { error = 'no such movie' } }
  740. watched = toggleWatched(uid, 'movie', show.id)
  741. if (watched == null) { return { error = 'could not save the watch' } }
  742. return { ok = true watched = watched }
  743. }
  744. on server showToggleFollow(slug, session) {
  745. show = showBySlug(slug)
  746. if (show == null) { return { error = 'no such show' } }
  747. uid = userIdOfSession(session)
  748. if (uid == null) { return { error = 'you are not signed in' } }
  749. follow = toggleFollowed(uid, show.id)
  750. if (follow == null) { return { error = 'could not save the follow' } }
  751. return { ok = true following = follow }
  752. }

Branches

Latest commits

  • b10f00c8tracker#39: double episodes — migrated episodes whose TMDB id TMDB replaced are adopted by their number in the sync (old id -> migratedTmdbId); merge.hl step 3 merges each season's doubles at start (keeper: most watches > synced > first; watches moved/parked; tombstones into mergedEpisodes, nothing deleted); tools/count-duplicate-episodes.hl; gate fixture + paths-m039; live copy 850 -> 0 in 64 s; gates 373/0, 32/0, 52/0mre
  • 8751adb8tracker: report 032mre
  • 9bce1f65tracker mission 032: STATUS gate files + the hour-boundary flakemre
  • 718bfb89tracker#37 (mission 032): /people = everyone, last updated first (updatedAt stamped by the person fill; view built at boot, touched people first at once), photo + name tiles (person colour) with the /movies pagination, /people/<letter> removed; photo = our file, tmdbProfile, a cast/crew entry's profile (in-memory map at boot), else the new 'no photo' placeholder; new cast/crew/created_by people keep tmdbProfile; search people rows with the photo; /settings = the heading only; util.hl sortDesc starts from sorted runs (same result, 105k: 1.6 s -> 0.15 s); gates 369/0, 32/0, 52/0, check-theme 0; README/STATUS/LOGmre
  • 96ba683adeploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the scriptmre
  • eb3b9205tracker: report 031mre
  • 9b5d2e89tracker mission 031: README (What it does, Test: four gates + the #32 checks, Files: theme/, new pages), STATUS (real copy, A/B load, how to repeat, open points), LOGmre
  • 39950e4ctracker#32 (mission 031): the WorldAPI theme (theme/ vendored verbatim from layouts.worldapi.org 85b5654; styles.hl inherits it: accent green-dark, type colours 1-6; own base/header rules, row lines, genre-pill and inverted-button frames removed, the season foldable keeps its line; check-theme 21 -> 0, 4th deploy gate; main actions class primary) and the #32 header (theme AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst: desktop brand, search, Series|Shows|Movies|Genres|People, user icon with Unwatched..Settings, Logout; signed out the ident selector, phone the iD icon dropdown; phone menu in the sidebar overlay; marked entry by :has); /find -> /search/<q>, /genres, /people(/<letter>), /settings; main { ContentFirst { slot } } works around the hl:web one-line slot bug; gates 365/0, 32/0, 52/0, check-theme 0mre
  • a386dc92tracker: reports 029 + 030mre
  • 71e0fd7dtracker missions 029 + 030: README (What it does, Files, gate count), STATUS (real-copy numbers, how to repeat, open points), LOGmre
  • d36ea6eatracker#34 + #35 (mission 030): Follow directly under the poster, as wide as the poster (show.hl, styles.hl); the status pill next to a series' title — TVmaze's status (new tvmazeStatus, stored by the sync's TVmaze merge) else TMDB's, TVmaze Ended + TMDB Canceled = Canceled, inverted (filled, dark text, no border), green running / yellow pending / red canceled / muted ended (shows.hl statusOf); the daily delta asks TVmaze's status of an unfollowed series TVmaze's change list names (dailysync.hl syncRunStep, sync.hl syncTvmazeStatus); the status backfill after the details repair (backfill.hl, jobs.hl statusTick; resumable, 550 ms per TVmaze request); gates 354/0, 32/0, 52/0mre
  • 7d7d4487tracker#33 (mission 029): reduced titles — every title TMDB's details never went through this app (no detailsAt, no tmdbSync) is incomplete (shows.hl isIncomplete; the old tracker's migrated rows passed #26's test: 5,697 non-adult on the live copy, 691 series without seasons); the repair job does the visibly reduced first (shows.hl missingParts), the page completes one on open; a title TMDB has no poster for (The Remaining) shows the placeholder; tools/count-incomplete.hl; gate fixtures stand for synced titles (tmdbSync), tests/seed-reduced.hl + #33 checks; gates 347/0, 32/0, 52/0mre
  • 661c2592tracker: report 028mre
  • 27c916fatracker mission 028: README ("Code order", the new file map), STATUS (counts before/after, tests, how to repeat, open), LOGmre
  • d924f398tracker mission 028: comments name the new files (sync.hl, dailysync.hl, backfill.hl, credits.hl, jobs.hl, images.hl …); tools/ref-params.py + tools/lambda-audit.py also scan lib/ (they globbed the root only), lambda-audit counts a plain `x = p` alias like `let x = p`mre
  • 2e89b968tracker mission 028 (code order) 5/5 let: `let` only where a variable is reassigned — 667 never-reassigned lets became plain declarations (project.hl, lib/, components/, tools/, tests/); kept: 264 in loop bodies (a plain declaration there is 'Cannot reassign' on the 2nd pass), 234 reassigned, 27 whose name is also a member/outer/free name (a plain write would rebind it); tools/let-audit.py decides and fixes (README 'Code order'); tests/realdata-m028.{sh,mjs} = the page-output diff on a real copy; gates 342/0, 32/0, 52/0, real-copy pages identicalmre
  • 54796ff2tracker mission 028 (code order) 4/5 thin faces + last copies: the show page's check/follow faces call lib/watches.hl toggleWatched / toggleSeasonWatched (seasonAllWatched moved there) and lib/follows.hl toggleFollowed; both logins (header selector face, /login/callback) share lib/users.hl userOfCode; todayStr/listOf copies in components and the export readers copied into tools/migrate.hl + tools/old-short-ids.hl now once (lib/util.hl, lib/export.hl); gates 342/0, 32/0, 52/0; old-short-ids output byte-identical, migrate output identicalmre
  • 06b078e3tracker mission 028 (code order) 3/5 project.hl is the map: config, routes, wiring and a feature → file index (914 → 258 lines); the background jobs (daily sync run, backfills, details repair, credits job, merge, short ids, collection seed) moved unchanged into lib/jobs.hl (a class: their state is reassigned every step, a static cannot be; one instance made after the server), the login callback into lib/users.hl, poster/photo serving into lib/images.hl, the /shows/<slug> rule into lib/shows.hl showsMovedPath; route handlers are thin wrappers; gates 342/0, 32/0, 52/0, real-copy pages identicalmre
  • 94716fd2tracker mission 028 (code order) 2/5 util + topics: lib/util.hl holds envOr, storageDir, postersDir, profilesDir, newId, hexDigits, todayStr, dateOr, textOr, hasId, listOr, firstOf, sortDesc once (were copied into up to 5 files); tmdbsync.hl split into tmdb.hl (TMDB/TVmaze requests), sync.hl (one title's sync), sync-helpers.hl, backfill.hl; details.hl split into details.hl, credits.hl, credits-helpers.hl (isIncomplete to shows.hl); search-helpers.hl (words, query, ranking, slugs); collections.hl (the TMDB collection seed, out of franchises.hl); deltasync.hl renamed dailysync.hl; no behaviour change: gates 342/0, 32/0, 52/0, real-copy pages identicalmre
  • 186079b0tracker mission 028 (code order) 1/5 move: every root .hl except project.hl into lib/ (styles.hl into components/), import paths only; gates 342/0, 32/0, 52/0; real-copy pages identicalmre