tracker
All repositories: gitoria
4.2 KB
// components/unwatched.hl — `/my/unwatched` (tracker.worldapi.org#5, moved from `/unwatched` in #8): every already-released episode of a// show the signed-in user follows that they have not watched yet, newest release first. Creator's words:// "/unwatched lists all unwatched episodes of shows followed in release date desc order"; "check icon is// a disc with a check in it" — the SAME check icon and watch logic as the show page (step 4), reused// (not copied) from follows.hl/shows.hl/watches.hl: `watchClassOf`, `watchedSet`, `setWatched` come from// watches.hl, the check icon markup/CSS is the same `button.checkicon` shape/class styles.hl already has.//// A ROW ONLY EVER SHOWS AN UNWATCHED EPISODE, so a click always marks it watched (never toggles back,// unlike the show page's checks) and the row leaves the list — the ticket's own test: "click an// episode's check: it disappears from the list."//// ONE FLAT LIST, rebuilt whole server-side on every click — the same proven-safe shape components/show.hl// uses for exactly the same Hybriel reasons (hybriel#86, hybriel#115/#116: a plain member function that// touches an hl:mpackdb-backed import must be `static` and must only ever be called server-side).parent './main.hl'import { appTitle } from '../lib/app.hl'import { userIdOfSession } from '../lib/users.hl'import { unwatchedToggleOf, unwatchedRowsOf } from '../lib/watches.hl'// ---- 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 ? unwatchedRowsOf(&me) : []hasRows = rows.length > 0noRows = !hasRowsemptyText = signedIn ? 'No unwatched episodes.' : 'Sign in to see the shows you follow.'__title = 'Unwatched — ' + appTitle// HM49: component rules keep the existing selectors and shared theme variables.Style {unwatchedPage {display = 'block'}unwatchedRows {display = 'block'}unwatchedRow {display = 'grid'gridTemplateColumns = '2rem minmax(0, 1fr) auto'alignItems = 'center'gap = '0 .6rem'padding = '.5rem 0'@media {minWidth = '40rem'display = 'flex'}'button.checkicon' {gridRow = 'span 2'}}unwatchedShow {fontWeight = '600'overflowWrap = 'anywhere'padding = '.7rem 0'margin = '-.7rem 0'@media {minWidth = '40rem'flex = 'none'}}unwatchedEpisode {gridColumn = '2 / 4'gridRow = '2'color = 'var(--color-text)'overflowWrap = 'anywhere'@media {minWidth = '40rem'flex = '1'}}unwatchedDate {gridRow = '1'gridColumn = '3'fontSize = '.85rem'color = 'var(--color-text-muted)'fontVariantNumeric = 'tabular-nums'@media {minWidth = '40rem'flex = 'none'}}}View {unwatchedPage {h1 { "Unwatched" }if (noRows) { p { class = "muted" emptyText } }if (hasRows) {unwatchedRows {for (row of rows) {unwatchedRow {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) }}a { Style.unwatchedShow href = row.showHref row.showTitle }unwatchedEpisode { row.episodeLabel }unwatchedDate { row.release }}}}}}}// The client only ever ASSIGNS the `rows` the server already rebuilt — never calls the tainted// local helper itself (components/show.hl's own `on toggleEpisode` follows the same shape, and// the same reason: `unwatchedRowsOf` touches mpackdb-backed imports, so it compiles to nothing on// the client, hybriel#115/#116).on toggleEpisode(episodeId) {if (!signedIn) { return null }r = emit server unwatchedToggle('' + episodeId)if (r == null || r.error != null) { return null }rows = r.rows}// ---- the face (the trailing `session` is always the server's: hybriel#16) ----on server unwatchedToggle(episodeId, session) {uid = userIdOfSession(&session)if (uid == null) { return { error = 'you are not signed in' } }return unwatchedToggleOf(episodeId, uid)}
Branches
Latest commits
- d714ae42Log/status: AP56 closed out, FF1mre
- a429d088Mission FF1mre
- 03bbfba3Log: AP56c causemre
- 24845fe3Log: AP56b result, AP56cmre
- 6a6d71eaLog: gitoria membershipmre
- 8b842dc8Log + CONDUCTOR: gitoria PR switch-onmre
- 6bb7c20estatus: window 2026-11-09mre
- 5db84974Log: Apollo window GO, AP56b started, BS1 copy removedmre
- e84586a7Mission AP56bmre
- 15917f03Record PR workflow rule (gitoria#50)mre
- 942ac995status: paused workers statemre
- 44b934e5log: respawn cleanupmre
- 03a80097Log: Anton GC A/Bmre
- c7cdef62Log: Apollo STOP, workers pausedmre
- d0c083fbLog: usage stopmre
- c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmre
- 1eb6f1a1Missions AP56, BS1mre
- 4871f8adLog: AP52 live on day52, browser gate greenmre
- d9bf2988Merge ap52: day52, tracker#58 server argument, #51 modal close rule, #56 keyed season rowsmre
- c4a60ef2Log: RT52 retest passed, AP52 startedmre