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

Copy the approved MLS description in one tap from the listing, as plain text ready for the MLS #114

Merged opened this

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

Merged

An approved MLS description now has a **Copy for MLS** button that copies it as plain text. A draft has no copy control. I didn't try it on the running app. Of the checks, only `src/copy.test.ts`, `src/a11y.test.ts` and the tests under `src/pages` and `src/listing` ran, and they pass. `scripts/design-lint.ts` and `scripts/fast.ts` don't exist in this clone, so I skipped them. `bun x tsc --noEmit`…

shipped production is serving it deploy 957b843

opened this

An approved MLS description now has a Copy for MLS button that copies it as plain text. A draft has no copy control. I didn't try it on the running app. Of the checks, only src/copy.test.ts, src/a11y.test.ts and the tests under src/pages and src/listing ran, and they pass. scripts/design-lint.ts and scripts/fast.ts don't exist in this clone, so I skipped them. bun x tsc --noEmit printed only its help text, so it checked nothing.

What changed

  • src/pages/listing.ts: the Copy post block now serves both social posts and the MLS description, so the MLS version is built the same way as Copy post. With JavaScript you get a button. Without it you get the same words in a selectable read-only box.
  • New mlsCopy builds the copied text from the approved words only. It strips HTML tags, http(s) links and emoji, normalises line endings, trims each line and collapses runs of blank lines to one. Paragraph breaks stay.
  • static/listing.js: the button now reads its own label from the page (data-name), so "Copy for MLS" resets correctly after "Copied". The announcement no longer says "with its link", which wasn't true for MLS.
  • README.md: one paragraph after the Copy post one.
  • src/copy.test.ts: two new tests. A draft shows no "Copy for MLS". An approved description shows the button, and the no-JavaScript box holds the exact text, Sunny home with bonus room.\n\nSee now., with the emoji, <b>, link and extra blank lines removed.

What I chose not to do

  • I didn't change the Fair Housing check or the length meter.
  • I didn't change any permission.
  • The page's HTML is also unescaped for the box, but it's escaped on output like the social post's.

To try it Open a listing, approve the MLS description, and look under the MLS text for Copy for MLS.

Closes #107

commented

An approved MLS description now has a Copy for MLS button that copies it as plain text. A draft has no copy control. I didn't try it on the running app. Of the checks, only src/copy.test.ts, src/a11y.test.ts and the tests under src/pages and src/listing ran, and they pass. scripts/design-lint.ts and scripts/fast.ts don't exist in this clone, so I skipped them. bun x tsc --noEmit printed only its help text, so it checked nothing.

What changed

  • src/pages/listing.ts: the Copy post block now serves both social posts and the MLS description, so the MLS version is built the same way as Copy post. With JavaScript you get a button. Without it you get the same words in a selectable read-only box.
  • New mlsCopy builds the copied text from the approved words only. It strips HTML tags, http(s) links and emoji, normalises line endings, trims each line and collapses runs of blank lines to one. Paragraph breaks stay.
  • static/listing.js: the button now reads its own label from the page (data-name), so "Copy for MLS" resets correctly after "Copied". The announcement no longer says "with its link", which wasn't true for MLS.
  • README.md: one paragraph after the Copy post one.
  • src/copy.test.ts: two new tests. A draft shows no "Copy for MLS". An approved description shows the button, and the no-JavaScript box holds the exact text, Sunny home with bonus room.\n\nSee now., with the emoji, <b>, link and extra blank lines removed.

What I chose not to do

  • I didn't change the Fair Housing check or the length meter.
  • I didn't change any permission.
  • The page's HTML is also unescaped for the box, but it's escaped on output like the social post's.

To try it Open a listing, approve the MLS description, and look under the MLS text for Copy for MLS.

Changes requested — before the latest push

Works as designed, but fix these in one round:

  1. mlsCopy's tag strip <[^>]> eats real prose: "under <$500k, 3 bd >" loses everything between the angle brackets. Only strip things shaped like tags (<\/?[a-zA-Z][^>]>) and test a < / > in plain text.
  2. \p{Extended_Pictographic} also matches ©, ®, ™ and similar marks, which the MLS text may legitimately carry. Strip emoji without those (keep ©®™) and test it.
  3. The test casts as never to hide a type error and expect(html).toContain("hidden") proves nothing. Type the edit call properly, and assert the button carries data-name="Copy for MLS" and the <details> summary reads Copy for MLS. Also add a test that the social Copy post still carries data-name="Copy post" (the JS reset now depends on it).
  4. README: the new sentence is an unwrapped, bolded run-on glued to step 8, and does not say where the realtor sees it. Wrap it like the rest, put it as its own paragraph and name the sample listing's MLS description, as #105 required.
  5. what[0].toUpperCase() is a clumsy way to build the aria-label; pass explicit labels instead.
  6. Verification gap: tsc was not run (it printed help only) and design-lint was skipped. Box 4 requires design-lint and the a11y test to pass; run what you can and say what you could not.
commented

This round addresses all six of sentinel's points on #114. The full bun test run passes (404 tests). I could not run tsc, so the type error behind the as never cast is unconfirmed.

What changed

  • Tag strip: mlsCopy now strips only things shaped like tags (/<\/?[a-zA-Z][^>]*>/g). "under <$500k, 3 bd >" keeps its text.
  • Emoji strip: the pattern no longer removes ©, ® or ™.
  • Tests:

- I removed the as never casts, so the editAsset calls are typed. I have not seen tsc accept them, so that is untested. - The MLS test now asserts the button carries data-name="Copy for MLS" and is hidden, and that the <summary> reads "Copy for MLS". - A new test covers a literal < / > in prose together with ©®™, tags and emoji. - A new test checks that the social post keeps data-name="Copy post" and its summary, since the JS reset depends on it.

  • aria-label: the box label is now an explicit string, so what[0].toUpperCase() is gone.
  • README: the Copy for MLS sentence is now its own wrapped paragraph after the Copy post paragraph, not glued to step 8. It names the sample 412 Alder Lane MLS description, which is already approved.

What I could not run

  • tsc: the repo has no tsconfig.json and TypeScript is not installed, so bun x tsc --noEmit only prints help.
  • scripts/gate.ts and scripts/fast.ts: neither exists in this clone. I ran bun test over all files instead.
  • design-lint: the script here is scripts/lint-design.ts, not design-lint.ts. It ran and printed nothing.
  • A11y test: there is no separate a11y test that I could find. It would have been part of the full bun test run.

I did not change who can do what. There is no new permission and no cell is loosened.

Approved

All earlier asks are met: tag strip is now tag-shaped only, ©®™ are kept, the casts are gone and typed, tests assert data-name/hidden/summary, the aria-label is explicit, and the README paragraph stands on its own. The preview shows Copy for MLS on listing 1 (approved sample) with plain text in the no-JS box and none on the drafts. No contract cell is touched. Non-blocking: the repo has no tsconfig, so the type check is unconfirmed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs