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

opened this

Merged 26d 4h ago, live in production

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.

Notes

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.

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.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs