Skip to content

Commit

Permalink
feat: move mortgage constants and import into CalculatorInput
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-hh-aa committed Jan 10, 2025
1 parent 2235111 commit 8db84c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions app/components/ui/CalculatorInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Household } from "@/app/models/Household";
import Dashboard from "./Dashboard";
import { formSchema, FormFrontend } from "@/app/schemas/formSchema";
import { useSearchParams } from "next/navigation";
import { DEFAULT_INTEREST_RATE, DEFAULT_MORTGAGE_TERM, DEFAULT_INITIAL_DEPOSIT } from "../../models/constants"

import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { ClipLoader } from "react-spinners";
Expand Down Expand Up @@ -327,19 +328,19 @@ const CalculatorInput = () => {
<span className="h3-style inaccessible-input-style">
Mortgage interest rate
</span>
<span className="inaccessible-input-style">6%</span> {/* TODO: should we hook these up to the actual variables used so we don't have to maintain them in two places? */}
<span className="inaccessible-input-style">{DEFAULT_INTEREST_RATE * 100}%</span>
</div>
<div className="flex flex-col">
<span className="h3-style inaccessible-input-style">
Mortgage term
</span>
<span className="inaccessible-input-style">30 years</span>
<span className="inaccessible-input-style">{DEFAULT_MORTGAGE_TERM} years</span>
</div>
<div className="flex flex-col">
<span className="h3-style inaccessible-input-style">
Mortgage deposit
</span>
<span className="inaccessible-input-style">15%</span>
<span className="inaccessible-input-style">{DEFAULT_INITIAL_DEPOSIT * 100}%</span>
</div>
</div>

Expand Down
7 changes: 1 addition & 6 deletions app/models/Mortgage.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { MONTHS_PER_YEAR } from "./constants";

const DEFAULT_INTEREST_RATE = 0.06;
const DEFAULT_MORTGAGE_TERM = 30;
const DEFAULT_INITIAL_DEPOSIT = 0.15;

import { MONTHS_PER_YEAR, DEFAULT_INTEREST_RATE, DEFAULT_MORTGAGE_TERM, DEFAULT_INITIAL_DEPOSIT } from "./constants";
interface MortgageParams {
propertyValue: number;
interestRate?: number;
Expand Down
4 changes: 4 additions & 0 deletions app/models/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export const MONTHS_PER_YEAR = 12;
export const WEEKS_PER_MONTH = 4.2;

export const DEFAULT_INTEREST_RATE = 0.06;
export const DEFAULT_MORTGAGE_TERM = 30;
export const DEFAULT_INITIAL_DEPOSIT = 0.15;

export type BedWeightsAndCaps = {
numberOfBedrooms: number[];
weight: number[];
Expand Down

0 comments on commit 8db84c1

Please sign in to comment.