From b233841d16f1fefba131a1f0ccc153406c9ca992 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 31 May 2023 18:55:13 +0100 Subject: [PATCH] further tidying of plan page --- src/app/components/plan/PartModal.tsx | 4 ++-- src/app/components/plan/PlanPart.tsx | 2 +- src/app/portfolio/[slug]/property/[lmkKey]/plan/page.tsx | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/components/plan/PartModal.tsx b/src/app/components/plan/PartModal.tsx index ace394f..9c1448d 100644 --- a/src/app/components/plan/PartModal.tsx +++ b/src/app/components/plan/PartModal.tsx @@ -15,7 +15,7 @@ type PartModalProps = { parts: Part[]; setParts: Dispatch>; partIndex: number; - setTotalCost: Dispatch>; + setTotalCost: Dispatch>; setWorkHours: Dispatch>; setCo2Reduction: Dispatch>; }; @@ -39,7 +39,7 @@ export default function PartModal({ setSelectedOption(optionInput); // recalculate total cost parts[partIndex].cost = costInput; - setTotalCost(formatNumber(parts.reduce((sum, part) => sum + part.cost, 0))); + setTotalCost(parts.reduce((sum, part) => sum + part.cost, 0)); // recalculate total hours parts[partIndex].workHours = hoursInput; diff --git a/src/app/components/plan/PlanPart.tsx b/src/app/components/plan/PlanPart.tsx index 9878d28..8b3432f 100644 --- a/src/app/components/plan/PlanPart.tsx +++ b/src/app/components/plan/PlanPart.tsx @@ -12,7 +12,7 @@ type PlanPartProps = { workHours: number; parts: Part[]; setParts: Dispatch>; - setTotalCost: Dispatch>; + setTotalCost: Dispatch>; setWorkHours: Dispatch>; setCo2Reduction: Dispatch>; }; diff --git a/src/app/portfolio/[slug]/property/[lmkKey]/plan/page.tsx b/src/app/portfolio/[slug]/property/[lmkKey]/plan/page.tsx index 66922ff..897ef98 100644 --- a/src/app/portfolio/[slug]/property/[lmkKey]/plan/page.tsx +++ b/src/app/portfolio/[slug]/property/[lmkKey]/plan/page.tsx @@ -125,8 +125,8 @@ export default function Plan({ const [parts, setParts] = useState(partsConfig); const [budget, setBudget] = useState("Not set"); - const [totalCost, setTotalCost] = useState( - formatNumber(parts.reduce((sum, part) => sum + part.cost, 0)) + const [totalCost, setTotalCost] = useState( + parts.reduce((sum, part) => sum + part.cost, 0) ); const [workHours, setWorkHours] = useState( parts.reduce((sum, part) => sum + part.workHours, 0) @@ -219,7 +219,9 @@ export default function Plan({ -
  • Total cost: £{totalCost}
  • +
  • + Total cost: £{formatNumber(totalCost)} +
  • Installation Time: {roundToDecimalPlaces(workHours, 0)} hours