diff --git a/src/app/components/building-passport/RecommendationCard.tsx b/src/app/components/building-passport/RecommendationCard.tsx new file mode 100644 index 00000000..71d9b2de --- /dev/null +++ b/src/app/components/building-passport/RecommendationCard.tsx @@ -0,0 +1,46 @@ +"use client"; +import { ComponentRecommendation } from "@/app/db/schema/recommendations"; +import { useState } from "react"; +import { formatNumber } from "@/app/utils"; + +export default function RecommendationCard({ + componentType, + recommendationData, +}: { + componentType: string; + recommendationData: ComponentRecommendation[]; +}) { + const defaultComponent = recommendationData.find( + (rec: ComponentRecommendation) => rec.default + ) as ComponentRecommendation; + + const [cardComponent, setCardComponent] = + useState(defaultComponent); + + return ( +
{ + console.log("clicked"); + // replace with your modal opening logic + }} + > +

{componentType}

+

{cardComponent.description}

+ + + + + + + {cardComponent.newUValue && ( + + + + + )} + +
Estimated Cost:{"£" + formatNumber(cardComponent.estimatedCost)}
New U-Value:{cardComponent.newUValue}
+
+ ); +} diff --git a/src/app/db/schema/recommendations.ts b/src/app/db/schema/recommendations.ts new file mode 100644 index 00000000..34d9a136 --- /dev/null +++ b/src/app/db/schema/recommendations.ts @@ -0,0 +1,14 @@ +export interface ComponentRecommendation { + id: number; + type: string; + description: string; + estimatedCost: number; + default: boolean; + newUValue?: number; +} + +export interface Recommendation { + Walls?: ComponentRecommendation[]; + Ventilation?: ComponentRecommendation[]; + Floor?: ComponentRecommendation[]; +} diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/recommendations/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/recommendations/page.tsx index 5dd791ed..5be43f26 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/recommendations/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/recommendations/page.tsx @@ -1,7 +1,83 @@ +import { + Recommendation, + ComponentRecommendation, +} from "@/app/db/schema/recommendations"; +import RecommendationCard from "@/app/components/building-passport/RecommendationCard"; + export default function Recommendations() { + const recommendations: Recommendation = { + Walls: [ + { + id: 1, + type: "internal_wall_insulation", + description: "140mm Mineral Wool internal wall insulation", + estimatedCost: 9_450, + default: true, + newUValue: 0.29, + }, + { + id: 2, + type: "internal_wall_insulation", + description: "30mm Vacuum Insulation Panels wall insulation", + estimatedCost: 10_135, + default: false, + newUValue: 0.28, + }, + { + id: 3, + type: "internal_external_wall_insulation", + description: + "80mm Mineral Wool External Wall Insulation and 30mm rigid insulation internal wall insulation", + estimatedCost: 13_450, + default: false, + newUValue: 0.25, + }, + ], + Ventilation: [ + { + id: 4, + type: "mechanical_ventilation", + description: "Two decentralised mechanical ventilation units", + estimatedCost: 750, + default: true, + }, + ], + Floor: [ + { + id: 5, + type: "suspended_floor_insulation", + description: "70mm Rigid insulation foam boards with floor screed", + estimatedCost: 3_450, + default: true, + newUValue: 0.24, + }, + { + id: 5, + type: "suspended_floor_insulation", + description: "90mm Rigid insulation foam boards with floor screed", + estimatedCost: 4_120, + default: true, + newUValue: 0.24, + }, + ], + }; + return ( -
-
Recommendations
+
+
Recommendations
+
+ {Object.entries(recommendations).map( + ([componentType, recommendationData], idx) => { + return ( + + ); + } + )} +
); }