tracker
All repositories: gitoria
5.2 KB
// components/franchise.hl — `/franchises/:slug` (a franchise's index: its timelines, each a list of its titles) AND// `/timelines/:tslug` (one timeline, its franchise above it) — tracker.worldapi.org#19, mission 066. Each timeline has its own// sort toggle: "Timeline" (the in-world order, as edited) | "Release" (a movie by its release, a series by the release date of// its LAST episode — franchises.hl releaseKeyOf). A row: small poster, title (year), Movie/Series and the date the release// sort uses.//// ONE FLAT LIST of rows (a `head` row per timeline, then its `item` rows), not a nested for over timelines > titles: the same// proven shape as the show page's seasons (hybriel#86). Both orders of every timeline come with the page (`blocks`); a toggle// only rebuilds `rows` in the browser (`flatRows` is pure) — no request.parent './main.hl'import { appTitle } from '../lib/app.hl'import { franchisePage, pageOf, editorOf, flatRows } from '../lib/franchises.hl'slug = nulltslug = nullsession = nullcanEdit = editorOf(&session)data = pageOf(&slug, &tslug)found = data.kind != 'none'notFound = data.kind == 'none'isTimeline = data.kind == 'timeline'name = data.namesummary = data.summaryhasSummary = summary != ''hasFranchise = data.franchiseName != ''franchiseName = data.franchiseNamefranchiseHref = data.franchiseHrefeditHref = data.editHrefshowEdit = canEdit && isTimeline// tracker#20 (merge, mission 070): "Franchise | Star Trek", "Timeline | …" — the type word in its colour (styles.hl type-*)typeText = isTimeline ? 'Timeline' : 'Franchise'typeClass = isTimeline ? 'type-word type-timeline' : 'type-word type-franchise'blocks = data.blockshasBlocks = blocks.length > 0noBlocks = found && blocks.length == 0modes = {}namedHeads = !isTimelinerows = flatRows(&blocks, &modes, &namedHeads)__title = found ? name + ' — ' + appTitle : appTitle// Component styles use the shared theme variables.Style {franchisePage {display = 'block'}aFranchiseUp {display = 'inline-block'marginBottom = '.3rem'fontSize = '.85rem'fontWeight = '600'letterSpacing = '.04em'textTransform = 'uppercase'}pFranchiseSummary {margin = '-.3rem 0 1rem'color = 'var(--color-text)'}timelineBlocks {display = 'block'}timelineHead {display = 'flex'flexWrap = 'wrap'alignItems = 'center'gap = '.4rem .8rem'padding = '.8rem 0 .4rem'marginTop = '.6rem'}timelineTitle {flex = '1 1 12rem'minWidth = '0'display = 'flex'flexWrap = 'wrap'alignItems = 'baseline'gap = '.2rem .6rem'}aTimelineName {minWidth = '2.75rem'fontSize = '1.05rem'fontWeight = '600'color = 'var(--color-text-strong)'overflowWrap = 'anywhere'padding = '.7rem 0'margin = '-.7rem 0'}timelineCount {flex = 'none'fontSize = '.85rem'color = 'var(--color-text-muted)'}sortToggle {flex = 'none'display = 'flex'padding = '.15rem'background = 'var(--color-surface)'borderRadius = 'var(--radius-small)'}'button.sortbtn' {padding = '.25rem .7rem'fontSize = '.85rem'color = 'var(--color-text)'background = 'transparent'}'button.sortbtn.on' {color = 'var(--color-accent-text)'background = 'var(--color-accent)'}aTimelineItem {display = 'flex'alignItems = 'center'gap = '.8rem'padding = '.45rem 0'color = 'var(--color-text)'hover {textDecoration = 'none'filmTitle {color = 'var(--color-accent)'}}}}View {franchisePage { "data-kind" = data.kindif (notFound) {h1 { "Not found" }p { "This franchise or timeline doesn't exist." }}if (found) {if (hasFranchise) { a { id = "franchise-up" Style.aFranchiseUp href = franchiseHref franchiseName } }franchisesHead {h1 { class = "typed" typeWord { class = typeClass typeText } typeSep { "|" } typeName { name } }if (showEdit) { a { id = "timeline-edit" class = "button" href = editHref "Edit" } }}if (hasSummary) { p { Style.pFranchiseSummary summary } }if (noBlocks) { p { class = "muted" "No timelines yet." } }if (hasBlocks) {timelineBlocks {for (row of rows) {if (row.isHead) {timelineHead { "data-timeline" = row.idtimelineTitle {if (row.hasName) { a { Style.aTimelineName href = row.href row.name } }timelineCount { row.countText }}sortToggle { "aria-label" = "Sort"button { type = "button" class = row.timelineClass value = "timeline" "Timeline" on click(e) { emit sortTimeline(row.id, 'timeline') } }button { type = "button" class = row.releaseClass value = "release" "Release" on click(e) { emit sortTimeline(row.id, 'release') } }}}}if (row.isItem) {a { Style.aTimelineItem href = row.href "data-timeline" = row.timelineimg { class = "film-poster" src = row.posterUrl alt = "" loading = "lazy" }filmText {filmTitle { row.title }filmMeta {span { class = row.typeClass row.typeLabel }span { class = "timeline-date" row.dateLabel }}}}}}}}}}}on sortTimeline(timelineId, mode) {m = modesm[timelineId] = modemodes = mrows = flatRows(&blocks, &modes, &namedHeads)}
Branches
Latest commits
- 2f986ca3Log: RT50 passmre
- 1c4715a4RT50 mission: day50 repro retestmre
- 57d1c0dcLog: day50 retest requestmre
- 60b1f419Log: Anton #336 result, wake checkmre
- 919a18aalog: scratchmre
- 6b504440status tidymre
- 9332bd10log: DP70 livemre
- be11daa0DP70 brief fixmre
- 886a7028DP70 brief, HM67 mergedmre
- b41cdd6dMerge hm67-searchids: packed search IDsmre
- 385904eaReport HM67 matched heap measurements and gate proofmre
- e5c9b659Pack retained search IDs into UTF-8 bytesmre
- 62a5f6c7HM67 brief, HM66 mergedmre
- b32b8440Merge hm66-catalogindex: packed catalog indexmre
- 2db0f7adReport HM66 heap measurements and validationmre
- 6ce15623Pack catalog lists and membership maps in UTF-8 bytesmre
- 71134e21HM66 briefmre
- ed4cbab2status timemre
- e982c26dlog: HM65 mergedmre
- 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre