tracker
All repositories: gitoria
8.0 KB
// components/person.hl — `/person/<slug>` (tracker.worldapi.org#16): a person's page — name, photo, born/died, bio, then// the filmography (poster, title, year, role; series and movies, newest first, each → its page: /series/, /shows/ or /movies/<slug>).// The show page's cast and the search's people link here. tracker.worldapi.org#20: the heading is "Person | <name>" (the type word// in the person colour, styles.hl `type-*`), each row's kind word in its type's colour.//// FIRST VISIT of a person we don't have complete yet (people.hl `needsFill`): the page shows what we have plus "Loading// filmography…" and fills in WITHOUT a reload — the face `personFill` does ONE step per call (1st: TMDB person + credits,// then 40 titles per call, the last marks the person complete) and the handler calls it until it says `done`; between two// calls hl:web serves every other request. hl:web gives a page no "mounted" hook, so the first call comes from a tick like// the shell's offline probe (components/main.hl): the invisible `personProbe` runs an endless short CSS animation// (styles.hl) and its `animationiteration` starts the fill (once — `busy`). A failed fill shows why; the next visit tries again.//// mission 060 (tracker.worldapi.org#27): the person's short id (shortids.hl) under the photo (no photo: under the facts).//// HYBRIEL TRAPS: no session here at all (the fill needs no sign-in — one TMDB request per person, ever), so hybriel#121/#122// can't bite; every list is replaced whole. Helpers are LOCAL statics (an imported mpackdb helper straight in a member's// initializer came back wrong after a client-side navigation — components/show.hl `followingOf`).parent './main.hl'import { appTitle } from '../lib/app.hl'import { personBySlug, personFillStep, pageOf } from '../lib/people.hl'import { warmReady, warmText } from '../lib/warm.hl'import { textArg } from '../lib/util.hl'// everything the page shows for one slug// one fill step for the person of this slug; the last answers the whole page againstatic fillOf = (&slug) => {p = personBySlug(&slug)if (p == null) { return { error = 'no such person' } }r = personFillStep(&p.id)if (r.error != null) { return { error = r.error } }if (r.done != true) { return { done = false pos = r.pos total = r.total } }out = pageOf(&slug)out.done = trueout.added = r.addedreturn out}// ---- reactive members -----------------------------------------------------------------------slug = nullstart = pageOf(&slug)found = start.foundnotFound = !start.foundname = start.namephotoUrl = start.photoUrlhasPhoto = photoUrl != ''// mission 060 (tracker.worldapi.org#27): the short id under the photo — no photo: under the name and factsshortId = start.shortIdhasShortId = shortId != ''shortIdInMeta = hasShortId && !hasPhotoborn = start.bornhasBorn = born != ''died = start.diedhasDied = died != ''bio = start.biohasBio = bio != ''bioClass = 'short'rows = start.rowshasRows = rows.length > 0loading = start.loadingloadText = 'Loading filmography…'busy = falsefillError = ''hasFillError = fillError != ''noRows = found && !loading && rows.length == 0 && fillError == ''__title = found ? name + ' — ' + appTitle : appTitle// mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'// stage is there this page says so instead of showing half a mapwarming = !warmReady('all')warmNote = warming ? warmText() : ''// Component styles use the shared theme variables.Style {personMeta {display = 'block'minWidth = '0'overflowWrap = 'anywhere'shortIdLabel {textAlign = 'left'}}personPage {display = 'block'}personHeader {display = 'flex'alignItems = 'flex-start'gap = '.8rem'marginBottom = '1rem'@media {minWidth = '40rem'gap = '1rem'}}personPhoto {flex = 'none'display = 'block'width = '6rem'img {display = 'block'width = '100%'height = 'auto'aspectRatio = '2 / 3'objectFit = 'cover'borderRadius = 'var(--radius-large)'background = 'var(--color-surface)'}@media {minWidth = '40rem'width = '10rem'}}personFact {display = 'block'fontSize = '.95rem'color = 'var(--color-text-muted)'}personBio {display = 'block'margin = '0 0 1rem'fontSize = '.95rem'whiteSpace = 'pre-line'cursor = 'pointer'}'person-bio.short' {display = '-webkit-box'overflow = 'hidden''-webkit-line-clamp' = '4''-webkit-box-orient' = 'vertical'}personLoading {display = 'block'padding = '.6rem 0'color = 'var(--color-text-muted)'animation = 'tracker-person-pulse 1.2s ease-in-out infinite alternate'}personProbe {position = 'fixed'left = '0'top = '0'width = '1px'height = '1px'opacity = '0'pointerEvents = 'none'animation = 'tracker-person-tick .1s linear infinite'}'@keyframes tracker-person-pulse' {'from' {opacity = '1'}to {opacity = '.45'}}filmRows {display = 'block'}aFilmRow {display = 'flex'alignItems = 'center'gap = '.8rem'padding = '.45rem 0'color = 'var(--color-text)'hover {textDecoration = 'none'filmTitle {color = 'var(--color-accent)'}}}filmRole {fontSize = '.85rem'color = 'var(--color-type5)'overflowWrap = 'anywhere'empty {display = 'none'}}filmYear {empty {display = 'none'}}}View {personPage { "data-loading" = loadingif (warming) { p { id = "warming" class = "message banner" warmNote } }if (notFound) {article { class = "main"h1 { "Not found" }p { "This person doesn't exist." }}}if (found) {personHeader {if (hasPhoto) {personPhoto {img { src = photoUrl alt = name }if (hasShortId) { shortIdLabel { id = "shortid" title = "Short id" shortId } }}}personMeta {h1 { class = "typed" typeWord { class = "type-word type-person" "Person" } typeSep { "|" } typeName { name } }if (hasBorn) { personFact { class = "born" born } }if (hasDied) { personFact { class = "died" died } }if (shortIdInMeta) { shortIdLabel { id = "shortid" title = "Short id" shortId } }}}// a SHORT bio: four lines (styles.hl), a click shows all of itif (hasBio) { personBio { class = bioClass title = "Show all" bio on click(e) { emit toggleBio(e) } } }h2 { class = "film-heading" "Filmography" }if (loading) {personLoading { id = "personloading" loadTextpersonProbe { "aria-hidden" = "true" on animationiteration(e) { emit fillTick(e) } }}}if (hasFillError) { p { id = "fillerror" class = "message" fillError } }if (noRows) { p { id = "nofilms" class = "muted" "No shows or movies known." } }if (hasRows) {filmRows {for (row of rows) {a { Style.aFilmRow href = row.hrefimg { class = "film-poster" src = row.posterUrl alt = "" loading = "lazy" }filmText {filmTitle { row.title }filmMeta {filmYear { row.year }filmType { class = row.typeClass row.typeLabel }}filmRole { row.role }}}}}}}}}// the probe's tick: the fill, step by step, until done (once per page — `busy`); a lost answer (null) just waits for the// next tick and goes on where the server ison fillTick(e) {if (busy || !loading) { return null }busy = trues = sluglet r = emit server personFill(s)while (r != null && r.error == null && r.done != true && slug == s) {loadText = 'Loading filmography… ' + r.pos + ' of ' + r.total + ' titles'r = emit server personFill(s)}busy = falseif (r == null || slug != s) { return null }if (r.error != null) {loading = falsefillError = 'Could not load the filmography: ' + r.errorreturn null}photoUrl = r.photoUrlborn = r.borndied = r.diedbio = r.biorows = r.rowsloading = false}on toggleBio(e) {bioClass = bioClass == 'short' ? 'full' : 'short'}// ---- the face (a unique name: hl:web dispatches faces by name across all files) ----on server personFill(slug) {return fillOf(textArg(&slug))}
Branches
Latest commits
- 62a5f6c7HM67 brief, HM66 mergedmre
- b32b8440Merge hm66-catalogindex: packed catalog indexmre
- 2db0f7adReport HM66 heap measurements and validationmre
- 6ce15623Pack catalog lists and membership maps in UTF-8 bytesmre
- 71134e21HM66 briefmre
- ed4cbab2status timemre
- e982c26dlog: HM65 mergedmre
- 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre
- 07a5c883HM65 report measured field projection and complete validationmre
- 0eab858fRead only catalog date fields during the episode boot scanmre
- d3179273log: HM65 hl:heap vendoringmre
- 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