gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitf5be5f18f5be5f18records: gitoria PR-only planTrackerf5be5f18/components/franchise.hl

5.2 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 '../lib/app.hl'
  12. import { franchisePage, pageOf, editorOf, flatRows } from '../lib/franchises.hl'
  13. slug = null
  14. tslug = null
  15. session = null
  16. canEdit = editorOf(&session)
  17. data = pageOf(&slug, &tslug)
  18. found = data.kind != 'none'
  19. notFound = data.kind == 'none'
  20. isTimeline = data.kind == 'timeline'
  21. name = data.name
  22. summary = data.summary
  23. hasSummary = summary != ''
  24. hasFranchise = data.franchiseName != ''
  25. franchiseName = data.franchiseName
  26. franchiseHref = data.franchiseHref
  27. editHref = data.editHref
  28. showEdit = canEdit && isTimeline
  29. // tracker#20 (merge, mission 070): "Franchise | Star Trek", "Timeline | …" — the type word in its colour (styles.hl type-*)
  30. typeText = isTimeline ? 'Timeline' : 'Franchise'
  31. typeClass = isTimeline ? 'type-word type-timeline' : 'type-word type-franchise'
  32. blocks = data.blocks
  33. hasBlocks = blocks.length > 0
  34. noBlocks = found && blocks.length == 0
  35. modes = {}
  36. namedHeads = !isTimeline
  37. rows = flatRows(&blocks, &modes, &namedHeads)
  38. __title = found ? name + ' — ' + appTitle : appTitle
  39. // Component styles use the shared theme variables.
  40. Style {
  41. franchisePage {
  42. display = 'block'
  43. }
  44. aFranchiseUp {
  45. display = 'inline-block'
  46. marginBottom = '.3rem'
  47. fontSize = '.85rem'
  48. fontWeight = '600'
  49. letterSpacing = '.04em'
  50. textTransform = 'uppercase'
  51. }
  52. pFranchiseSummary {
  53. margin = '-.3rem 0 1rem'
  54. color = 'var(--color-text)'
  55. }
  56. timelineBlocks {
  57. display = 'block'
  58. }
  59. timelineHead {
  60. display = 'flex'
  61. flexWrap = 'wrap'
  62. alignItems = 'center'
  63. gap = '.4rem .8rem'
  64. padding = '.8rem 0 .4rem'
  65. marginTop = '.6rem'
  66. }
  67. timelineTitle {
  68. flex = '1 1 12rem'
  69. minWidth = '0'
  70. display = 'flex'
  71. flexWrap = 'wrap'
  72. alignItems = 'baseline'
  73. gap = '.2rem .6rem'
  74. }
  75. aTimelineName {
  76. minWidth = '2.75rem'
  77. fontSize = '1.05rem'
  78. fontWeight = '600'
  79. color = 'var(--color-text-strong)'
  80. overflowWrap = 'anywhere'
  81. padding = '.7rem 0'
  82. margin = '-.7rem 0'
  83. }
  84. timelineCount {
  85. flex = 'none'
  86. fontSize = '.85rem'
  87. color = 'var(--color-text-muted)'
  88. }
  89. sortToggle {
  90. flex = 'none'
  91. display = 'flex'
  92. padding = '.15rem'
  93. background = 'var(--color-surface)'
  94. borderRadius = 'var(--radius-small)'
  95. }
  96. 'button.sortbtn' {
  97. padding = '.25rem .7rem'
  98. fontSize = '.85rem'
  99. color = 'var(--color-text)'
  100. background = 'transparent'
  101. }
  102. 'button.sortbtn.on' {
  103. color = 'var(--color-accent-text)'
  104. background = 'var(--color-accent)'
  105. }
  106. aTimelineItem {
  107. display = 'flex'
  108. alignItems = 'center'
  109. gap = '.8rem'
  110. padding = '.45rem 0'
  111. color = 'var(--color-text)'
  112. hover {
  113. textDecoration = 'none'
  114. filmTitle {
  115. color = 'var(--color-accent)'
  116. }
  117. }
  118. }
  119. }
  120. View {
  121. franchisePage { "data-kind" = data.kind
  122. if (notFound) {
  123. h1 { "Not found" }
  124. p { "This franchise or timeline doesn't exist." }
  125. }
  126. if (found) {
  127. if (hasFranchise) { a { id = "franchise-up" Style.aFranchiseUp href = franchiseHref franchiseName } }
  128. franchisesHead {
  129. h1 { class = "typed" typeWord { class = typeClass typeText } typeSep { "|" } typeName { name } }
  130. if (showEdit) { a { id = "timeline-edit" class = "button" href = editHref "Edit" } }
  131. }
  132. if (hasSummary) { p { Style.pFranchiseSummary summary } }
  133. if (noBlocks) { p { class = "muted" "No timelines yet." } }
  134. if (hasBlocks) {
  135. timelineBlocks {
  136. for (row of rows) {
  137. if (row.isHead) {
  138. timelineHead { "data-timeline" = row.id
  139. timelineTitle {
  140. if (row.hasName) { a { Style.aTimelineName href = row.href row.name } }
  141. timelineCount { row.countText }
  142. }
  143. sortToggle { "aria-label" = "Sort"
  144. button { type = "button" class = row.timelineClass value = "timeline" "Timeline" on click(e) { emit sortTimeline(row.id, 'timeline') } }
  145. button { type = "button" class = row.releaseClass value = "release" "Release" on click(e) { emit sortTimeline(row.id, 'release') } }
  146. }
  147. }
  148. }
  149. if (row.isItem) {
  150. a { Style.aTimelineItem href = row.href "data-timeline" = row.timeline
  151. img { class = "film-poster" src = row.posterUrl alt = "" loading = "lazy" }
  152. filmText {
  153. filmTitle { row.title }
  154. filmMeta {
  155. span { class = row.typeClass row.typeLabel }
  156. span { class = "timeline-date" row.dateLabel }
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. on sortTimeline(timelineId, mode) {
  168. m = modes
  169. m[timelineId] = mode
  170. modes = m
  171. rows = flatRows(&blocks, &modes, &namedHeads)
  172. }

Branches

Latest commits

  • f5be5f18records: gitoria PR-only planTracker
  • 46a37036records: DP71 liveTracker
  • 3bcb7039Status/log: DP71 in progressTracker
  • 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker
  • 783957c2Merge branch 'sr1-search' into mainTracker
  • 792b9652README: search results come from the routeTracker
  • fd8570b1|||PR search: one server exchange per keystrokeTracker
  • e8f5cbcaLog: SR1 result, SR1bTracker
  • 8ad275a4Log/status: tracker 68, SR1Tracker
  • f5a06a0fLog: gitoria push setup, SR1Tracker
  • d6b109baMission SR1mre
  • 608b7558Log: FF1 merged via PR #1mre
  • 2939d94cMerge branch 'ff1-gate-failfast' into mainTracker
  • c934361a|||PR tests: gates fail fast when the app exits during startmre
  • d714ae42Log/status: AP56 closed out, FF1mre
  • a429d088Mission FF1mre
  • 03bbfba3Log: AP56c causemre
  • 24845fe3Log: AP56b result, AP56cmre
  • 6a6d71eaLog: gitoria membershipmre
  • 8b842dc8Log + CONDUCTOR: gitoria PR switch-onmre