tracker
All repositories: gitoria
3.1 KB
// components/schedule.hl — `/schedule` (tracker.worldapi.org#6): 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`, `showById`,// `seasonsOfShow`, `episodesOfSeason` — 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 '../users.hl'import { followedShowIds } from '../follows.hl'import { showById, seasonsOfShow, episodesOfSeason } from '../shows.hl'import { now, timestamp } from 'hl:time'// ---- 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) --------------static todayStr = () => { return timestamp(now()).slice(0, 10) }// insertion sort, hand-written (no list sort(), hybriel#1) — soonest release firststatic insertByReleaseAsc = (sorted, row) => {let out = []let inserted = falsefor (x of sorted) {if (!inserted && row.release <= x.release) { out.push(row) inserted = true }out.push(x)}if (!inserted) { out.push(row) }return out}static scheduleRowsOf = (userId) => {if (userId == null) { return [] }let today = todayStr()let out = []for (sid of followedShowIds(userId)) {let show = showById(sid)if (show != null) {for (s of seasonsOfShow(show)) {for (e of episodesOfSeason(s)) {let upcoming = e.release != null && e.release > todayif (upcoming) {let title = e.title != null ? e.title : ''out = insertByReleaseAsc(out, {id = e.id showTitle = show.title showHref = '/shows/' + show.urlSegmentepisodeLabel = 'Ep ' + e.episodeNumber + ' · ' + titlerelease = e.release})}}}}}return out}// ---- reactive members -----------------------------------------------------------------------session = nulluserId = userIdOfSession(session)signedIn = userId != nullrows = signedIn ? scheduleRowsOf(userId) : []hasRows = rows.length > 0noRows = !hasRowsemptyText = signedIn ? 'No upcoming episodes.' : 'Sign in to see the shows you follow.'__title = 'Schedule — ' + appTitleView {schedulePage {h1 { "Schedule" }if (noRows) { p { class = "muted" emptyText } }if (hasRows) {scheduleRows {for (row of rows) {scheduleRow {a { class = "schedule-show" href = row.showHref row.showTitle }scheduleEpisode { row.episodeLabel }scheduleDate { row.release }}}}}}}
Branches
- mainmain branch
Latest commits
- 44b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre
- 91c9fc8ctracker#5: /unwatched — unwatched released episodes of followed shows, newest firstmre
- a97c0295tracker#4: show page /shows/:slug (header, seasons, episodes, watch checks) + tools/relink-episode-seasons.hlmre
- 05f407c5tracker: no border on any button except inverted ones (Log out, ident status and identities too); header brand weight 100mre
- 17375427tracker#2: tools/migrate.hl + tools/verify.hl — old MongoDB data into mpackdb with new idsmre
- 31aac936tracker#3: no border on the header and on filled buttons; inverted buttons keep theirsmre
- 2ad9d29ctracker#1: login exactly like calendar (identity selector in the header, empty homepage)mre
- 3691e176tracker#1: empty tracker with the ident login (state of 2026-09-27)mre