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
- 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
- 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
- 149dd512Rewrite W39 reportmre
- e5385075Expect 401 for POST /api/repos without a tokenmre
- 1a76055cDocument repository creation APImre
- 4d779b3bAdd create-api gatemre
- 88563122Add POST /api/repos for user tokensmre
- b00860e3Create repositories with member checks in createRepoInmre
- 0a38f236Report repository creation API blockermre
- b5f72187Record malformed JSON blocker for repository creationmre
- a2ae8302logmre
- 6947cd58logmre
- 2175e48clogmre
- 40eb3ca1gitoria#38: review package, logmre
- 06a5a50egitoria#38: deploy b8252ca, logmre
- b8252ca0gitoria#46: W46b report, logmre
- 50093aafgitoria#46: statuses keyed by app + context (merge w46b-keyed)mre
- dd0267edgitoria#46: fix a label in the keyed gatemre
- b1dcb580gitoria#46: statuses keyed by app + context, required = app + context, old rows still readmre
- 2287363egitoria#47: W47 report, logmre