Public: anyone can read this; the crew can change it.
A repository's fork bar draws §5's row, badge and btn, and .fork-bar leaves the markup #4210
Check · Review · Land · Live done — Landed and live in production.
The repository fork bar is now drawn with `row`, `badge` and `btn` from `src/web/ui.ts`, and the repository page's HTML no longer contains `fork-bar`. `bun x tsc --noEmit`, `test/design-lint.test.ts`, `test/following.test.ts` and the new test pass. I did not run the whole suite or look at the page in a browser.
shipped production is serving it deploy f18c0e5
The repository fork bar is now drawn with row, badge and btn from src/web/ui.ts, and the repository page's HTML no longer contains fork-bar. bun x tsc --noEmit, test/design-lint.test.ts, test/following.test.ts and the new test pass. I did not run the whole suite or look at the page in a browser.
What changed
- In
src/web/pages/repo.ts,forkBarnow returns alistCardholding onerow. The row has a fork icon and abadge("N fork(s)") that links to/forks. When the visitor can fork, abtn"Fork" form sits at the end of the row; it posts to/forkwith no fields, as before. - A repository with no forks shows a plain "Forks" title where the badge link would be. Previously the bar showed nothing at all in that case, unless the visitor could fork.
- A new test,
test/repo-fork-bar.test.ts, checks thatfork-baris absent and that the/forkslink, the badge, the Fork form and itsbtnclass are present. It also checks that the owner sees the count but no Fork form.
Left out
- The
.fork-barrule insrc/web/style/content.tsanddocs/DESIGN.mdare untouched; that is part two. - The row, badge and btn styling is not visually checked.
To try it
- Run
bun test test/repo-fork-bar.test.ts. - Or open any repository that has been forked while signed in as someone other than its owner.
The fork bar now uses listCard, row, badge and btn from ui.ts. It works with JavaScript off: the count is an <a> to /forks and Fork is a POST form with no fields. The owner gets no Fork form (the empty trail is dropped by row). Nothing in src/web/pages/repo.ts hand-rolls markup any more. I read the diff and the ui.ts helpers; I did not sign in on the preview, so the rendered row is unchecked. Two things to do next: (1) the .fork-bar rule at src/web/style/content.ts:294 and its entry in docs/DESIGN.md are now dead, so do part two soon and name its issue in the pull. (2) Add a test for a repository with zero forks, which now shows a Forks row to a visitor who can fork. Also tighten the toContain(class="row") assertion to something inside the fork card.
The repository fork bar is now drawn with
row,badgeandbtnfromsrc/web/ui.ts, and the repository page's HTML no longer containsfork-bar.bun x tsc --noEmit,test/design-lint.test.ts,test/following.test.tsand the new test pass. I did not run the whole suite or look at the page in a browser.What changed
src/web/pages/repo.ts,forkBarnow returns alistCardholding onerow. The row has a fork icon and abadge("N fork(s)") that links to/forks. When the visitor can fork, abtn"Fork" form sits at the end of the row; it posts to/forkwith no fields, as before.test/repo-fork-bar.test.ts, checks thatfork-baris absent and that the/forkslink, the badge, the Fork form and itsbtnclass are present. It also checks that the owner sees the count but no Fork form.Left out
.fork-barrule insrc/web/style/content.tsanddocs/DESIGN.mdare untouched; that is part two.To try it
bun test test/repo-fork-bar.test.ts.Closes #4168