Public: anyone can read this; the crew can change it.

A repository's audience mark is §5's badge, and .repo-audience leaves the stylesheet #4627

opened this

Parked 43d 16h ago

The repository header now draws the audience as a single §5 .badge, and .repo-audience is gone from the stylesheet and from DESIGN.md §5d. Badge: the header shows one badge instead of the old badge plus a sentence line.

Notes

opened this

The repository header now draws the audience as a single §5 .badge, and .repo-audience is gone from the stylesheet and from DESIGN.md §5d.

  • Badge: the header shows one badge instead of the old badge plus a sentence line. The audience sentence from audienceOf is now the badge's title (hover text), so it no longer shows as visible text on the page. src/web/chrome.ts draws it; for someone who can open the settings, the badge links there.
  • badge(): src/web/ui.ts gains an optional title, which is the one change outside the files the issue named.
  • Cleanup: the .repo-audience rules and the phone-width overrides are removed from src/web/style/content.ts.
  • Tests:
    • test/repo-audience.test.ts and test/audience-surfaces.test.ts now fetch the repository page and assert the badge with its word and title.
    • They also assert the settings link for a writer, no link for a reader, and that no repo-audience class remains.
    • Those two files and test/design-lint.test.ts pass (20 tests), and bun scripts/design-lint.ts is clean.
  • Not run: the type check, because bun x tsc --noEmit fails here (Cannot find type definition file for 'bun') even after bun install. I also did not run the full bun test.

I left two things out:

  • "unlisted": the issue lists it, but no such audience exists in the code, so the badge shows only Public or Private.
  • Baseline: docs/design/baseline.json is empty, so there was nothing to lower.

To try it, open any repository page and hover the Public or Private badge.

Closes #4589

6 earlier comments
commented

The repository header now draws the audience as a single §5 .badge, and .repo-audience is gone from the stylesheet and from DESIGN.md §5d.

  • Badge: the header shows one badge instead of the old badge plus a sentence line. The audience sentence from audienceOf is now the badge's title (hover text), so it no longer shows as visible text on the page. src/web/chrome.ts draws it; for someone who can open the settings, the badge links there.
  • badge(): src/web/ui.ts gains an optional title, which is the one change outside the files the issue named.
  • Cleanup: the .repo-audience rules and the phone-width overrides are removed from src/web/style/content.ts.
  • Tests:
    • test/repo-audience.test.ts and test/audience-surfaces.test.ts now fetch the repository page and assert the badge with its word and title.
    • They also assert the settings link for a writer, no link for a reader, and that no repo-audience class remains.
    • Those two files and test/design-lint.test.ts pass (20 tests), and bun scripts/design-lint.ts is clean.
  • Not run: the type check, because bun x tsc --noEmit fails here (Cannot find type definition file for 'bun') even after bun install. I also did not run the full bun test.

I left two things out:

  • "unlisted": the issue lists it, but no such audience exists in the code, so the badge shows only Public or Private.
  • Baseline: docs/design/baseline.json is empty, so there was nothing to lower.

To try it, open any repository page and hover the Public or Private badge.

commented

A repository's audience is now drawn as one §5 .badge, and .repo-audience is gone from src/web/style/content.ts and DESIGN.md §5d.

I could not run the type check here (no usable TypeScript in this sandbox), so the fix for the failing check is untested against tsc. The forge's check on this push will be the first real run.

  • Badge: the header shows Public or Private with the audience sentence in the badge's title (hover text). Anyone who can open the settings gets the badge as a link there. src/web/chrome.ts draws it, and badge() in src/web/ui.ts gained an optional title.
  • Check failure: audienceBadge passed title: undefined where exactOptionalPropertyTypes forbids it. It now leaves title out when there isn't one. The tests I ran pass: test/repo-audience.test.ts and test/audience-surfaces.test.ts.
  • Tests: they fetch a repository page and assert the badge, its word and its title. They also assert the settings link for a writer, none for a reader, and no leftover repo-audience class.
  • Left out:
    • "unlisted" isn't an audience the code has, so the badge says only Public or Private.
    • docs/design/baseline.json is empty, so there was nothing to lower.

To try it, open any repository page and hover the badge.

commented

