gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit097c52ba097c52baStyle the login error through its View idmre097c52ba/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

  • 097c52baStyle the login error through its View idmre
  • c6d9c86aOwn the not-found code rule in its componentmre
  • 055424c2Record W61 replacement theme gates, sidebar repro and baselinemre
  • 2ed09441Use layouts theme 17e0f03 for W61 compatibilitymre
  • b8609a91Merge branch 'main' into w61-stylemre
  • 4639caf7Report W61 theme startup blocker and day39 Style probemre
  • 81f0a0bbREADME: two caches were restored by 90b4f72; log W62mre
  • 4a3f557eImport layouts theme ebd00b6 for W61 (startup blocked)mre
  • ab12a257Merge W62: #25 commit page measurements and proc repromre
  • 41323e49gitoria#25: measure commit request costs and reproduce blocking process waitsmre
  • 53ca42b2log: W60 merged, W61 W62 startedmre
  • 80870a33mission W61: style passmre
  • 560fd208Merge W60: helpers, bound forms, login in topics, two form fixes (gitoria#28 #32 #33)mre
  • ac5ba6a4log: W60, #25 measuredmre
  • 220f6342W60: record corrected form proof, full AE and remaining gapsmre
  • 7e31cac5gitoria#28: restrict reply form layout to reply formsmre
  • ae373cfdgitoria#28: keep each reply draft in its thread componentmre
  • eeeebd5agitoria: insert a newly created organization oncemre
  • 34d2d5cagitoria: clear the bound public-key textarea after creationmre
  • 119e54c0W60: restore conductor-owned tracking filesmre