gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf2-api-bugs26117255|||PR apps API: review comments on files with spaces in their namemref2-api-bugs/components/repo.hl

6.0 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. // Direct-child universal selectors have no bare language form.
  91. '> *' {
  92. margin = '0'
  93. }
  94. }
  95. repoHead {
  96. display = 'grid'
  97. gap = '.75rem'
  98. minWidth = '0'
  99. // Direct-child universal selectors have no bare language form.
  100. '> *' {
  101. margin = '0'
  102. }
  103. h1 {
  104. fontSize = '1.4rem'
  105. }
  106. }
  107. repoNav {
  108. display = 'grid'
  109. gridTemplateColumns = 'repeat(3, minmax(0, 1fr))'
  110. gap = '.15rem'
  111. minWidth = '0'
  112. a {
  113. display = 'inline-flex'
  114. alignItems = 'center'
  115. justifyContent = 'center'
  116. minWidth = '2.75rem'
  117. minHeight = '2.75rem'
  118. padding = '0 .25rem'
  119. textAlign = 'center'
  120. fontWeight = '600'
  121. color = 'var(--color-text)'
  122. borderRadius = 'var(--radius-small)'
  123. boxSizing = 'border-box'
  124. borderBottom = '2px solid transparent' // functional: reserve the active tab underline space.
  125. hover {
  126. textDecoration = 'none'
  127. color = 'var(--color-text-strong)'
  128. background = 'var(--color-surface)'
  129. }
  130. }
  131. // Attribute-value conditions have no bare language form.
  132. 'a[aria-current=page]' {
  133. fontWeight = '700'
  134. color = 'var(--color-text-strong)'
  135. background = 'var(--color-surface)'
  136. borderBottomColor = 'var(--color-accent)' // functional: identify the active tab.
  137. }
  138. @media {
  139. minWidth = '60rem'
  140. display = 'flex'
  141. flexWrap = 'wrap'
  142. gap = '.15rem .25rem'
  143. marginInline = '-.75rem'
  144. a {
  145. padding = '0 .75rem'
  146. }
  147. }
  148. }
  149. }

Branches

Latest commits

  • 26117255|||PR apps API: review comments on files with spaces in their namemre
  • b8796cecMerge branch 'f1-broken-json' into mainGitoria
  • 2f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre
  • f7c6ca07Merge branch 'ident-chooser-selector' into mainGitoria
  • 691abb8e|||PR tests: find ident identity choice without the removed .choose classmre
  • 16a3530fMerge branch 'heap-revert' into mainGitoria
  • 220a80e0|||PR Remove temporary /__heap route and heap helper; logmre
  • 13f0c342Merge branch 'hl25-records' into mainGitoria
  • a002ecb7|||PR records: HL25 report, heap helper, logmre
  • 2492a55cTemporary keyed /__heap route for the live memory snapshotmre
  • fefaedd2log: tracker PR-only, HL25 startedmre
  • 21aa57calog: parkmre
  • e9f950a8reports: G25c soakmre
  • a7783686log: deploy 9f41ffcmre
  • 9f41ffc1log: W30b mergedmre
  • bef635c1Merge branch 'w30b'mre
  • 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
  • c4f6d9e3reports: G25c growth huntmre
  • b88e39f1log: privacy cleanup donemre
  • bfd7826ddocs: neutral example organisation namemre