gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitd25bd14ad25bd14amission 044: sliced merge prepare + sliced collections prepare; jobs-dump old/new check + bulk fixturemred25bd14a/components/franchise.hl

5.0 KB

  1. // components/franchise.hl — `/franchises/:slug` (a franchise's index: its timelines, each a list of its titles) AND
  2. // `/timelines/:tslug` (one timeline, its franchise above it) — tracker.worldapi.org#19, mission 066. Each timeline has its own
  3. // sort toggle: "Timeline" (the in-world order, as edited) | "Release" (a movie by its release, a series by the release date of
  4. // its LAST episode — franchises.hl releaseKeyOf). A row: small poster, title (year), Movie/Series and the date the release
  5. // sort uses.
  6. //
  7. // ONE FLAT LIST of rows (a `head` row per timeline, then its `item` rows), not a nested for over timelines > titles: the same
  8. // proven shape as the show page's seasons (hybriel#86). Both orders of every timeline come with the page (`blocks`); a toggle
  9. // only rebuilds `rows` in the browser (`flatRows` is pure) — no request.
  10. parent './main.hl'
  11. import { appTitle } from '../project.hl'
  12. import { franchisePage, timelinePage, isEditorSession } from '../lib/franchises.hl'
  13. // static + LOCAL: an mpackdb-backed helper must be `static` (hybriel#115/#116, mission 047)
  14. static pageOf = (slug, &tslug) => {
  15. let p = tslug != null ? timelinePage(tslug) : franchisePage(slug)
  16. return p != null ? p : { kind = 'none' name = '' slug = '' summary = '' franchiseName = '' franchiseHref = '' blocks = [] editHref = '' }
  17. }
  18. static editorOf = (&session) => { return isEditorSession(session) }
  19. // pure (runs in the browser on a toggle): the rows of every timeline in its chosen order. `named`: a head shows the timeline's
  20. // name (the franchise index); a timeline's own page has it in its h1 already (mission 025: the name was there twice)
  21. static flatRows = (&blocks, &modes, &named) => {
  22. out = []
  23. for (b of blocks) {
  24. let byRelease = modes[b.id] == 'release'
  25. out.push({ kind = 'head' isHead = true isItem = false key = b.id id = b.id name = b.name hasName = named href = b.href countText = b.countText
  26. timelineClass = byRelease ? 'sortbtn' : 'sortbtn on' releaseClass = byRelease ? 'sortbtn on' : 'sortbtn' })
  27. let list = byRelease ? b.byRelease : b.items
  28. for (it of list) {
  29. out.push({ kind = 'item' isHead = false isItem = true key = b.id + ':' + it.id id = it.id timeline = b.id pos = it.pos title = it.title href = it.href
  30. posterUrl = it.posterUrl typeLabel = it.kind dateLabel = it.dateLabel })
  31. }
  32. }
  33. return out
  34. }
  35. slug = null
  36. tslug = null
  37. session = null
  38. canEdit = editorOf(session)
  39. data = pageOf(slug, tslug)
  40. found = data.kind != 'none'
  41. notFound = data.kind == 'none'
  42. isTimeline = data.kind == 'timeline'
  43. name = data.name
  44. summary = data.summary
  45. hasSummary = summary != ''
  46. hasFranchise = data.franchiseName != ''
  47. franchiseName = data.franchiseName
  48. franchiseHref = data.franchiseHref
  49. editHref = data.editHref
  50. showEdit = canEdit && isTimeline
  51. // tracker#20 (merge, mission 070): "Franchise | Star Trek", "Timeline | …" — the type word in its colour (styles.hl type-*)
  52. typeText = isTimeline ? 'Timeline' : 'Franchise'
  53. typeClass = isTimeline ? 'type-word type-timeline' : 'type-word type-franchise'
  54. blocks = data.blocks
  55. hasBlocks = blocks.length > 0
  56. noBlocks = found && blocks.length == 0
  57. modes = {}
  58. namedHeads = !isTimeline
  59. rows = flatRows(blocks, modes, namedHeads)
  60. __title = found ? name + ' — ' + appTitle : appTitle
  61. View {
  62. franchisePage { "data-kind" = data.kind
  63. if (notFound) {
  64. h1 { "Not found" }
  65. p { "This franchise or timeline doesn't exist." }
  66. }
  67. if (found) {
  68. if (hasFranchise) { a { id = "franchise-up" class = "franchise-up" href = franchiseHref franchiseName } }
  69. franchisesHead {
  70. h1 { class = "typed" typeWord { class = typeClass typeText } typeSep { "|" } typeName { name } }
  71. if (showEdit) { a { id = "timeline-edit" class = "button" href = editHref "Edit" } }
  72. }
  73. if (hasSummary) { p { class = "franchise-summary" summary } }
  74. if (noBlocks) { p { class = "muted" "No timelines yet." } }
  75. if (hasBlocks) {
  76. timelineBlocks {
  77. for (row of rows) {
  78. if (row.isHead) {
  79. timelineHead { "data-timeline" = row.id
  80. timelineTitle {
  81. if (row.hasName) { a { class = "timeline-name" href = row.href row.name } }
  82. timelineCount { row.countText }
  83. }
  84. sortToggle { "aria-label" = "Sort"
  85. button { type = "button" class = row.timelineClass value = "timeline" "Timeline" on click(e) { emit sortTimeline(row.id, 'timeline') } }
  86. button { type = "button" class = row.releaseClass value = "release" "Release" on click(e) { emit sortTimeline(row.id, 'release') } }
  87. }
  88. }
  89. }
  90. if (row.isItem) {
  91. a { class = "timeline-item" href = row.href "data-timeline" = row.timeline
  92. img { class = "film-poster" src = row.posterUrl alt = "" loading = "lazy" }
  93. filmText {
  94. filmTitle { row.title }
  95. filmMeta {
  96. span { row.typeLabel }
  97. span { class = "timeline-date" row.dateLabel }
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. on sortTimeline(timelineId, mode) {
  109. m = modes
  110. m[timelineId] = mode
  111. modes = m
  112. rows = flatRows(blocks, modes, namedHeads)
  113. }

Branches

Latest commits

  • d25bd14amission 044: sliced merge prepare + sliced collections prepare; jobs-dump old/new check + bulk fixturemre
  • 633ee210mission 044: sliced table scans (slices.hl, pk-range slices) for the adult/kind/status/art/credits/details-repair queuesmre
  • 6648ba44mission 042: real-browser E2E on ce6f2e0a re-vendor 69/0 at 390 + 1280mre
  • 3ed3a0efmission 042: gates old/new equal (browser #41 route-table regex accepts unescaped hl:web output), real-data TTFB, E2E blocked by lisbeth lockmre
  • d5b61e90LOG 042mre
  • 4acdbaccmission 042: memory comparison old vs ce6f2e0a (stopped: warm VmHWM higher), reportmre
  • d0f620d6mission 042: re-vendor Hybriel ce6f2e0a (plugins incl. mpackdb; bin runtime built from the same archive, git-ignored), compact=false keptmre
  • 5bd14e12mission 040: theme 76f99f6 gates + E2E green; 44 px fixes (skeleton row, type-word, genre-link/pill); README, reportmre
  • 77cfa45cmission 040: partial report (theme/modal/pagination re-copied, tilelist onPage, 44 px taps; gates new + E2E pending)mre
  • 4b14822fe2e-theme: menu marker by colourmre
  • 09780f4emission 040 WIP: theme, modal, pagination, tokens re-copied from layouts 76f99f6; tilelist uses onPage; tap sizes 44 px for tracker's own small buttons; tests/e2e-theme.mjsmre
  • fb80bb8chotfix: open the 5 show stores without compaction (compact = false) — compact-on-open left another handle on stale offsets, every read gave a bare Number (hybriel mpackdb refresh after a shrink); live down 2026-10-20 05:11mre
  • e00d3bf7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • a8c7f234tracker#36 (mission 039): tools/tmdb-check.hl survives a dropped connection (on Error, asked again, failed lines) and resumes with --from N; tests/tmdbcheck.mjs 6/6 against a fake TMDBmre
  • 9c230516mission brief w39mre
  • 3609121dmission 038 docs + report (quota stop): README/kinds.md for #43 #42 #36, STATUS, LOG; HEAD browser gate 374/8 in the in-app daily run block (hour-boundary suspected, rerun pending), other gates green; #36 real run needs TMDB_READ_TOKENmre
  • a5d06e79tracker#36 (mission 038): tools/tmdb-check.hl + lib/tmdbcheck.hl — every live migrated title's migrated title + year against its TMDB entry (one GET /movie|tv/<id>?append_to_response=alternative_titles, 260 ms apart, passing failures asked once more): ok / ambiguous (one of title, year disagrees) / clear (both, or 404); read-only; token only from TMDB_READ_TOKEN; --stored = a title-only preview from the TMDB names already stored (no request). Tested against a fake TMDB (.scratch/w38/t36): 7 titles, 3 ok, 2 ambiguous, 2 clear, data unchangedmre
  • 982554f3tracker#42 (mission 038): series pages — an unknown slug no longer scans every title (lib/shows.hl showBySlug: the slug map only; new titles are noted by refreshTitleCaches, which both title puts already reach): 10.7–15.7 s → 0.013 s on the real copy (the one-request-at-a-time server was blocked meanwhile); cast/crew rows take name + slug from a person-link cache (personLinkOf) instead of whole person records (SNL: 303 cast with 4,761 credits, ~49k allocations per render) — allocations per series page −5…−40 %; HTML of 20 pages identical to beforemre
  • 4586b6e3docker-compose: init: true (hybriel#156)mre
  • 085c2e5ftracker#43 (mission 038): TVmaze's type makes Variety / Talk Show / Game Show / Reality / News / Panel Show / Award Show / Sports titles Shows (TMDB calls Saturday Night Live UK Scripted) — the #43 part of parked w37-wip a79c8c1 only (no re-vendor, no cache volume): tvmazeType stored by the sync and the TVmaze status backfill (asks every series with a TVmaze id once), kindOfTitle/kindWithTvmaze, tools/tvmaze-types.hl, gate fixture Variety Gate Series; start waits 150 smre