gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit641f3b54641f3b54Tracker: Apollo answermre641f3b54/components/mymovies.hl

3.0 KB

  1. // components/mymovies.hl — `/my/movies` (tracker.worldapi.org#13): every MOVIE the signed-in user follows, the one
  2. // followed last on top — the architect: "/my/movies = the movies you follow, like /my/shows". A row: the small poster, the
  3. // title with its year linking to the movie's page (`/movies/<slug>`, tracker#21: the one title page and its Follow button).
  4. // Read-only like /my/shows, the same row look (the my-show-row tags/classes in styles.hl). Reused: `followsOfUser`,
  5. // `insertByFollowDesc` (follows.hl), `cardOf`, `posterUrlOfName` (shows.hl). tracker#30 (mission 025): the slim cached card per
  6. // movie and the user's cached watched set, no whole record (cast + crew) per load.
  7. // mission 058 (tracker#24): a movie watched on its page (watch `movie:<id>`, watches.hl) shows the solid check in its row,
  8. // and the count line says how many of them are watched ("3 movies · 1 watched"). The user's watched set (watchedSetOf, kept).
  9. parent './main.hl'
  10. import { appTitle } from '../project.hl'
  11. import { userIdOfSession } from '../lib/users.hl'
  12. import { followsOfUser, insertByFollowDesc } from '../lib/follows.hl'
  13. import { cardOf, posterUrlOfName } from '../lib/shows.hl'
  14. import { watchedSetOf } from '../lib/watches.hl'
  15. // static: an mpackdb-backed helper must be `static` (hybriel#115/#116)
  16. static watchedCountOf = (&rows) => {
  17. let n = 0
  18. for (r of rows) { if (r.watched) { n = n + 1 } }
  19. return n
  20. }
  21. static myMoviesRowsOf = (&userId) => {
  22. if (userId == null) { return [] }
  23. watched = watchedSetOf(userId)
  24. let out = []
  25. for (f of followsOfUser(userId)) {
  26. let c = cardOf(f.show)
  27. if (c != null && c.type == 'movie') {
  28. out = insertByFollowDesc(out, {
  29. id = c.id title = c.titleYear href = c.href
  30. posterUrl = posterUrlOfName(c.posterName) followedAt = f.at != null ? f.at : 0
  31. watched = watched['movie:' + c.id] == true
  32. })
  33. }
  34. }
  35. return out
  36. }
  37. session = null
  38. userId = userIdOfSession(session)
  39. signedIn = userId != null
  40. // a plain copy of userId for `rows` (mission 047: session sync, see components/show.hl `me`)
  41. me = userId
  42. rows = signedIn ? myMoviesRowsOf(me) : []
  43. hasRows = rows.length > 0
  44. noRows = !hasRows
  45. countText = rows.length + (rows.length == 1 ? ' movie' : ' movies') + ' · ' + watchedCountOf(rows) + ' watched'
  46. emptyText = signedIn ? 'You follow no movies yet.' : 'Sign in to see the movies you follow.'
  47. __title = 'My movies — ' + appTitle
  48. View {
  49. myMoviesPage {
  50. h1 { "My movies" }
  51. if (noRows) { p { class = "muted" emptyText } }
  52. if (hasRows) {
  53. p { class = "muted list-count" id = "mymovies-count" countText }
  54. myShowsRows {
  55. for (row of rows) {
  56. myShowRow {
  57. img { class = "myshow-poster" src = row.posterUrl alt = row.title }
  58. a { class = "myshow-title" href = row.href row.title }
  59. if (row.watched) {
  60. myMovieWatched { class = "checkicon solid" title = "Watched"
  61. svg { viewBox = "0 0 24 24" width = "22" height = "22" "aria-hidden" = "true"
  62. circle { cx = "12" cy = "12" r = "10" }
  63. path { d = "M7 12.5 L10.5 16 L17 8.5" }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }

Branches

Latest commits

  • 641f3b54Tracker: Apollo answermre
  • 8b3cbddaTracker: status, TR7 fix livemre
  • ec30162aTracker: TR7 fix livemre
  • 54cbec80compose: ignore SIGPIPE (TR7 crash loop, exit 141)mre
  • 3e164b63Tracker: status after CL1mre
  • 9d686bb3Tracker: CL1 reviewedmre
  • b8bba562CL1: crash loop report (SIGPIPE confirmed, trap wrapper option)mre
  • 298785f2Tracker: CL1 startedmre
  • 36b22710Tracker: port slot, CL1 briefmre
  • a401190fTracker: GO for the crash loopmre
  • e195d372Tracker: token pathsmre
  • 7f541d11Tracker conductor: CONDUCTOR.md, short STATUS.md, old status + decisions archive to archive/2026-10-31mre
  • 8dd423f7README: login.js stays by caramboleyo's explicit rulemre
  • d8df1493tracker: standby service on port 45018 and a gap-free hand-over in deploy.sh step 4mre
  • 36dd1686ident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • ff9b838etracker: the Ended status pill uses the same red as layouts (pill danger); gate updatedmre
  • 40d9719eTP2: LOG line and report for the tracker pillsmre
  • ab3f2ba5tracker: status, genres, TMDB/IMDb/TVDB/TVmaze links and list kinds use the theme's pill; dense season list with the season check centred on its title line; gates for bothmre
  • 521061d6tracker header on phones: signed in, the brand fits whole at 360 and 390 px (tighter gaps and side paddings, slightly smaller brand, narrow screens and signed in only); mobile gate checks itmre
  • 18114a53tracker: franchises gate waits for the signed-out selector instead of the removed Log in buttonmre