gitoria
All repositories: gitoria
6.5 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 = nullorgLabel = slugOfHost(host)session = 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)) + '/' : ''orgRecord = orgFor(slugOfHost(host), userIdOfSession(session))orgName = orgRecord != null && orgRecord.title != null && orgRecord.title != '' ? orgRecord.title : 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.heading }if (repo.titled) { span { id = "repoAddressName" class = "muted" 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 {#repoAddressName { overflowWrap = 'anywhere' }repoPage {display = 'grid'gap = '1rem'minWidth = '0'// Direct-child universal selectors have no bare language form.'> *' {margin = '0'}}repoHead {display = 'grid'gap = '.75rem'minWidth = '0'// Direct-child universal selectors have no bare language form.'> *' {margin = '0'}h1 {fontSize = '1.4rem'overflowWrap = 'anywhere'}}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)'}}// Attribute-value conditions have no bare language form.'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'display = 'flex'flexWrap = 'wrap'gap = '.15rem .25rem'marginInline = '-.75rem'a {padding = '0 .75rem'}}}}on client repoChanged(Hybrid row) {if (repo != null && row.id == repo.id) { repo = row }}on client orgChanged(Hybrid row) {if (row.slug == orgLabel) { orgName = row.heading }}
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