gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commita81abdc9a81abdc9gitoria#34: org page via function route, member-reachable orgs, selects, reportmrea81abdc9/components/repo.hl

4.6 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. }

Branches

Latest commits

  • a81abdc9gitoria#34: org page via function route, member-reachable orgs, selects, reportmre
  • 17f031f0gitoria#34: private repos, organizations, members, move tool, gatemre
  • 71b69343gitoria#23: the sidebar's Repositories link was a 404 after any in-page navigation (static menu re-evaluated publicUrl in the browser); the menu is an instance property now; gate taps it after a tab, folder, filemre
  • 90b4f728gitoria#25: restore the homepage cache and the parsed-blocks cache (they store data under immutable keys, no HTML); the page key, the framework readme key and the textHash key stay removedmre
  • a487248cgitoria#25: remove every cache that hid the page build (page key, Markdown render key, homepage cache, parsed-blocks cache) and the gate that only tested themmre
  • 12f2f4fegitoria: re-vendor Hybriel set-day27b, a startup fault in on Error exits 1mre
  • c21c084egitoria: write the standby service out in full so the boot gate can read the main servicemre
  • e307d69agitoria: say what is per process during the hand-overmre
  • f0cbe6a6gitoria: standby service on port 45014 and a deploy that hands over through it without a gapmre
  • 727cd083gitoria#25: README: vendor notes for Hybriel c1b1010f and the page cachemre
  • 61b72dedgitoria#25: re-vendor Hybriel master c1b1010f (W149 page cache), key the repo Readme page by slug and main commit, extend the readme-cache gatemre
  • 5b0b4b9ereadme-cache gate: use the security gate's ports when no own ports are givenmre
  • bc8f20d9gitoria#25: re-vendor Hybriel c09538bb with the W141 render cache, cache the homepage per commit, add the readme-cache gatemre
  • 9feebbd3Re-vendor Hybriel to ded47c13 (W145: Firefox start script fix)mre
  • 28ed41e5gitoria#24: one sign-in comes from hl:web batch 20, the /session/share workaround is gonemre
  • 3b2669e4gs: drop the unbuildable legacy check, fix pwa fetchmre
  • 2a2fdd77gs: C2 check before cookie experimentsmre
  • 76e0587aWIP gs 2mre
  • a80da7bdWIP gs: security gate for lazy sessions, g24 browser checksmre
  • 23fb05d8re-vendor Hybriel aaa39e69 (hl:web batch 20: login emit and Sessions.mint, tab follows a login, signed-in session cookie wins among duplicates and is re-issued with the Domain, W85 faster render, lazy sessions)mre