tracker
All repositories: gitoria
4.1 KB
// components/schedule.hl — `/my/schedule` (tracker.worldapi.org#6, moved from `/schedule` in #8): every episode of a show the signed-in// user follows that is not yet released, soonest first. Creator's words: "/schedule has a similar list// without check icons for he upcoming episodes of shows followed". Same row shape as /unwatched (step 5)// minus the check icon and minus any click handling — this page is read-only, so it needs no `on server`// face at all. Reused (not copied) from follows.hl/shows.hl: `followedShowIds`, `cardOf`, `episodeRowsOf`// — the same functions /unwatched already imports.//// Upcoming = release date strictly AFTER today (the architect's reading of the ticket: "the creator named// the order only for /unwatched" — /unwatched is release <= today, so the natural complement here is// release > today; an episode releasing today already belongs to /unwatched once watched state is added).parent './main.hl'import { appTitle } from '../project.hl'import { userIdOfSession } from '../lib/users.hl'import { followedShowIds } from '../lib/follows.hl'import { cardOf, episodeRowsOf, episodeCode } from '../lib/shows.hl'import { todayStr } from '../lib/util.hl'// ---- pure helpers (static: an mpackdb-backed helper must be `static` to stay callable outside its// own initializer, hybriel#115/#116 — see components/unwatched.hl's header comment) --------------// Insert once into the caller's list; equal release dates retain the old reverse-insertion order.static insertByReleaseAsc = (&sorted, &row) => {let low = 0let high = sorted.lengthwhile (low < high) {middle = (low + high - (low + high) % 2) / 2if (row.release <= sorted[middle].release) { high = middle }else { low = middle + 1 }}sorted.splice(low, 0, row)return null}static scheduleRowsOf = (&userId) => {if (userId == null) { return [] }today = todayStr()out = []// tracker#30 (mission 025): the slim cached card + episode rows per followed title (shows.hl), no record fetched per loadfor (sid of followedShowIds(&userId)) {c = cardOf(&sid)if (c != null) {for (e of episodeRowsOf(&sid)) {upcoming = e.release != null && e.release > todayif (upcoming) {insertByReleaseAsc(&out, {id = e.id showTitle = c.titleYear showHref = c.hrefepisodeLabel = episodeCode(&e.s, &e.e) + ' · ' + e.titlerelease = e.release})}}}}return out}// ---- reactive members -----------------------------------------------------------------------session = nulluserId = userIdOfSession(&session)signedIn = userId != null// a plain copy of userId for `rows` (mission 047: session sync, see components/show.hl `me`)me = userIdrows = signedIn ? scheduleRowsOf(&me) : []hasRows = rows.length > 0noRows = !hasRowsemptyText = signedIn ? 'No upcoming episodes.' : 'Sign in to see the shows you follow.'__title = 'Schedule — ' + appTitle// HM49: component rules keep the existing selectors and shared theme variables.Style {schedulePage {display = 'block'}scheduleRows {display = 'block'}scheduleRow {display = 'grid'gridTemplateColumns = 'minmax(0, 1fr) auto'alignItems = 'center'gap = '0 .6rem'padding = '.5rem 0'@media {minWidth = '40rem'display = 'flex'}}scheduleShow {fontWeight = '600'overflowWrap = 'anywhere'padding = '.7rem 0'margin = '-.7rem 0'@media {minWidth = '40rem'flex = 'none'}}scheduleEpisode {gridColumn = '1 / 3'gridRow = '2'color = 'var(--color-text)'overflowWrap = 'anywhere'@media {minWidth = '40rem'flex = '1'}}scheduleDate {gridRow = '1'gridColumn = '2'fontSize = '.85rem'color = 'var(--color-text-muted)'fontVariantNumeric = 'tabular-nums'@media {minWidth = '40rem'flex = 'none'}}}View {schedulePage {h1 { "Schedule" }if (noRows) { p { class = "muted" emptyText } }if (hasRows) {scheduleRows {for (row of rows) {scheduleRow {a { Style.scheduleShow href = row.showHref row.showTitle }scheduleEpisode { row.episodeLabel }scheduleDate { row.release }}}}}}}
Branches
Latest commits
- c1a8d074log: correct timesmre
- 5827eba9log: HM57 merged, HM59 startedmre
- d1a91be9Merge hm57-let: tracker#57 let only for reassigned namesmre
- a404ed75Report HM57 audit, gates and integration notesmre
- 1dcb87a7Use plain declarations for unchanged bindingsmre
- b90395e3log: HM51 mergedmre
- 9888d076Merge hm51-classes: tracker#51 views use Style referencesmre
- 4399bc2fReference remaining component-owned root Style rulesmre
- 9edcc2dflog: #58 live, HM57 startedmre
- 73fa20ddMerge hm49b-styles: tracker#49 rest of the component stylesmre
- aed12917Reference owned Style rules in genres and searchmre
- 14195720log: HM49B done, HM51 startedmre
- 78ee6b56Move remaining component styles into Style blocksmre
- 7f04de33log: HM49Bmre
- 00616cf3log: #49 batch merged, DP67 startedmre
- d7232e86Merge hm49-styles: tracker#49 first batch of component stylesmre
- 079f376dMove seven components' styles into Style blocksmre
- 17d66feelog: #58 mergedmre
- 69a6640bMerge hm58-map: tracker#58 project.hl only the mapmre
- a85f7900Move route logic out of the project mapmre