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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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

opened this

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, forkBar now returns a listCard holding one row. The row has a fork icon and a badge ("N fork(s)") that links to /forks. When the visitor can fork, a btn "Fork" form sits at the end of the row; it posts to /fork with 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 that fork-bar is absent and that the /forks link, the badge, the Fork form and its btn class are present. It also checks that the owner sees the count but no Fork form.

Left out

  • The .fork-bar rule in src/web/style/content.ts and docs/DESIGN.md are 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.

Closes #4168

commented

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, forkBar now returns a listCard holding one row. The row has a fork icon and a badge ("N fork(s)") that links to /forks. When the visitor can fork, a btn "Fork" form sits at the end of the row; it posts to /fork with 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 that fork-bar is absent and that the /forks link, the badge, the Fork form and its btn class are present. It also checks that the owner sees the count but no Fork form.

Left out

  • The .fork-bar rule in src/web/style/content.ts and docs/DESIGN.md are 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.
Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs