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

The property page shows an estimated monthly payment for the home, with its assumptions in plain words #101

Merged opened this

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

Merged

Active and coming-soon property pages now show "Est. $X/mo" under the price, with one line of assumptions. A $500,000 home reads "Est. $2,528/mo".

shipped production is serving it deploy 957b843

opened this

Active and coming-soon property pages now show "Est. $X/mo" under the price, with one line of assumptions. A $500,000 home reads "Est. $2,528/mo".

  • New module: src/payment.ts is pure. monthlyPayment(price) returns principal and interest per month in whole dollars, rounded to the nearest dollar. It returns null for a missing, $0, negative or non-finite price. The assumptions are named constants: DOWN_PAYMENT 20%, TERM_YEARS 30 and ANNUAL_RATE 6.5%. The 6.5% is a sample rate with no rate feed, so it is a placeholder someone should confirm.
  • Wording: PAYMENT_NOTE reads "Principal and interest at 20% down, a 30-year fixed rate of 6.5%. An estimate, not a loan offer."
  • Page: src/pages/property.ts shows the estimate only for active and coming_soon. Under contract, sold, withdrawn and expired pages show none, and the off-market page is untouched. The two new classes, home-payment and home-payment-note, are named in docs/design/areas/property.md.
  • Tests:

- src/payment.test.ts checks known prices to the dollar, rounding, the null cases and the note's wording. - src/property.test.ts checks the line appears on the active page and not on the sold one. - payment.test.ts, property.test.ts and design.test.ts pass, 25 tests.

  • README: a short paragraph in the agent section says what the line means.
  • Not run: scripts/gate.ts and scripts/design-lint.ts don't exist in this repo. scripts/lint-design.ts ran and printed nothing. bun x tsc --noEmit printed its usage text instead of checking, because typescript isn't installed and bun install didn't add it. I did not run the full suite or the speed test; the forge's check runs them on the push.
  • Contract: no cell changes.

To try it, approve a listing's MLS description, then open /homes/:id. Marking the listing sold removes the estimate.

🤖 Generated with Claude Code

Closes #95

commented

Active and coming-soon property pages now show "Est. $X/mo" under the price, with one line of assumptions. A $500,000 home reads "Est. $2,528/mo".

  • New module: src/payment.ts is pure. monthlyPayment(price) returns principal and interest per month in whole dollars, rounded to the nearest dollar. It returns null for a missing, $0, negative or non-finite price. The assumptions are named constants: DOWN_PAYMENT 20%, TERM_YEARS 30 and ANNUAL_RATE 6.5%. The 6.5% is a sample rate with no rate feed, so it is a placeholder someone should confirm.
  • Wording: PAYMENT_NOTE reads "Principal and interest at 20% down, a 30-year fixed rate of 6.5%. An estimate, not a loan offer."
  • Page: src/pages/property.ts shows the estimate only for active and coming_soon. Under contract, sold, withdrawn and expired pages show none, and the off-market page is untouched. The two new classes, home-payment and home-payment-note, are named in docs/design/areas/property.md.
  • Tests:

- src/payment.test.ts checks known prices to the dollar, rounding, the null cases and the note's wording. - src/property.test.ts checks the line appears on the active page and not on the sold one. - payment.test.ts, property.test.ts and design.test.ts pass, 25 tests.

  • README: a short paragraph in the agent section says what the line means.
  • Not run: scripts/gate.ts and scripts/design-lint.ts don't exist in this repo. scripts/lint-design.ts ran and printed nothing. bun x tsc --noEmit printed its usage text instead of checking, because typescript isn't installed and bun install didn't add it. I did not run the full suite or the speed test; the forge's check runs them on the push.
  • Contract: no cell changes.

To try it, approve a listing's MLS description, then open /homes/:id. Marking the listing sold removes the estimate.

🤖 Generated with Claude Code

Changes requested — before the latest push

The feature works and the maths checks out ($500,000 gives $2,528). One thing to fix first: the status gate is not tested where it matters. A sold page is not off-market, so it goes through the same propertyPage path. The only test of the gate is the sold one. Nothing proves that coming_soon shows the line or that under_contract hides it. Removing the active || coming_soon check would still pass most of it. Add both cases, plus a test that a $0 price shows nothing on the page. Also fix the wrong comment in payment.test.ts. Everything else is clean: no contract change, no dependency, the new classes are named in the area doc, and the README covers it.

commented

I added the status-gate tests @sentinel asked for and corrected the wrong comment. I ran src/property.test.ts and src/payment.test.ts: 20 pass, 0 fail.

Changes since the last push (tests and a comment only; app code is untouched):

  • src/property.test.ts: three new tests, each on a page an anonymous visitor sees after the listing's page words are approved.

- A coming-soon page shows "Est. $" and "not a loan offer". - An under-contract page shows neither. - A listing with a $0 price shows no estimate.

  • src/payment.test.ts:9: the comment now reads "200,000 financed -> 1264.14". The assertion was already correct at 1264, since the true figure rounds down. I did not change the price.

I did not run a mutation check by removing the active || coming_soon gate. The tests exercise that gate, but I haven't seen them fail without it.

I did not run bun x tsc --noEmit. The repository has no tsconfig.json, so tsc just prints its help text. bun install also rewrote the lockfile in my working tree; I left that out of the commit.

To try it: bun test src/property.test.ts src/payment.test.ts.

🤖 Generated with Claude Code

Approved

Both earlier asks are met. The coming-soon, under-contract and $0-price page tests now exercise the status gate, and the payment.test.ts comment is corrected. Rounding is still shown by the 100k and 300k cases. No contract cell changed, there is no new door or write, and the note is escaped. Non-blocking: the 6.5% sample rate should be confirmed by a person.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs