tracker
All repositories: gitoria
32.7 KB
// components/show.hl — a title's own page (tracker.worldapi.org#4): since tracker#21 (mission 068) `/series/:slug`, `/movies/:slug`// and `/shows/:slug` (the last through project.hl showsRoute: a show is rendered there, a series or movie answers 301 to its// own address). tracker#20: the heading is "<Type> | <title>" — Series / Show / Movie in the type's colour (styles.hl// `type-*`), the title white. Creator's words:// "the poster on the left, right of it the title of the show, the genre pills, below the plot summary,// below that the artists just as normal links, separated with comma color red, genres are blue" (the// header) — "then all seasons in reverse order, latest on top, below them collapsable their episodes,// episodes first the round check icon, if the episode was watched by the user looking its solid, if// not its regular, then the episode number, then the title. the last season is not collapsed. click on// the check adds a watch. the season also has a check, if the season is checked or unchecked all its// episodes get checked or unchecked. artists link to /person/<artist-slug> the genre to /genre/<genre-slug>."//// THE ROWS ARE ONE FLAT LIST, not a nested for-loop over seasons > episodes: the vendored build may// still lack the fix for hybriel#86 (a nested for over a reassigned outer list keeps stale inner// cells) — a single-level `for (row of rows)` with a `kind` field, reassigned whole on every click,// is the same proven-safe shape components/main.hl's own header and ident's inbox.hl already use.// `rows` is rebuilt from scratch (seasons/episodes refetched by id, watch rows refetched) on every// toggle — cheap: a show has at most a few dozen episodes per season.//// Mission 047 (the creator, 2026-10-01): a caret at the season header's right edge (down = open, right = collapsed); episode// rows not indented; on a phone the title first, then the poster at full width, then genres/plot/cast; a Follow toggle// 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// from components.hybriel) and writes nothing.//// tracker.worldapi.org#17 (mission 057): the caret points DOWN while a season is closed and UP while it is open. Opening a// season shows SKELETON rows at once (min(episodes, 8), a CSS shimmer, styles.hl) and then its episodes from the face// `showSeasonEpisodes`, which takes NO session: a face with `session` makes hl:web re-mount the whole page on the server and// ship every session-derived member back as a `sync` (WebFramework.hl `inbound`) — that, not the episodes, was most of the// old 250–450 ms (real data). The watched state comes from `watchedEpisodes` (this show's watched episodes per season, rendered// with the page and re-synced after every watch face). Closing is client-only (no request). An ADULT show (only its// followers see it) keeps the session face `showRows`: the public face refuses adult seasons.//// tracker.worldapi.org#12: link icons under the title — the show on TMDB, IMDb, TheTVDB, TVmaze (a movie: TMDB + IMDb),// only for the ids it has (shows.hl externalLinksOf), each in a new tab.//// mission 058: #22 every episode row shows its air date (`release`, 'YYYY-MM-DD' like /my/unwatched; none → empty). #23 a// season's check is DERIVED: solid exactly when every one of its episodes is watched (a season without episodes: its own// season watch) — unchecking one episode turns the season off with the face's answer, checking it again turns it on; the// season click watches all when not all are watched, else unwatches all. #24 a MOVIE's page has its own watched check// (watch `targetType = 'movie'`, target = the title's id; face `showToggleMovie`), signed out → the sign-in modal.//// tracker.worldapi.org#26: an INCOMPLETE title (one a person page added from a filmography — details.hl `needsDetails`) shows// what it has plus skeletons (poster, cast line, season rows for a series) and completes itself WITHOUT a reload: the// invisible `showProbe` (endless short CSS animation — hl:web has no mount hook, the person page's trick) calls the face// `showComplete` until it is done — one step per call (details.hl completeStep: TMDB details + ids + cast; a series' seasons/// episodes in parts; poster, TVmaze) — and the last answer's parts replace the skeletons. No session (no page re-mount); adult// refused.//// tracker.worldapi.org#28: the WHOLE cast and the key crew (details.hl stores them: a series' cast of every season, main cast// first by episode count, then "Guest stars"; crew = Created by / Directed by / Written by / Screenplay / Story / Music). The// cast shows its first `castShown` (20) and a "Show all (N)" toggle, each crew job its first `crewShown` (6) and one "Show all// crew (N)" toggle — CLIENT-SIDE (the rows are all rendered, CSS hides the rest; `castClass`/`crewClass`, no request). Names// link to /person/<slug>; the character in brackets after the name (CSS `attr(data-role)` — one element per name: the SSR's// line breaks inside a wrapper element put a space before the comma).parent './main.hl'import Modal from './modal.hl'import FranchiseWidget from './franchisewidget.hl'import { appTitle } from '../lib/app.hl'import { userIdOfSession, loginHref } from '../lib/users.hl'import { showBySlug, showById, seasonsOfShow, posterName, externalLinksOf, summaryOf, initialCollapsed, genreRowsOf, castShown, castRowsOf, castCountOf, crewRowsOf, crewHiddenOf, crewCountOf, buildRows, openingRows, closedRows, filledRows, franchiseWidgetsOf, pageShowOf, rowsOfSlug, watchedEpisodesOfSlug, slugInfoOf, castOfSlug, crewOfSlug, showRowsOf, showSeasonEpisodesOf, showToggleEpisodeOf, showToggleSeasonOf, showToggleMovieOf, showToggleFollowOf } from '../lib/shows.hl'import { needsDetails, completeStep, completeLine, persistDetails } from '../lib/details.hl'import { textArg } from '../lib/util.hl'import { warmReady, warmText } from '../lib/warm.hl'// tracker#26: the page loads this title's full details on open// the face's work: ONE step of completing the title (details.hl completeStep — a series takes a few; a second viewer drives the// same job or finds it complete); when done, every part of the page that changes — the rows without anyone's watch state (a// title that was incomplete had no episodes to watch)static completedPageOf = (&slug) => {let show = showBySlug(&slug)if (show == null || show.adult == true) { return { error = 'no such show' } }if (needsDetails(&show)) {r = completeStep(&show.id)if (r.retry || r.adult == true) { return { error = r.error != '' ? r.error : 'no such show' } }if (!r.done) { return { done = false steps = r.sum.steps } }if (!r.skipped) {persistDetails()console.log('details on open: ' + completeLine(&show.title, &r.sum))}show = showById(&show.id)}cl = initialCollapsed(seasonsOfShow(&show))pn = posterName(&show)crew = crewRowsOf(&show)cast = castRowsOf(show)return { done = true title = show.title summary = summaryOf(&show) poster = pn genreRows = genreRowsOf(&show) castRows = castcastCount = castCountOf(&cast) castMore = castCountOf(&cast) > castShown crewRows = crew crewCount = crewCountOf(&crew) crewMore = crewHiddenOf(&crew) > 0linkRows = externalLinksOf(&show) collapsed = cl rows = buildRows(&show, null, cl) }}// ---- reactive members -----------------------------------------------------------------------slug = nullsession = nulluserId = userIdOfSession(&session)signedIn = userId != null// SESSION SYNC (mission 047; since hybriel #121/#122, mission 056): a face taking `session` answers with a `sync` of every// member derived from session that reaches an import (here `showRow`, `found`, `following`, `rows`, …), re-derived on the// server with the page's route params but the MOUNT's other state — so client state (`collapsed`) must never derive from// them. `me` stays the plain copy mission 047 introduced.me = userIdshowRow = pageShowOf(&slug, &me)found = showRow != nullnotFound = showRow == null// the Follow toggle: "Follow" = the inverted button (accent text on a surface, no border since tracker#32), "Following" = the// filled one (the theme's `primary`)following = found ? showRow.following : falsefollowClass = following ? 'follow primary' : 'follow inverted'followText = following ? 'Following' : 'Follow'signInHref = loginHref// #24: a movie's watched check (same icon/classes as the episodes); the classes written out, not `watchClassOf` (an import of// the mpackdb-backed watches.hl cannot run in the browser when the member is re-derived there)isMovie = found && showRow.type == 'movie'movieWatched = isMovie ? showRow.movieWatched : falsemovieWatchClass = movieWatched ? 'checkicon solid' : 'checkicon regular'movieWatchText = movieWatched ? 'Watched' : 'Not watched'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.'title = found ? showRow.title : ''// tracker#35: the status pill next to a series' title — TVmaze's status, else TMDB's (shows.hl statusOf); none on a moviestatusText = found ? showRow.statusText : ''hasStatus = statusText != ''// tracker#33: a movie's release date + runtime (movieFactsOf)factsText = found ? showRow.facts : ''hasFacts = factsText != ''statusClass = found ? 'pill ' + (showRow.statusTone == 'running' ? 'success' : (showRow.statusTone == 'pending' ? 'warning' : ((showRow.statusTone == 'canceled' || showRow.statusTone == 'ended') ? 'danger' : 'quiet'))) : 'pill quiet'// tracker#20: "Series | Reacher" — the kind from the slug (pure strings here: they are re-derived in the browser too)slugInfo = slugInfoOf(&slug)pageKind = slugInfo.kindtypeText = pageKind == 'movie' ? 'Movie' : (pageKind == 'show' ? 'Show' : 'Series')typeClass = 'type-word type-' + pageKind// tracker#18: the creator's own text, else TMDB's, else TVmaze's (pageShowOf → shows.hl summaryOf)summary = found && showRow.summary != null ? showRow.summary : ''poster = found ? showRow.poster : nullhasPoster = poster != nullposterUrl = hasPoster ? '/posters/' + poster : ''// mission 060 (tracker.worldapi.org#27): the short id under the poster (none yet while the backfill has not reached it)shortId = found ? showRow.shortId : ''hasShortId = shortId != ''genreRows = found ? showRow.genreRows : []hasGenres = genreRows.length > 0// mission 062: cast + crew from the SLUG (`castOfSlug`, `crewOfSlug`), never from `showRow` — a member derived from the session is// re-derived and re-SENT after every watch/follow click (SESSION SYNC above): The Simpsons' 300 names took 0.7 s per clickcastRows = castOfSlug(&slug)hasCast = castRows.length > 0// tracker#28: "Show all (N)" — the toggles' state is CLIENT state: literals, never derived from `showRow` (session sync)castCount = castCountOf(&castRows)castMore = castCount > castShowncastAllText = 'Show all (' + castCount + ')'castClass = 'collapsed'crewRows = crewOfSlug(&slug)hasCrew = crewRows.length > 0crewCount = crewCountOf(&crewRows)crewMore = crewHiddenOf(&crewRows) > 0crewAllText = 'Show all crew (' + crewCount + ')'crewClass = 'collapsed'linkRows = found ? showRow.linkRows : []franchiseWidgets = found ? franchiseWidgetsOf(&showRow) : []hasLinks = linkRows.length > 0// NOT from `showRow`/`found`: they read the session (via `me`), so a member derived from them is re-derived on the server// after every session face with the MOUNT's state — `collapsed` (client state) would snap back to the initial seasons (mission// 056: the 2nd episode click in a re-opened season did nothing). The season ids of a hidden page are no secret.collapsed = slugInfo.collapsed// mission 062: has this page opened/closed a season (client state) — then a watch face sends its own rows (toggleEpisode)collapsedChanged = falserows = found ? rowsOfSlug(&slug, &me, &collapsed) : []hasRows = rows.length > 0watchedEpisodes = found ? watchedEpisodesOfSlug(&slug, &me) : {}// an adult page (followers only) opens its seasons through the session face `showRows`adultShow = found && showRow.adult == true// tracker#26: incomplete → skeletons + the probe until `showComplete` answeredcompleting = found ? showRow.completing : false// tracker#33: a title TMDB has no poster for (The Remaining) shows the placeholder in the poster's place — the column was empty// but for the short id, the page looked unfinished; while an incomplete title loads, the skeleton insteadposterLoading = completing && !hasPosternoPoster = !hasPoster && !completingcompleteBusy = falseisSeries = found && showRow.type != 'movie'skeletonSeasons = ['1', '2', '3']__title = found ? title + ' — ' + appTitle : appTitle// tracker#41 (mission 037b): the title's own address (og:url in the served head) — under a moved slug (a merged duplicate's, a// 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// has no page-level <link rel="canonical">. From the slug alone (slugInfo), not from the session.canonicalPath = slugInfo.canonical__meta = canonicalPath != '' ? [{ property = 'og:url' content = canonicalPath }] : []// mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'titles'// stage is there this page says so instead of showing half a mapwarming = !warmReady('titles')warmNote = warming ? warmText() : ''// Component styles use the shared theme variables.Style {showPage {display = 'block'}showHeader {display = 'flex'flexDirection = 'column'gap = '.6rem'marginBottom = '1.2rem'@media {minWidth = '40rem'flexDirection = 'row'alignItems = 'flex-start'gap = '1rem'marginBottom = '1.5rem'}}showPoster {display = 'block'width = '100%'img {display = 'block'width = '100%'height = 'auto'borderRadius = 'var(--radius-large)'aspectRatio = '2 / 3'objectFit = 'cover'background = 'var(--color-surface)'}@media {minWidth = '40rem'flex = 'none'width = '10rem'}}showMeta {display = 'contents'overflowWrap = 'anywhere'@media {minWidth = '40rem'display = 'block'flex = '1''min-width' = '0'}}showTitle {order = '-1'display = 'flex'flexWrap = 'wrap'alignItems = 'center'gap = '.4rem .6rem'h1 {flex = '0 1 auto'minWidth = '0'margin = '0'}'.pill' {flex = 'none'}@media {minWidth = '40rem'marginBottom = '1rem'}}'button.follow' {display = 'block'width = '100%'marginTop = '.5rem'padding = '.4rem .8rem'fontSize = '.95rem'}showFacts {flexBasis = '100%'fontSize = '.95rem'color = 'var(--color-text-muted)'}showLinks {order = '-1'display = 'flex'flexWrap = 'wrap'gap = '.4rem'}movieWatch {order = '-1'display = 'flex'alignItems = 'center'gap = '.4rem'@media {minWidth = '40rem'margin = '-.4rem 0 .8rem'}}movieWatchLabel {fontSize = '.95rem'color = 'var(--color-text)'}showGenres {display = 'flex'flexWrap = 'wrap'gap = '.4rem'margin = '.5rem 0'}showSummary {display = 'block'margin = '.5rem 0'fontSize = '.95rem'color = 'var(--color-text)'@media {minWidth = '40rem'fontSize = '1rem'}}showCrew {display = 'block'margin = '.5rem 0'crewLabel {firstChild {marginTop = '0'}}}showCast {display = 'block'margin = '.5rem 0'}castHeading {display = 'block'fontSize = '.75rem'letterSpacing = '.04em'textTransform = 'uppercase'color = 'var(--color-text-muted)'}crewLabel {display = 'block'marginTop = '.35rem'fontSize = '.75rem'letterSpacing = '.04em'textTransform = 'uppercase'color = 'var(--color-text-muted)'}castLabel {display = 'block'margin = '.4rem 0 .1rem'fontSize = '.75rem'letterSpacing = '.04em'textTransform = 'uppercase'color = 'var(--color-text-muted)'}'.artist-link' {color = 'var(--color-type5)'}'.crew-link' {color = 'var(--color-type5)'}'a.artist-link::after' {content = "attr(data-role) ', '"color = 'var(--color-text-muted)'}'a.crew-link::after' {content = "', '"color = 'var(--color-text-muted)'}'a.artist-link.end::after' {content = 'attr(data-role)'}'show-cast.collapsed' {'a.artist-link.cut::after' {content = 'attr(data-role)'}'.more' {display = 'none'}whenAll {display = 'none'}}'a.crew-link.end::after' {content = 'none'}'show-crew.collapsed' {'a.crew-link.cut::after' {content = 'none'}'.more' {display = 'none'}whenAll {display = 'none'}}buttonShowall {display = 'block'margin = '.3rem 0 0'padding = '.15rem 0'fontSize = '.85rem'color = 'var(--color-accent)'background = 'transparent'hover {background = 'transparent'textDecoration = 'underline'}}'show-cast.all' {whenCollapsed {display = 'none'}}'show-crew.all' {whenCollapsed {display = 'none'}}showSeasons {display = 'block'}seasonRow {display = 'flex'alignItems = 'center'gap = '.6rem'padding = '.5rem 0'borderTop = '1px solid ' + 'var(--color-border)' // functional: the season foldable's line'button.checkicon' {margin = '-.3125rem 0'}}buttonSeasonToggle {flex = '1'minWidth = '0'display = 'flex'alignItems = 'center'gap = '.6rem'justifyContent = 'flex-start'padding = '0'color = 'var(--color-text)'background = 'transparent'border = '0'fontWeight = '600'cursor = 'pointer'textAlign = 'left'margin = '-.3125rem 0'}seasonCount {fontWeight = '400'fontSize = '.85rem'color = 'var(--color-text-muted)'}seasonCaret {flex = 'none'alignSelf = 'center'display = 'grid'marginLeft = 'auto'color = 'var(--color-text-muted)'transition = 'transform .15s'svg {display = 'block'fill = 'none'stroke = 'currentColor'strokeWidth = '2'strokeLinecap = 'round'strokeLinejoin = 'round'}}'season-row.expanded' {seasonCaret {transform = 'rotate(180deg)'}}episodeRow {display = 'flex'alignItems = 'center'gap = '.6rem'minHeight = '2.125rem'padding = '0''button.checkicon' {margin = '-.3125rem 0'}}episodeNumber {flex = 'none'width = '1.6rem'color = 'var(--color-text-muted)'fontVariantNumeric = 'tabular-nums'}episodeTitle {flex = '1'minWidth = '0'overflowWrap = 'anywhere'}episodeDate {flex = 'none'fontSize = '.85rem'color = 'var(--color-text-muted)'fontVariantNumeric = 'tabular-nums'}skeletonRow {display = 'flex'alignItems = 'center'gap = '.6rem'minHeight = '2.125rem'padding = '0'}skeletonCheck {display = 'block'borderRadius = 'var(--radius-small)'background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'backgroundSize = '400% 100%'animation = 'tracker-shimmer 1.4s linear infinite'flex = 'none'width = '1.375rem'height = '1.375rem'borderRadius = '50%'margin = '0 .6875rem'}skeletonNumber {display = 'block'borderRadius = 'var(--radius-small)'background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'backgroundSize = '400% 100%'animation = 'tracker-shimmer 1.4s linear infinite'flex = 'none'width = '1.6rem'height = '1rem'}skeletonTitle {display = 'block'borderRadius = 'var(--radius-small)'background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'backgroundSize = '400% 100%'animation = 'tracker-shimmer 1.4s linear infinite'flex = '1'maxWidth = '60%'height = '1rem'}'skeleton-row:nth-of-type(even)' {skeletonTitle {maxWidth = '42%'}}skeletonPoster {display = 'block'borderRadius = 'var(--radius-large)'background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'backgroundSize = '400% 100%'animation = 'tracker-shimmer 1.4s linear infinite'width = '100%'aspectRatio = '2 / 3'}skeletonCast {display = 'block'borderRadius = 'var(--radius-large)'background = 'linear-gradient(90deg, ' + 'var(--color-surface)' + ' 35%, ' + 'var(--color-border)' + ' 50%, ' + 'var(--color-surface)' + ' 65%)'backgroundSize = '400% 100%'animation = 'tracker-shimmer 1.4s linear infinite'width = '70%'height = '1rem'margin = '.5rem 0'}showLoading {display = 'block'marginTop = '1rem'}showProbe {position = 'fixed'left = '0'top = '0'width = '1px'height = '1px'opacity = '0'pointerEvents = 'none'animation = 'tracker-person-tick .1s linear infinite'}'@keyframes tracker-shimmer' {'from' {backgroundPosition = '100% 0'}to {backgroundPosition = '0% 0'}}}View {showPage {if (warming) { p { id = "warming" class = "message banner" warmNote } }if (notFound) {article { class = "main"h1 { "Not found" }p { "This show doesn't exist." }}}if (found) {showHeader {showPoster {if (hasPoster) { img { src = posterUrl alt = title } }if (noPoster) { img { class = "no-poster" src = "/posters/none" alt = "no poster" } }if (posterLoading) { skeletonPoster { "aria-hidden" = "true" } }// tracker#34: Follow directly under the poster, as wide as the poster (creator: "the follow button should go below// the picture … and expand to the size o the poster")button { id = "follow" type = "button" class = followClass followText on click(e) { emit toggleFollow(e) } }if (hasShortId) { shortIdLabel { id = "shortid" title = "Short id" shortId } }}showMeta {showTitle {h1 { class = "typed" typeWord { class = typeClass typeText } typeSep { "|" } typeName { title } }if (hasStatus) { span { class = statusClass statusText } }if (hasFacts) { showFacts { id = "moviefacts" factsText } }}if (isMovie) {movieWatch {button { id = "moviewatch" type = "button" class = movieWatchClass "aria-label" = "mark movie watched"svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"circle { cx = "12" cy = "12" r = "10" }path { d = "M7 12.5 L10.5 16 L17 8.5" }}on click(e) { emit toggleMovie(e) }}movieWatchLabel { movieWatchText }}}if (hasLinks) {showLinks {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 } }}}// mission 025: the franchise widget right under the title/poster block — on a phone (showMeta dissolves, see styles.hl)// after the poster and before the genres, plot and cast; from 40rem in the right column under the titleFranchiseWidget { widgets = franchiseWidgets }if (hasGenres) {showGenres {for (g of genreRows) { a { class = "pill type-4 genre-pill" href = g.href g.name } }}}showSummary { summary }if (hasCrew) {showCrew { class = crewClassfor (r of crewRows) {if (r.isLabel) { crewLabel { r.text } }if (r.isPerson) { a { class = r.itemClass href = r.href r.name } }}if (crewMore) {button { id = "crewtoggle" type = "button" Style.buttonShowall class = "quiet"whenCollapsed { crewAllText }whenAll { "Show less" }on click(e) { emit toggleCrewAll(e) }}}}}if (hasCast) {showCast { class = castClasscastHeading { "Cast" }for (c of castRows) {if (c.isLabel) { castLabel { class = c.itemClass c.text } }if (c.isPerson) { a { class = c.itemClass href = c.href "data-role" = c.roleText c.name } }}if (castMore) {button { id = "casttoggle" type = "button" Style.buttonShowall class = "quiet"whenCollapsed { castAllText }whenAll { "Show less" }on click(e) { emit toggleCastAll(e) }}}}}if (completing) { skeletonCast { "aria-hidden" = "true" } }}}if (completing) {showLoading { id = "showloading" "aria-busy" = "true"if (isSeries) {for (k of skeletonSeasons) {skeletonRow { "aria-hidden" = "true"skeletonCheck { }skeletonTitle { }}}}showProbe { "aria-hidden" = "true" on animationiteration(e) { emit completeTick(e) } }}}if (hasRows) {showSeasons {for (row of rows) {if (row.isSeason) {seasonRow { class = row.rowClassbutton { type = "button" class = row.watchClass value = row.id "aria-label" = "mark season watched"svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"circle { cx = "12" cy = "12" r = "10" }path { d = "M7 12.5 L10.5 16 L17 8.5" }}on click(e) { emit toggleSeason(row.id) }}button { type = "button" Style.buttonSeasonToggle value = row.idseasonLabel { row.label }seasonCount { row.episodeCountText }seasonCaret { "aria-hidden" = "true"svg { viewBox = "0 0 24 24" width = "20" height = "20"path { d = "M6 9 L12 15 L18 9" }}}on click(e) { emit toggleCollapse(row.id) }}}}if (row.isEpisode) {episodeRow {button { type = "button" class = row.watchClass value = row.id "aria-label" = "mark episode watched"svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"circle { cx = "12" cy = "12" r = "10" }path { d = "M7 12.5 L10.5 16 L17 8.5" }}on click(e) { emit toggleEpisode(row.id) }}episodeNumber { row.episodeNumber }episodeTitle { row.title }episodeDate { row.airDate }}}if (row.isSkeleton) {skeletonRow { "aria-hidden" = "true"skeletonCheck { }skeletonNumber { }skeletonTitle { }}}}}}Modal { id = "signin" title = "Sign in"p { signInText }footer {button { type = "button" value = "close" "Close" }a { id = "signin-link" class = "button primary" href = signInHref "Sign in with ident" }}}}}}// Every rebuild of `rows` happens SERVER-SIDE, never by calling `buildRows` from a client handler:// a member function whose body reaches an hl:mpackdb-backed import (seasonsOfShow, episodesOfSeason,// watchesOfUser, …) compiles to nothing on the client (no case ever assigns it — a genuine Hybriel// gap, filed under `issues`) even though the client bundle still calls it, so `this.buildRows(...)`// throws "not a function" in the browser. The client here only ever ASSIGNS the `rows` the server// already built (`rows = r.rows`) — never calls a tainted local helper itself. `slug` goes along so// the face can refetch the show without depending on implicit access to a sibling member.//// tracker#17: opening shows the skeleton rows BEFORE the request; the answer replaces them unless the season was closed// meanwhile (then nothing). An error closes the season again. Closing never asks the server.on toggleCollapse(seasonId) {collapsedChanged = truem = collapsedif (collapsed[seasonId] != true) {m[seasonId] = truecollapsed = mrows = closedRows(&rows, &seasonId)return null}m[seasonId] = falsecollapsed = mrows = openingRows(&rows, seasonId)if (adultShow) {a = emit server showRows(slug, collapsed)if (collapsed[seasonId] == true) { return null }if (a == null || a.error != null) { m[seasonId] = true collapsed = m rows = closedRows(&rows, &seasonId) return null }rows = a.rowsreturn null}r = emit server showSeasonEpisodes('' + seasonId)if (collapsed[seasonId] == true) { return null }if (r == null || r.error != null) { m[seasonId] = true collapsed = m rows = closedRows(&rows, &seasonId) return null }rows = filledRows(&rows, seasonId, &r.episodes, watchedEpisodes)}// tracker#26: the probe's tick — `showComplete` step by step until `done` (once per page: `completeBusy`; other requests are// served between two calls); the last answer replaces the skeletons. A lost answer (null) lets the next tick go on where the// server is; an error (TMDB down, adult) ends the loading and keeps what the page has.on completeTick(e) {if (completeBusy || !completing) { return null }completeBusy = trues = sluglet r = emit server showComplete(s)while (r != null && r.error == null && r.done != true && slug == s) { r = emit server showComplete(s) }completeBusy = falseif (r == null || slug != s) { return null }if (r.error != null) { completing = false return null }title = r.titlesummary = r.summaryposter = r.postergenreRows = r.genreRowscastRows = r.castRowscastCount = r.castCountcastMore = r.castMorecastAllText = 'Show all (' + r.castCount + ')'crewRows = r.crewRowscrewCount = r.crewCountcrewMore = r.crewMorecrewAllText = 'Show all crew (' + r.crewCount + ')'linkRows = r.linkRowscollapsed = r.collapsedcollapsedChanged = truerows = r.rowscompleting = false}// tracker#28: the cast / crew "Show all" toggles — client-only, no request (CSS shows the hidden names)on toggleCastAll(e) {castClass = castClass == 'all' ? 'collapsed' : 'all'}on toggleCrewAll(e) {crewClass = crewClass == 'all' ? 'collapsed' : 'all'}// signed out: the modal, nothing is sent// mission 062: the new `rows` come with the SAME ack as the session sync (SESSION SYNC above: `rows` derives from the session) —// 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// (`collapsedChanged`, or a completed title); else they came twice (a second buildRows + 14 kB on The Simpsons: ~40 ms per click)on toggleEpisode(episodeId) {if (!signedIn) { document.getElementById('signin').showModal() return null }r = emit server showToggleEpisode(slug, '' + episodeId, collapsed, collapsedChanged)if (r == null || r.error != null) { return null }if (r.rows != null) { rows = r.rows }}on toggleSeason(seasonId) {if (!signedIn) { document.getElementById('signin').showModal() return null }r = emit server showToggleSeason(slug, '' + seasonId, collapsed, collapsedChanged)if (r == null || r.error != null) { return null }if (r.rows != null) { rows = r.rows }}// #24: the movie's own check — signed out the modal, nothing senton toggleMovie(e) {if (!signedIn) { document.getElementById('signin').showModal() return null }r = emit server showToggleMovie(slug)if (r == null || r.error != null) { return null }movieWatched = r.watchedmovieWatchClass = r.watched ? 'checkicon solid' : 'checkicon regular'movieWatchText = r.watched ? 'Watched' : 'Not watched'}on toggleFollow(e) {if (!signedIn) { document.getElementById('signin').showModal() return null }r = emit server showToggleFollow(slug)if (r == null || r.error != null) { return null }following = r.followingfollowClass = r.following ? 'follow primary' : 'follow inverted'followText = r.following ? 'Following' : 'Follow'}// ---- the faces (the trailing `session` is always the server's: hybriel#16) ----// tracker#26: complete an incomplete title and answer the page's parts — public data, NO session (no page re-mount)on server showComplete(slug) {return completedPageOf(textArg(&slug))}// every row for these open/closed seasons — only an ADULT show's page still uses it (its followers; tracker#17)on server showRows(slug, collapsed, session) {uid = userIdOfSession(&session)return showRowsOf(slug, collapsed, uid)}// tracker#17: one season's episodes, in order — public data, so NO `session` (no page re-mount, no sync: the fast path).// Refuses a season of an adult title (those pages use showRows above).on server showSeasonEpisodes(seasonId) {return showSeasonEpisodesOf(seasonId)}on server showToggleEpisode(slug, episodeId, collapsed, withRows, session) {uid = userIdOfSession(&session)return showToggleEpisodeOf(slug, episodeId, collapsed, withRows, uid)}on server showToggleSeason(slug, seasonId, collapsed, withRows, session) {uid = userIdOfSession(&session)return showToggleSeasonOf(slug, seasonId, collapsed, withRows, uid)}// #24: a movie's watched check (only a movie: a series is watched by its episodes)on server showToggleMovie(slug, session) {uid = userIdOfSession(&session)return showToggleMovieOf(slug, uid)}on server showToggleFollow(slug, session) {uid = userIdOfSession(&session)return showToggleFollowOf(slug, uid)}
Branches
Latest commits
- 0eab858fRead only catalog date fields during the episode boot scanmre
- cb78a1a0HM65 report missing heap diagnostic package with repromre
- 89606a5cHM65 briefmre
- 096ce0d4log: DP69 live on day48mre
- b3d8a80bDP69 brief, RV48 mergedmre
- ce6d7d32Merge rv48: Hybriel day48mre
- 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
- 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
- 4a802ae7status: RV48 runningmre
- 0a5412b6RV48 brief, day48 outmre
- 56665efelog: CB69 mergedmre
- 05448a98Merge cb69-imports: appTitle in a dependency-free topicmre
- e55b379dKeep shared app title independent of the route import graphmre
- 9a99659blog: hybriel#334, batch waits for day48mre
- 85fa6c9blog: CB68 result, CB69 startedmre
- 2f07c1b7log: DP68 boot gate failed, CB68mre
- 9652782dlog: HM59 merged, DP68 startedmre
- 29867a75Merge hm59-logic: tracker#59 page logic moved to libmre
- f7bfe90bMove remaining page builders into their topicsmre
- 7c3991f9log: day46 from Antonmre