gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit03b5bb0803b5bb08W39 report to reports/, drop scratch repro, mission + logmre03b5bb08/components/repo.hl

5.8 KB

  1. // components/repo.hl — THE REPO LAYOUT LEVEL (gitoria#22, D-CHAIN): the one level every repo page stands in:
  2. // shell (main.hl) → repo (this) → page (readme via index.hl, code, branch, commit, pulls, releases, tickets, settings).
  3. // It holds the repo head (name, description, "All repositories") and the tab nav (Readme · Code · Pull requests · Releases ·
  4. // Tickets · Settings) with aria-current = 'page' on the active tab, and the `slot` the page renders into. hl:web keeps a
  5. // standing level's DOM nodes when you navigate between pages of the SAME chain, so a tab click replaces only the slot —
  6. // not the head, not the nav. EVERY repo page declares `parent './repo.hl'` (never main.hl): a page under another chain
  7. // would be a full reload.
  8. // The repo comes from the request's host (`host = null`, hybriel#74). A MISSING repo: only "No such repository" + its link
  9. // (the page is still constructed, but every page renders nothing without a repo; a missing repo with NO slot made the browser's boot hang now and then, see reports/G2-hydrate.md). The main address (no slug): no head at all, just the slot (the repo list).
  10. // THE ACTIVE TAB comes from the route (`route = null`: the standing level is given the new route on every navigation):
  11. // '/' readme · /code* /branch* /commit* code · /pulls · /releases · /tickets · /settings.
  12. // The "Add code" help (gitoria#7, gitoria#20) is the page's own: components/addcode.hl, in code/branch/commit.
  13. parent './main.hl'
  14. import { publicUrl, slugOfHost, px, orgOrigin } from '../lib/util.hl'
  15. import { slugOfRequest, orepoOfPath, orgBySlug } from '../lib/orgs.hl'
  16. import { orgFor } from '../lib/repos.hl'
  17. import { userIdOfSession } from '../lib/users.hl'
  18. import { forwardOf } from '../lib/forwards.hl'
  19. import { repoAt } from '../lib/repos.hl'
  20. import { tabOfPath } from '../lib/repos-helpers.hl'
  21. host = null
  22. session = null
  23. route = null
  24. slot = null
  25. // inside an organization (<org>.<host>/<repo>/…) the repo is the path's first segment; the organization's own root has no repo head
  26. orepo = route != null ? orepoOfPath(host, route.path) : ''
  27. onOrgRoot = slugOfHost(host) != '' && orepo == '' && orgFor(slugOfHost(host), userIdOfSession(session)) != null
  28. slug = onOrgRoot ? '' : slugOfRequest(host, orepo)
  29. pre = px(slug)
  30. homeHref = pre == '' ? '/' : pre
  31. codeHref = pre + '/code'
  32. pullsHref = pre + '/pulls'
  33. releasesHref = pre + '/releases'
  34. ticketsHref = pre + '/tickets'
  35. settingsHref = pre + '/settings'
  36. inOrg = orepo != ''
  37. orgHref = inOrg ? orgOrigin(slugOfHost(host)) + '/' : ''
  38. orgName = slugOfHost(host)
  39. repo = repoAt(slug, session)
  40. onMain = slug == ''
  41. showHead = slug != ''
  42. hasRepo = repo != null
  43. wasMoved = slug != '' && repoAt(slug, session) == null && forwardOf(slug) != null
  44. notMoved = !wasMoved
  45. isMissing = slug != '' && repo == null
  46. tab = route != null ? tabOfPath(orepo == '' ? route.path : route.path.slice(orepo.length + 1)) : ''
  47. // the active tab's aria-current: 'page', else null — NOTE Hybriel renders null as aria-current="" (empty = false for ARIA),
  48. // repro .scratch/repro-null-attr; styles.hl matches [aria-current=page]
  49. curReadme = tab == 'readme' ? 'page' : null
  50. curCode = tab == 'code' ? 'page' : null
  51. curPulls = tab == 'pulls' ? 'page' : null
  52. curReleases = tab == 'releases' ? 'page' : null
  53. curTickets = tab == 'tickets' ? 'page' : null
  54. curSettings = tab == 'settings' ? 'page' : null
  55. mainHref = publicUrl + '/'
  56. View {
  57. repoPage {
  58. if (showHead) {
  59. repoHead {
  60. if (hasRepo) {
  61. h1 { id = "reponame" repo.slug }
  62. if (repo.isPrivate) { span { id = "repoprivate" class = "muted" "Private" } }
  63. if (repo.described) { p { id = "repodescription" repo.description } }
  64. if (inOrg) { p { class = "muted" "Organization: " a { id = "toorg" href = orgHref orgName } } }
  65. p { class = "muted" "All repositories: " a { id = "toall" href = mainHref "gitoria" } }
  66. repoNav { id = "reponav"
  67. a { id = "navhome" href = homeHref "aria-current" = curReadme "Readme" }
  68. a { id = "navcode" href = codeHref "aria-current" = curCode "Code" }
  69. a { id = "navpulls" href = pullsHref "aria-current" = curPulls "Pull requests" }
  70. a { id = "navreleases" href = releasesHref "aria-current" = curReleases "Releases" }
  71. a { id = "navtickets" href = ticketsHref "aria-current" = curTickets "Tickets" }
  72. a { id = "navsettings" href = settingsHref "aria-current" = curSettings "Settings" }
  73. }
  74. }
  75. if (isMissing) {
  76. if (wasMoved) { h1 { id = "missing" "Moved" } }
  77. if (notMoved) { h1 { id = "missing" "No such repository" } }
  78. p { class = "muted" "Nobody has created this address yet. " a { id = "toall" href = mainHref "All repositories" } }
  79. }
  80. }
  81. }
  82. slot
  83. }
  84. }
  85. Style {
  86. repoPage {
  87. display = 'grid'
  88. gap = '1rem'
  89. minWidth = '0'
  90. '> *' {
  91. margin = '0'
  92. }
  93. }
  94. repoHead {
  95. display = 'grid'
  96. gap = '.75rem'
  97. minWidth = '0'
  98. '> *' {
  99. margin = '0'
  100. }
  101. h1 {
  102. fontSize = '1.4rem'
  103. }
  104. }
  105. repoNav {
  106. display = 'grid'
  107. gridTemplateColumns = 'repeat(3, minmax(0, 1fr))'
  108. gap = '.15rem'
  109. minWidth = '0'
  110. a {
  111. display = 'inline-flex'
  112. alignItems = 'center'
  113. justifyContent = 'center'
  114. minWidth = '2.75rem'
  115. minHeight = '2.75rem'
  116. padding = '0 .25rem'
  117. textAlign = 'center'
  118. fontWeight = '600'
  119. color = 'var(--color-text)'
  120. borderRadius = 'var(--radius-small)'
  121. boxSizing = 'border-box'
  122. borderBottom = '2px solid transparent' // functional: reserve the active tab underline space.
  123. hover {
  124. textDecoration = 'none'
  125. color = 'var(--color-text-strong)'
  126. background = 'var(--color-surface)'
  127. }
  128. }
  129. 'a[aria-current=page]' {
  130. fontWeight = '700'
  131. color = 'var(--color-text-strong)'
  132. background = 'var(--color-surface)'
  133. borderBottomColor = 'var(--color-accent)' // functional: identify the active tab.
  134. }
  135. }
  136. @media {
  137. minWidth = '60rem'
  138. repoNav {
  139. display = 'flex'
  140. flexWrap = 'wrap'
  141. gap = '.15rem .25rem'
  142. marginInline = '-.75rem'
  143. a {
  144. padding = '0 .75rem'
  145. }
  146. }
  147. }
  148. }

Branches

Latest commits

  • 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
  • 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
  • 149dd512Rewrite W39 reportmre
  • e5385075Expect 401 for POST /api/repos without a tokenmre
  • 1a76055cDocument repository creation APImre
  • 4d779b3bAdd create-api gatemre
  • 88563122Add POST /api/repos for user tokensmre
  • b00860e3Create repositories with member checks in createRepoInmre
  • 0a38f236Report repository creation API blockermre
  • b5f72187Record malformed JSON blocker for repository creationmre
  • a2ae8302logmre
  • 6947cd58logmre
  • 2175e48clogmre
  • 40eb3ca1gitoria#38: review package, logmre
  • 06a5a50egitoria#38: deploy b8252ca, logmre
  • b8252ca0gitoria#46: W46b report, logmre
  • 50093aafgitoria#46: statuses keyed by app + context (merge w46b-keyed)mre
  • dd0267edgitoria#46: fix a label in the keyed gatemre
  • b1dcb580gitoria#46: statuses keyed by app + context, required = app + context, old rows still readmre
  • 2287363egitoria#47: W47 report, logmre