mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
further tidying of plan page
This commit is contained in:
parent
a2dcd49b39
commit
b233841d16
3 changed files with 8 additions and 6 deletions
|
|
@ -15,7 +15,7 @@ type PartModalProps = {
|
|||
parts: Part[];
|
||||
setParts: Dispatch<SetStateAction<Part[]>>;
|
||||
partIndex: number;
|
||||
setTotalCost: Dispatch<SetStateAction<string>>;
|
||||
setTotalCost: Dispatch<SetStateAction<number>>;
|
||||
setWorkHours: Dispatch<SetStateAction<number>>;
|
||||
setCo2Reduction: Dispatch<SetStateAction<number>>;
|
||||
};
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ type PlanPartProps = {
|
|||
workHours: number;
|
||||
parts: Part[];
|
||||
setParts: Dispatch<SetStateAction<Part[]>>;
|
||||
setTotalCost: Dispatch<SetStateAction<string>>;
|
||||
setTotalCost: Dispatch<SetStateAction<number>>;
|
||||
setWorkHours: Dispatch<SetStateAction<number>>;
|
||||
setCo2Reduction: Dispatch<SetStateAction<number>>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ export default function Plan({
|
|||
const [parts, setParts] = useState<Part[]>(partsConfig);
|
||||
|
||||
const [budget, setBudget] = useState<number | "Not set">("Not set");
|
||||
const [totalCost, setTotalCost] = useState<string>(
|
||||
formatNumber(parts.reduce((sum, part) => sum + part.cost, 0))
|
||||
const [totalCost, setTotalCost] = useState<number>(
|
||||
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({
|
|||
<PencilSquareIcon className="h-6 w-6 ml-2" />
|
||||
</li>
|
||||
</Link>
|
||||
<li className="px-2 mb-2">Total cost: £{totalCost}</li>
|
||||
<li className="px-2 mb-2">
|
||||
Total cost: £{formatNumber(totalCost)}
|
||||
</li>
|
||||
<li className="px-2 mb-2">
|
||||
Installation Time: {roundToDecimalPlaces(workHours, 0)} hours
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue