gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitae905f15ae905f15Merge t36a: tracker#36 apply rechecks, reportmreae905f15/components/schedule.hl

3.2 KB

  1. // components/schedule.hl — `/my/schedule` (tracker.worldapi.org#6, moved from `/schedule` in #8): every episode of a show the signed-in
  2. // user follows that is not yet released, soonest first. Creator's words: "/schedule has a similar list
  3. // without check icons for he upcoming episodes of shows followed". Same row shape as /unwatched (step 5)
  4. // minus the check icon and minus any click handling — this page is read-only, so it needs no `on server`
  5. // face at all. Reused (not copied) from follows.hl/shows.hl: `followedShowIds`, `cardOf`, `episodeRowsOf`
  6. // — the same functions /unwatched already imports.
  7. //
  8. // Upcoming = release date strictly AFTER today (the architect's reading of the ticket: "the creator named
  9. // the order only for /unwatched" — /unwatched is release <= today, so the natural complement here is
  10. // release > today; an episode releasing today already belongs to /unwatched once watched state is added).
  11. parent './main.hl'
  12. import { appTitle } from '../project.hl'
  13. import { userIdOfSession } from '../lib/users.hl'
  14. import { followedShowIds } from '../lib/follows.hl'
  15. import { cardOf, episodeRowsOf, episodeCode } from '../lib/shows.hl'
  16. import { todayStr } from '../lib/util.hl'
  17. // ---- pure helpers (static: an mpackdb-backed helper must be `static` to stay callable outside its
  18. // own initializer, hybriel#115/#116 — see components/unwatched.hl's header comment) --------------
  19. // Insert once into the caller's list; equal release dates retain the old reverse-insertion order.
  20. static insertByReleaseAsc = (&sorted, &row) => {
  21. let low = 0
  22. let high = sorted.length
  23. while (low < high) {
  24. middle = (low + high - (low + high) % 2) / 2
  25. if (row.release <= sorted[middle].release) { high = middle }
  26. else { low = middle + 1 }
  27. }
  28. sorted.splice(low, 0, row)
  29. return null
  30. }
  31. static scheduleRowsOf = (&userId) => {
  32. if (userId == null) { return [] }
  33. today = todayStr()
  34. out = []
  35. // tracker#30 (mission 025): the slim cached card + episode rows per followed title (shows.hl), no record fetched per load
  36. for (sid of followedShowIds(&userId)) {
  37. let c = cardOf(&sid)
  38. if (c != null) {
  39. for (e of episodeRowsOf(&sid)) {
  40. let upcoming = e.release != null && e.release > today
  41. if (upcoming) {
  42. insertByReleaseAsc(&out, {
  43. id = e.id showTitle = c.titleYear showHref = c.href
  44. episodeLabel = episodeCode(&e.s, &e.e) + ' · ' + e.title
  45. release = e.release
  46. })
  47. }
  48. }
  49. }
  50. }
  51. return out
  52. }
  53. // ---- reactive members -----------------------------------------------------------------------
  54. session = null
  55. userId = userIdOfSession(&session)
  56. signedIn = userId != null
  57. // a plain copy of userId for `rows` (mission 047: session sync, see components/show.hl `me`)
  58. me = userId
  59. rows = signedIn ? scheduleRowsOf(&me) : []
  60. hasRows = rows.length > 0
  61. noRows = !hasRows
  62. emptyText = signedIn ? 'No upcoming episodes.' : 'Sign in to see the shows you follow.'
  63. __title = 'Schedule — ' + appTitle
  64. View {
  65. schedulePage {
  66. h1 { "Schedule" }
  67. if (noRows) { p { class = "muted" emptyText } }
  68. if (hasRows) {
  69. scheduleRows {
  70. for (row of rows) {
  71. scheduleRow {
  72. a { class = "schedule-show" href = row.showHref row.showTitle }
  73. scheduleEpisode { row.episodeLabel }
  74. scheduleDate { row.release }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }

Branches

Latest commits

  • ae905f15Merge t36a: tracker#36 apply rechecks, reportmre
  • 796bfaceT36A: report validated fixes, failed live SSH check and verified rollbackmre
  • 55257852log: #53 live, #56 mergedmre
  • 78b39f1bMerge hm56-rows: tracker#56 list builders insert oncemre
  • 7aea52batmdb fix: protect owners without slugs and record passing gatesmre
  • 9b3c2559tmdb fix: revalidate planned identities and reserve target idsmre
  • 6da612fclog: T36A tool defectmre
  • d56ee0daT36A: report unsafe TMDB apply revalidation and stop before livemre
  • 08e55255log: HM56 done, T36A startedmre
  • 91bcdf0eAvoid per-row list copies and reproduce keyed-row blockersmre
  • 5fd2ac75status: #36 GOmre
  • 0d253b45mission: T36Amre
  • 2aa22d23log: #36 GOmre
  • 833aee2flog: #50 closed, HM56 startedmre
  • ac58c1e5mission: HM56mre
  • 58979c0clog: HM54 held for decision, DP65 startedmre
  • bb2ebc67log: #64 live, #53 mergedmre
  • 27cde42fMerge hm53-dom: tracker#53 inputs bound to membersmre
  • 2156cc7flog: HM54 reviewmre
  • 9fb82efclog: HM54 gap, fill continuesmre