The audience mark is now §5's badge with the audience sentence kept as visible text beside it. .repo-audience is removed from src/web/style/content.ts and from DESIGN.md §5d.

  • Badge and sentence: the header shows a Public or Private .badge, followed by the one-sentence audience from audienceOf. The sentence is plain text, so there is nothing to hover and a screen reader reads it as is.
  • Settings link: for someone who can open the settings, the sentence is a ghost, small btn link to them. Its accessible name is the whole sentence, and .btn already makes it a 44px target on touch pointers.
  • title option: I reverted the title option I had added to badge() in src/web/ui.ts, since nothing uses it now. src/web/ui.ts is back to main's version.
  • Tests: test/repo-audience.test.ts and test/audience-surfaces.test.ts now assert the visible text and the settings link, and no repo-audience class. The writer, reader and signed-out cases pass, and so does test/design-lint.test.ts, with bun scripts/design-lint.ts clean.
  • Type check: ./node_modules/typescript/bin/tsc --noEmit now runs here after bun install and prints nothing, so it is clean. The earlier bun x tsc failure was only the missing node_modules.

One thing I did not check: the sentence in the admin button is long, so how it wraps on a 360px phone is unverified. If .btn doesn't wrap it, the fix is a small wrapping rule in src/web/style/components.ts.

"unlisted" is still left out because the code has no such audience.

commented

The repository header now shows a Public or Private .badge, then the audience sentence as plain wrappable text. Admins get a short "Settings" button after it.

That sentence is the same muted small span for everyone, so it wraps on a 360px phone and the nowrap .btn no longer holds anything long. The Settings button is a ghost, small btn link, so it is a 44px target on touch pointers and works without JavaScript. This follows juniper's first suggestion and needs no new CSS or docs entry.

.repo-audience is gone from src/web/style/content.ts and from DESIGN.md §5d.

Checks: the type check (./node_modules/typescript/bin/tsc --noEmit) prints nothing. bun scripts/design-lint.ts is clean, and test/repo-audience.test.ts, test/audience-surfaces.test.ts and test/design-lint.test.ts pass (20 tests). I did not run the full bun test. I did not look at the page in a 360px browser; the wrapping rests on .muted/.small having no nowrap, which I did not check.

Tests: they cover the writer, the reader and the signed-out viewer, assert the visible sentence and the Settings link, and a new test checks the writer and the reader read the same sentence.

Left out:

  • "unlisted" is still not drawn, because the code has no such audience.
  • docs/design/baseline.json is empty, so there was nothing to lower.

To try it, open any repository page, signed in as someone who can open its settings and as someone who can't, and compare the headers.

commented

I merged main into the branch and pushed it. The only conflict was in docs/DESIGN.md.

  • Conflict: it was the one long §5d line that lists the classes in style/content.ts. I took main's version of that line and removed the .repo-audience entry from it. main's other additions to the list are kept, and no repo-audience remains in docs/DESIGN.md or style/content.ts.
  • Checks: bun test test/repo-audience.test.ts test/audience-surfaces.test.ts test/design-lint.test.ts passes (21 tests). The design lint and ./node_modules/typescript/bin/tsc --noEmit are clean. I did not run the full bun test.

The pull itself is unchanged by the merge. It is still §5's .badge with the audience word, the sentence as wrappable text for everyone, and a short Settings button for admins. "unlisted" is still not drawn, because the code has no such audience, and docs/design/baseline.json was empty, so there was nothing to lower.

commented

I merged main into the branch again and pushed it. The only conflict was in docs/DESIGN.md, the same single long §5d class-list line as last time.

I took main's version of that line, so everything main added to the list is kept, and removed the .repo-audience entry. No repo-audience remains in docs/DESIGN.md or src/web/style/content.ts.

bun test test/repo-audience.test.ts test/audience-surfaces.test.ts test/design-lint.test.ts passes (21 tests). The design lint and ./node_modules/typescript/bin/tsc --noEmit are clean. I did not run the full bun test.

The pull is otherwise unchanged by the merge. It is still §5's .badge with the audience word, the sentence as wrappable text for everyone, and a short Settings button for admins. "unlisted" is still not drawn, because the code has no such audience, and docs/design/baseline.json is empty, so there was nothing to lower.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs