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

Show what is approved on the home list and mark unapproved flyers and emails as drafts #17

Merged opened this

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

Merged

The home list now shows each listing's approval state, and unapproved flyers and emails carry a draft band.

shipped production is serving it deploy 957b843

opened this

The home list now shows each listing's approval state, and unapproved flyers and emails carry a draft band.

I ran src/listings.test.ts, src/pages, src/openapi.test.ts, src/tty.test.ts, src/design.test.ts and src/contract.test.ts; the one failure was the stale contract/openapi.json, regenerated below. I did not run the full suite or bun x tsc --noEmit. There is no TypeScript in node_modules, and bun x tsc fetched tsc 7 and printed its help text, so the type check never ran. scripts/lint-design.ts printed nothing. There is no scripts/gate.ts, scripts/fast.ts or scripts/design-lint.ts in this clone, so I did not run those. I did not look at the pages in a browser or on the preview.

  • Home list: each card shows "Ready to send" or "N of M approved" before its Fair Housing pill. The pill is the same one the listing page uses, now a shared approvalPill in src/pages/listing.ts.
  • Live updates: approving or withdrawing already emits listing.changed, which the home list already listens for, so I changed neither live.ts nor live.js. The pill is server-rendered and swapped in place and doesn't wrap, so the card shouldn't shift. I haven't checked that in a browser.
  • Draft band: "Draft — not approved" appears on the flyer and email preview while that asset is unapproved, and not once it is approved. It also shows on the flyer thumbnail on the listing page. It is styled to survive printing (print-color-adjust: exact). The email band sits outside .email-card, so "Copy as email" doesn't copy it.
  • JSON and MCP: GET /api/listings and the MCP list tool now return approvals: [{kind, approved}] per listing. The single-listing JSON already had per-asset approval. I regenerated contract/openapi.json.
  • Test: one new test in src/listings.test.ts covers the list label ("0 of 6", "2 of 6", "Ready to send"), the band present and absent on both pages, and the new JSON field.
  • Permissions and dependencies: no permission cell changed and no dependency was added.

I did not touch src/tty.ts, which already showed approval. The bands are plain text with no per-asset detail, which the issue didn't ask for.

To try it: sign in, open a listing, approve the flyer and email, and watch the home list update without a reload. Then open /listings/:id/flyer and /listings/:id/email and print preview.

🤖 Generated with Claude Code

Closes #7

commented

The home list now shows each listing's approval state, and unapproved flyers and emails carry a draft band.

I ran src/listings.test.ts, src/pages, src/openapi.test.ts, src/tty.test.ts, src/design.test.ts and src/contract.test.ts; the one failure was the stale contract/openapi.json, regenerated below. I did not run the full suite or bun x tsc --noEmit. There is no TypeScript in node_modules, and bun x tsc fetched tsc 7 and printed its help text, so the type check never ran. scripts/lint-design.ts printed nothing. There is no scripts/gate.ts, scripts/fast.ts or scripts/design-lint.ts in this clone, so I did not run those. I did not look at the pages in a browser or on the preview.

  • Home list: each card shows "Ready to send" or "N of M approved" before its Fair Housing pill. The pill is the same one the listing page uses, now a shared approvalPill in src/pages/listing.ts.
  • Live updates: approving or withdrawing already emits listing.changed, which the home list already listens for, so I changed neither live.ts nor live.js. The pill is server-rendered and swapped in place and doesn't wrap, so the card shouldn't shift. I haven't checked that in a browser.
  • Draft band: "Draft — not approved" appears on the flyer and email preview while that asset is unapproved, and not once it is approved. It also shows on the flyer thumbnail on the listing page. It is styled to survive printing (print-color-adjust: exact). The email band sits outside .email-card, so "Copy as email" doesn't copy it.
  • JSON and MCP: GET /api/listings and the MCP list tool now return approvals: [{kind, approved}] per listing. The single-listing JSON already had per-asset approval. I regenerated contract/openapi.json.
  • Test: one new test in src/listings.test.ts covers the list label ("0 of 6", "2 of 6", "Ready to send"), the band present and absent on both pages, and the new JSON field.
  • Permissions and dependencies: no permission cell changed and no dependency was added.

I did not touch src/tty.ts, which already showed approval. The bands are plain text with no per-asset detail, which the issue didn't ask for.

To try it: sign in, open a listing, approve the flyer and email, and watch the home list update without a reload. Then open /listings/:id/flyer and /listings/:id/email and print preview.

🤖 Generated with Claude Code

Changes requested — before the latest push

The page, JSON and tests are sound and the preview serves it. One miss on the list: both doors. The home list now shows approval state, but the terminal's listings view (src/tty.ts:113-119) still shows only the Fair Housing flag and author, so a person at the terminal cannot see what is approved. Fix first: render approvalPill-equivalent text ("Ready to send" / "N of M approved") from l.approvals in that row, and add a tty.test.ts case that fails without it. The terminal's email preview (p) should also say it is a draft while the email asset is unapproved, as the page now does, with a test. Also state in the README how the draft band and list state read. Not run: tsc and the full suite (builder said they were not run either); please run bun x tsc --noEmit before pushing.

commented

The terminal now shows approval too, and I pushed the changes to the same branch. The type check still hasn't run.

  • Terminal list: each row in src/tty.ts now reads "Ready to send" or "N of M approved" from l.approvals, before the Fair Housing flag. "Ready to send" is green and the rest is dim.
  • Terminal email preview (p): it starts with "DRAFT — not approved" while the email asset is unapproved, and the line is gone once it is approved.
  • Shared wording: a new approvalLabel in src/listing.ts produces the label text. The page pill and the terminal both use it, so the wording lives in one place.
  • Test: a new case in src/tty.test.ts checks the list label ("0 of 6 approved", then "Ready to send"). It also checks the draft line in the preview, present and then absent. I didn't run it against the old code to see it fail, but both strings are new, so it would.
  • README: it now says how the list state and the draft band read, on the page, on paper, in the JSON/MCP and in the terminal.
  • Tests run: src/tty.test.ts, src/listings.test.ts, src/pages, src/openapi.test.ts and src/design.test.ts pass (40 tests). I did not run the full suite.
  • bun x tsc --noEmit: I did not get a type check. The repo has no tsconfig.json and no TypeScript in node_modules, so bun x tsc just printed tsc's help. The forge's check will have to cover types.
Approved

Approved. The earlier ask, terminal parity, is met: the tty list shows Ready to send / N of M approved, and the email preview shows a DRAFT line until the email asset is approved. Both use the shared approvalLabel, and src/tty.test.ts covers them. The page, the JSON/MCP approvals field (openapi regenerated), the README and the web test are all in place. No permission cell changed, there is no new dependency, and output stays escaped. The preview answers 200. Non-blocking: the type check was not run by the builder, so rely on the forge check for it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs