gitoria
All repositories: gitoria
5.8 KB
// components/repo.hl — THE REPO LAYOUT LEVEL (gitoria#22, D-CHAIN): the one level every repo page stands in:// shell (main.hl) → repo (this) → page (readme via index.hl, code, branch, commit, pulls, releases, tickets, settings).// It holds the repo head (name, description, "All repositories") and the tab nav (Readme · Code · Pull requests · Releases ·// Tickets · Settings) with aria-current = 'page' on the active tab, and the `slot` the page renders into. hl:web keeps a// standing level's DOM nodes when you navigate between pages of the SAME chain, so a tab click replaces only the slot —// not the head, not the nav. EVERY repo page declares `parent './repo.hl'` (never main.hl): a page under another chain// would be a full reload.// The repo comes from the request's host (`host = null`, hybriel#74). A MISSING repo: only "No such repository" + its link// (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).// THE ACTIVE TAB comes from the route (`route = null`: the standing level is given the new route on every navigation):// '/' readme · /code* /branch* /commit* code · /pulls · /releases · /tickets · /settings.// The "Add code" help (gitoria#7, gitoria#20) is the page's own: components/addcode.hl, in code/branch/commit.parent './main.hl'import { publicUrl, slugOfHost, px, orgOrigin } from '../lib/util.hl'import { slugOfRequest, orepoOfPath, orgBySlug } from '../lib/orgs.hl'import { orgFor } from '../lib/repos.hl'import { userIdOfSession } from '../lib/users.hl'import { forwardOf } from '../lib/forwards.hl'import { repoAt } from '../lib/repos.hl'import { tabOfPath } from '../lib/repos-helpers.hl'host = nullsession = nullroute = nullslot = null// inside an organization (<org>.<host>/<repo>/…) the repo is the path's first segment; the organization's own root has no repo headorepo = route != null ? orepoOfPath(host, route.path) : ''onOrgRoot = slugOfHost(host) != '' && orepo == '' && orgFor(slugOfHost(host), userIdOfSession(session)) != nullslug = onOrgRoot ? '' : slugOfRequest(host, orepo)pre = px(slug)homeHref = pre == '' ? '/' : precodeHref = pre + '/code'pullsHref = pre + '/pulls'releasesHref = pre + '/releases'ticketsHref = pre + '/tickets'settingsHref = pre + '/settings'inOrg = orepo != ''orgHref = inOrg ? orgOrigin(slugOfHost(host)) + '/' : ''orgName = slugOfHost(host)repo = repoAt(slug, session)onMain = slug == ''showHead = slug != ''hasRepo = repo != nullwasMoved = slug != '' && repoAt(slug, session) == null && forwardOf(slug) != nullnotMoved = !wasMovedisMissing = slug != '' && repo == nulltab = route != null ? tabOfPath(orepo == '' ? route.path : route.path.slice(orepo.length + 1)) : ''// the active tab's aria-current: 'page', else null — NOTE Hybriel renders null as aria-current="" (empty = false for ARIA),// repro .scratch/repro-null-attr; styles.hl matches [aria-current=page]curReadme = tab == 'readme' ? 'page' : nullcurCode = tab == 'code' ? 'page' : nullcurPulls = tab == 'pulls' ? 'page' : nullcurReleases = tab == 'releases' ? 'page' : nullcurTickets = tab == 'tickets' ? 'page' : nullcurSettings = tab == 'settings' ? 'page' : nullmainHref = publicUrl + '/'View {repoPage {if (showHead) {repoHead {if (hasRepo) {h1 { id = "reponame" repo.slug }if (repo.isPrivate) { span { id = "repoprivate" class = "muted" "Private" } }if (repo.described) { p { id = "repodescription" repo.description } }if (inOrg) { p { class = "muted" "Organization: " a { id = "toorg" href = orgHref orgName } } }p { class = "muted" "All repositories: " a { id = "toall" href = mainHref "gitoria" } }repoNav { id = "reponav"a { id = "navhome" href = homeHref "aria-current" = curReadme "Readme" }a { id = "navcode" href = codeHref "aria-current" = curCode "Code" }a { id = "navpulls" href = pullsHref "aria-current" = curPulls "Pull requests" }a { id = "navreleases" href = releasesHref "aria-current" = curReleases "Releases" }a { id = "navtickets" href = ticketsHref "aria-current" = curTickets "Tickets" }a { id = "navsettings" href = settingsHref "aria-current" = curSettings "Settings" }}}if (isMissing) {if (wasMoved) { h1 { id = "missing" "Moved" } }if (notMoved) { h1 { id = "missing" "No such repository" } }p { class = "muted" "Nobody has created this address yet. " a { id = "toall" href = mainHref "All repositories" } }}}}slot}}Style {repoPage {display = 'grid'gap = '1rem'minWidth = '0''> *' {margin = '0'}}repoHead {display = 'grid'gap = '.75rem'minWidth = '0''> *' {margin = '0'}h1 {fontSize = '1.4rem'}}repoNav {display = 'grid'gridTemplateColumns = 'repeat(3, minmax(0, 1fr))'gap = '.15rem'minWidth = '0'a {display = 'inline-flex'alignItems = 'center'justifyContent = 'center'minWidth = '2.75rem'minHeight = '2.75rem'padding = '0 .25rem'textAlign = 'center'fontWeight = '600'color = 'var(--color-text)'borderRadius = 'var(--radius-small)'boxSizing = 'border-box'borderBottom = '2px solid transparent' // functional: reserve the active tab underline space.hover {textDecoration = 'none'color = 'var(--color-text-strong)'background = 'var(--color-surface)'}}'a[aria-current=page]' {fontWeight = '700'color = 'var(--color-text-strong)'background = 'var(--color-surface)'borderBottomColor = 'var(--color-accent)' // functional: identify the active tab.}}@media {minWidth = '60rem'repoNav {display = 'flex'flexWrap = 'wrap'gap = '.15rem .25rem'marginInline = '-.75rem'a {padding = '0 .75rem'}}}}
Branches
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
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