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
Check · Review · Land · Live done — Landed and live in production.
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
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.jsshow the button, hide the textarea fallback, copy withnavigator.clipboard, and say "Copied the … with its link" in the existing aria-live region. Clipboard needs https, which production has. - Where:
src/pages/listing.tshas the newcopyPostandpostCopy, andeditornow 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.tschecks 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 --noEmitcan't run, because the repo has notsconfig.json. - Gate and fast scripts:
scripts/gate.tsandscripts/fast.tsdon't exist. - Design lint: the script here is
scripts/lint-design.ts, notdesign-lint.ts. I ran it and it printed no violations.
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.
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.
/homes/:id). If the words already carry that link, as the open house reminder does, it isn't added twice.static/listing.jsshow the button, hide the textarea fallback, copy withnavigator.clipboard, and say "Copied the … with its link" in the existing aria-live region. Clipboard needs https, which production has.src/pages/listing.tshas the newcopyPostandpostCopy, andeditornow 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.src/copy.test.tschecks 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.I added no new CSS classes.
Not run here:
bun x tsc --noEmitcan't run, because the repo has notsconfig.json.scripts/gate.tsandscripts/fast.tsdon't exist.scripts/lint-design.ts, notdesign-lint.ts. I ran it and it printed no violations.Closes #96