gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit5b3a56935b3a5693Log: SR1b merged via PR 2, DP71 startedTracker5b3a5693/components/franchiseedit.hl

4.6 KB

  1. // components/franchiseedit.hl — `/franchises/edit` (tracker.worldapi.org#19, mission 066): the creator's editor, step 1 —
  2. // a new franchise (name + summary → its index), a new timeline (name → its own editor, /timelines/<slug>/edit, where titles
  3. // are added and ordered and the franchise is attached), and a finder for the timelines that exist (by name → their editor).
  4. // Only the creator (franchises.hl isEditorSession: ident id az5b2, TRACKER_EDITORS) sees the forms; every face checks it again.
  5. //
  6. // HYBRIEL TRAPS (as components/search.hl): no member reads both a route param and `session`; every list is replaced whole.
  7. parent './main.hl'
  8. import { navigate } from 'hl:web'
  9. import { appTitle } from '../lib/app.hl'
  10. import { isEditorSession, createFranchise, createTimeline, findTimelines } from '../lib/franchises.hl'
  11. import { warmReady, warmText } from '../lib/warm.hl'
  12. static editorOf = (&session) => { return isEditorSession(&session) }
  13. session = null
  14. isEditor = editorOf(&session)
  15. notEditor = isEditor == false
  16. message = ''
  17. hasMessage = message != ''
  18. franchiseName = ''
  19. franchiseSummary = ''
  20. timelineName = ''
  21. findText = ''
  22. found = []
  23. hasFound = found.length > 0
  24. __title = 'Edit franchises — ' + appTitle
  25. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'
  26. // stage is there this page says so instead of showing half a map
  27. warming = !warmReady('all')
  28. warmNote = warming ? warmText() : ''
  29. // Component styles use the shared theme variables.
  30. Style {
  31. franchiseEditPage {
  32. display = 'block'
  33. }
  34. }
  35. View {
  36. franchiseEditPage {
  37. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  38. h1 { "Edit franchises" }
  39. if (notEditor) { p { id = "edit-refused" class = "muted" "Only the creator can edit franchises and timelines." } }
  40. if (isEditor) {
  41. if (hasMessage) { p { id = "edit-message" class = "message" message } }
  42. editSection {
  43. h2 { class = "film-heading" "New franchise" }
  44. input { id = "fe-name" value = franchiseName on input(e) { franchiseName = e.target.value } type = "text" placeholder = "Name, e.g. Star Trek" autocomplete = "off" "aria-label" = "Franchise name" }
  45. textarea { id = "fe-summary" value = franchiseSummary on input(e) { franchiseSummary = e.target.value } rows = "3" placeholder = "A few words about it (optional)" "aria-label" = "Franchise summary" }
  46. button { id = "fe-create" type = "button" class = "primary" "Create franchise" on click(e) { emit newFranchise(e) } }
  47. }
  48. editSection {
  49. h2 { class = "film-heading" "New timeline" }
  50. input { id = "te-name" value = timelineName on input(e) { timelineName = e.target.value } type = "text" placeholder = "Name, e.g. Star Trek — Prime" autocomplete = "off" "aria-label" = "Timeline name" }
  51. button { id = "te-create" type = "button" class = "primary" "Create timeline" on click(e) { emit newTimeline(e) } }
  52. }
  53. editSection {
  54. h2 { class = "film-heading" "Edit a timeline" }
  55. input { id = "tl-find" value = findText type = "search" placeholder = "Timeline name" autocomplete = "off" "aria-label" = "Find a timeline" on input(e) { emit findTyped(e) } }
  56. if (hasFound) {
  57. timelineList { id = "tl-found"
  58. for (t of found) {
  59. a { class = "timeline-link" href = t.href
  60. timelineLinkName { t.name }
  61. timelineLinkCount { t.countText }
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. on newFranchise(e) {
  71. r = emit server fedCreateFranchise(franchiseName, franchiseSummary)
  72. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  73. navigate('/franchises/' + r.slug)
  74. }
  75. on newTimeline(e) {
  76. r = emit server fedCreateTimeline(timelineName)
  77. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  78. navigate('/timelines/' + r.slug + '/edit')
  79. }
  80. on findTyped(e) {
  81. v = e.target.value
  82. findText = v
  83. r = emit server fedFindTimelines(v)
  84. if (r == null || findText != v) { return null }
  85. found = r.rows
  86. }
  87. // ---- the faces (unique names: hl:web dispatches by name across all files; the trailing `session` is the server's) ----
  88. on server fedCreateFranchise(name, summary, session) {
  89. if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }
  90. return createFranchise(name, summary)
  91. }
  92. on server fedCreateTimeline(name, session) {
  93. if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }
  94. return createTimeline(&name)
  95. }
  96. // timeline names are public (/franchises lists them all) — no session needed
  97. on server fedFindTimelines(text) {
  98. return { rows = findTimelines(&text) }
  99. }

Branches

Latest commits

  • 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
  • 6bb7c20estatus: window 2026-11-09mre
  • 5db84974Log: Apollo window GO, AP56b started, BS1 copy removedmre
  • e84586a7Mission AP56bmre