Skip to content

Add Mortgage Refinancing Calculator (v3) to the framework#163

Open
jenbreese wants to merge 1 commit into
devfrom
mort-refi-v3-0718
Open

Add Mortgage Refinancing Calculator (v3) to the framework#163
jenbreese wants to merge 1 commit into
devfrom
mort-refi-v3-0718

Conversation

@jenbreese

Copy link
Copy Markdown
Collaborator

NOT READY FOR REVIEW

Summary

Incorporates the standalone v0/shadcn Mortgage Refinancing Calculator (v3) into this repo as a normal route so it can be reviewed and iterated on in-framework. This is a lift-and-fit only — the calculator's math and display are unchanged from the original. It's a starting point for deciding what to adapt to our conventions (Stanford tokens, shared UI components, validation rules, etc.), not a finished calculator.

What changed

New route (app/interactives/mortgage-refinancing-calculator-v3/)

  • page.tsx — the route: loads the original Geist fonts, renders the original header + , wrapped in a .mortgage-refi-v3 scope.

  • components/refinance-calculator.tsx — the calculator component, brought over as-is (only the broken import path fixed).

  • lib/mortgage.ts — the present-value / amortization helpers, unchanged.

  • theme.css — the v3 palette (light, class-dark, and system-preference dark), scoped to .mortgage-refi-v3 so it reproduces the original look without touching the Stanford tokens every other calculator uses.

  • globals.css — an unscoped reference copy of the original theme, kept for review (not imported by the build).

  • Shared theme (app/ui/globals.css)

  • Registered three color tokens in @theme that the calculator needs (--color-panel, --color-panel-foreground, --color-navy-foreground).

  • Moved brand navy behind a --navy variable (was an inlined literal) so it resolves identically for every existing bg-navy/text-navy while being overridable by scoped themes. All additive and behavior-preserving for other calculators.

Cleanup

  • Removed the standalone app scaffolding that would break the build: nested app/, package.json, pnpm-lock.yaml, next.config.mjs, postcss.config.mjs, components.json, tsconfig.json, .gitignore, and the unused components/ui/button.tsx / lib/utils.ts.
  • Fixed the one broken import (@/lib/mortgage → ../lib/mortgage).
  • Removed two pieces of dead code from the original that blocked us: an undefined setNewAmountTouched() call that crashed "Reset new loan terms," and an unused closingCosts prop that failed lint. Neither affects any calculation or displayed value.

Verification

  • yarn lint — passes (only a pre-existing warning in an unrelated file).
  • yarn build:local — succeeds; the route statically exports alongside all others.
  • yarn dev — route serves 200, renders correctly, dark mode and Reset both work.
  • Not in scope (follow-ups to review)
  • Still uses the original v0 palette/components rather than our shared shadcn primitives, InfoPopover, ThemeToggle, and Stanford tokens.
  • Does not yet follow our validation conventions (invalid-input-stays-visible, "Please enter…" messages, error/warning states, result suppression).
  • Math has not been re-derived/audited against our standards yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant