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

Copy an approved social post, with its property page link, in one tap from the listing #100

Merged opened this

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

Merged

Each approved social post on a listing now has a **Copy post** button, and a draft has none. The new tests and the walkthrough, a11y, listings, hostile and design suites pass. I ran those, not the whole suite; the forge runs the full check on the push. I didn't open the preview or tap the button in a browser.

shipped production is serving it deploy 957b843

opened this

Each approved social post on a listing now has a Copy post button, and a draft has none. The new tests and the walkthrough, a11y, listings, hostile and design suites pass. I ran those, not the whole suite; the forge runs the full check on the push. I didn't open the preview or tap the button in a browser.

  • What it copies: the approved words, then the listing's absolute property page URL (/homes/:id). If the words already carry that link, as the open house reminder does, it isn't added twice.
  • Without JavaScript: the page shows a "Copy post" disclosure holding a selectable read-only textarea with the same text.
  • With JavaScript: a few lines in static/listing.js show the button, hide the textarea fallback, copy with navigator.clipboard, and say "Copied the … with its link" in the existing aria-live region. Clipboard needs https, which production has.
  • Where: src/pages/listing.ts has the new copyPost and postCopy, and editor now takes the request origin. There is no inline script, and the CSP and contract are untouched. The README walkthrough has a "Copy a post" paragraph.
  • Tests: src/copy.test.ts checks that a draft has no copy block, an approved post shows its words plus the absolute link, hostile words stay escaped (<script>), and the page has no inline script.
  • One fix on the way: the a11y suite requires an aria-label to start with the visible text, so the button's label begins "Copy post: …".

I added no new CSS classes.

Not run here:

  • Type check: bun x tsc --noEmit can't run, because the repo has no tsconfig.json.
  • Gate and fast scripts: scripts/gate.ts and scripts/fast.ts don't exist.
  • Design lint: the script here is scripts/lint-design.ts, not design-lint.ts. I ran it and it printed no violations.

Closes #96

commented

Each approved social post on a listing now has a Copy post button, and a draft has none. The new tests and the walkthrough, a11y, listings, hostile and design suites pass. I ran those, not the whole suite; the forge runs the full check on the push. I didn't open the preview or tap the button in a browser.

  • What it copies: the approved words, then the listing's absolute property page URL (/homes/:id). If the words already carry that link, as the open house reminder does, it isn't added twice.
  • Without JavaScript: the page shows a "Copy post" disclosure holding a selectable read-only textarea with the same text.
  • With JavaScript: a few lines in static/listing.js show the button, hide the textarea fallback, copy with navigator.clipboard, and say "Copied the … with its link" in the existing aria-live region. Clipboard needs https, which production has.
  • Where: src/pages/listing.ts has the new copyPost and postCopy, and editor now takes the request origin. There is no inline script, and the CSP and contract are untouched. The README walkthrough has a "Copy a post" paragraph.
  • Tests: src/copy.test.ts checks that a draft has no copy block, an approved post shows its words plus the absolute link, hostile words stay escaped (<script>), and the page has no inline script.
  • One fix on the way: the a11y suite requires an aria-label to start with the visible text, so the button's label begins "Copy post: …".

I added no new CSS classes.

Not run here:

  • Type check: bun x tsc --noEmit can't run, because the repo has no tsconfig.json.
  • Gate and fast scripts: scripts/gate.ts and scripts/fast.ts don't exist.
  • Design lint: the script here is scripts/lint-design.ts, not design-lint.ts. I ran it and it printed no violations.
Approved

Clean. Copy post renders only for an approved social post; the text is escaped in the textarea; the origin is the server publicOrigin, not a client header; no inline script, CSP, contract and dependencies untouched. Tests cover draft, approved with absolute link, hostile words and the static script. The terminal already shows the same words and the property link, so no new door is needed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs