gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainfe209ffeMerge branch 'w56-owner-members' into mainGitoriamain/components/repo.hl

6.5 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. orgLabel = slugOfHost(host)
  23. session = null
  24. route = null
  25. slot = null
  26. // inside an organization (<org>.<host>/<repo>/…) the repo is the path's first segment; the organization's own root has no repo head
  27. orepo = route != null ? orepoOfPath(host, route.path) : ''
  28. onOrgRoot = slugOfHost(host) != '' && orepo == '' && orgFor(slugOfHost(host), userIdOfSession(session)) != null
  29. slug = onOrgRoot ? '' : slugOfRequest(host, orepo)
  30. pre = px(slug)
  31. homeHref = pre == '' ? '/' : pre
  32. codeHref = pre + '/code'
  33. pullsHref = pre + '/pulls'
  34. releasesHref = pre + '/releases'
  35. ticketsHref = pre + '/tickets'
  36. settingsHref = pre + '/settings'
  37. inOrg = orepo != ''
  38. orgHref = inOrg ? orgOrigin(slugOfHost(host)) + '/' : ''
  39. orgRecord = orgFor(slugOfHost(host), userIdOfSession(session))
  40. orgName = orgRecord != null && orgRecord.title != null && orgRecord.title != '' ? orgRecord.title : slugOfHost(host)
  41. repo = repoAt(slug, session)
  42. onMain = slug == ''
  43. showHead = slug != ''
  44. hasRepo = repo != null
  45. wasMoved = slug != '' && repoAt(slug, session) == null && forwardOf(slug) != null
  46. notMoved = !wasMoved
  47. isMissing = slug != '' && repo == null
  48. tab = route != null ? tabOfPath(orepo == '' ? route.path : route.path.slice(orepo.length + 1)) : ''
  49. // the active tab's aria-current: 'page', else null — NOTE Hybriel renders null as aria-current="" (empty = false for ARIA),
  50. // repro .scratch/repro-null-attr; styles.hl matches [aria-current=page]
  51. curReadme = tab == 'readme' ? 'page' : null
  52. curCode = tab == 'code' ? 'page' : null
  53. curPulls = tab == 'pulls' ? 'page' : null
  54. curReleases = tab == 'releases' ? 'page' : null
  55. curTickets = tab == 'tickets' ? 'page' : null
  56. curSettings = tab == 'settings' ? 'page' : null
  57. mainHref = publicUrl + '/'
  58. View {
  59. repoPage {
  60. if (showHead) {
  61. repoHead {
  62. if (hasRepo) {
  63. h1 { id = "reponame" repo.heading }
  64. if (repo.titled) { span { id = "repoAddressName" class = "muted" repo.slug } }
  65. if (repo.isPrivate) { span { id = "repoprivate" class = "muted" "Private" } }
  66. if (repo.described) { p { id = "repodescription" repo.description } }
  67. if (inOrg) { p { class = "muted" "Organization: " a { id = "toorg" href = orgHref orgName } } }
  68. p { class = "muted" "All repositories: " a { id = "toall" href = mainHref "gitoria" } }
  69. repoNav { id = "reponav"
  70. a { id = "navhome" href = homeHref "aria-current" = curReadme "Readme" }
  71. a { id = "navcode" href = codeHref "aria-current" = curCode "Code" }
  72. a { id = "navpulls" href = pullsHref "aria-current" = curPulls "Pull requests" }
  73. a { id = "navreleases" href = releasesHref "aria-current" = curReleases "Releases" }
  74. a { id = "navtickets" href = ticketsHref "aria-current" = curTickets "Tickets" }
  75. a { id = "navsettings" href = settingsHref "aria-current" = curSettings "Settings" }
  76. }
  77. }
  78. if (isMissing) {
  79. if (wasMoved) { h1 { id = "missing" "Moved" } }
  80. if (notMoved) { h1 { id = "missing" "No such repository" } }
  81. p { class = "muted" "Nobody has created this address yet. " a { id = "toall" href = mainHref "All repositories" } }
  82. }
  83. }
  84. }
  85. slot
  86. }
  87. }
  88. Style {
  89. #repoAddressName { overflowWrap = 'anywhere' }
  90. repoPage {
  91. display = 'grid'
  92. gap = '1rem'
  93. minWidth = '0'
  94. // Direct-child universal selectors have no bare language form.
  95. '> *' {
  96. margin = '0'
  97. }
  98. }
  99. repoHead {
  100. display = 'grid'
  101. gap = '.75rem'
  102. minWidth = '0'
  103. // Direct-child universal selectors have no bare language form.
  104. '> *' {
  105. margin = '0'
  106. }
  107. h1 {
  108. fontSize = '1.4rem'
  109. overflowWrap = 'anywhere'
  110. }
  111. }
  112. repoNav {
  113. display = 'grid'
  114. gridTemplateColumns = 'repeat(3, minmax(0, 1fr))'
  115. gap = '.15rem'
  116. minWidth = '0'
  117. a {
  118. display = 'inline-flex'
  119. alignItems = 'center'
  120. justifyContent = 'center'
  121. minWidth = '2.75rem'
  122. minHeight = '2.75rem'
  123. padding = '0 .25rem'
  124. textAlign = 'center'
  125. fontWeight = '600'
  126. color = 'var(--color-text)'
  127. borderRadius = 'var(--radius-small)'
  128. boxSizing = 'border-box'
  129. borderBottom = '2px solid transparent' // functional: reserve the active tab underline space.
  130. hover {
  131. textDecoration = 'none'
  132. color = 'var(--color-text-strong)'
  133. background = 'var(--color-surface)'
  134. }
  135. }
  136. // Attribute-value conditions have no bare language form.
  137. 'a[aria-current=page]' {
  138. fontWeight = '700'
  139. color = 'var(--color-text-strong)'
  140. background = 'var(--color-surface)'
  141. borderBottomColor = 'var(--color-accent)' // functional: identify the active tab.
  142. }
  143. @media {
  144. minWidth = '60rem'
  145. display = 'flex'
  146. flexWrap = 'wrap'
  147. gap = '.15rem .25rem'
  148. marginInline = '-.75rem'
  149. a {
  150. padding = '0 .75rem'
  151. }
  152. }
  153. }
  154. }
  155. on client repoChanged(Hybrid row) {
  156. if (repo != null && row.id == repo.id) { repo = row }
  157. }
  158. on client orgChanged(Hybrid row) {
  159. if (row.slug == orgLabel) { orgName = row.heading }
  160. }

Branches

Latest commits

  • fe209ffeMerge branch 'w56-owner-members' into mainGitoria
  • fa0754c8|||PR repository owner transfer and members API (#55)mre
  • 8862e537Merge branch 'w55-rename-org' into mainGitoria
  • 014d2b7fOne immutable readers snapshot per move for the left-organization event (#53)mre
  • 1859d506Decide who hears a repo left its organization by its readers before the move (#53)mre
  • 499f25f2Review fixes for the Settings organization move (#53)mre
  • ed3b922b|||PR move a repository into an organization in Settings (#53)mre
  • 74ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria
  • 9f7ce8d8Preserve rename compatibility and live page titlesmre
  • c3d95b6e|||PR separate names and addresses, rename repositories in Settings (#53)mre
  • ce08920dMerge branch 'w52c-header-phone' into mainGitoria
  • 0bab9e46|||PR header: ident status wraps on phones instead of clippingmre
  • e7af3eceMerge branch 'w52b-approval-followup' into mainGitoria
  • c01e66c6|||PR approvals follow-up: live Merge after status writes, helpers (#52)mre
  • 841da497Merge branch 'w53-pulls-speed-pr' into mainGitoria
  • 80307ae2|||PR pulls page cache: live PR numbers, complete scans onlymre
  • 69141f65|||PR pulls page: cache the git part per repo by branch tipsmre
  • 155861f6Merge branch 'w52-person-approval' into mainGitoria
  • b5435de8|||PR person approvals: second Kunibert round (#52)mre
  • 3a8b2fb8|||PR person approvals: Kunibert review fixes (#52)mre