From ea600d49aaa4533e54a1f386b3de36a33f383caa Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 5 Sep 2024 18:42:35 +0100 Subject: [PATCH] adding variables to capture the impact of the new recommendations in the plan --- README.md | 8 +++++ .../building-passport/RecommendationCard.tsx | 4 +++ .../RecommendationContainer.tsx | 35 +++++++++++++++++++ src/app/db/schema/recommendations.ts | 5 ++- src/types/recommendations.ts | 3 ++ 5 files changed, 54 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b58ac46..e720d02 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next ## Getting Started +When first getting set up you'll firstly want to install the existing dependencies. To do this, simply run + +```bash +npm install +# or +yarn install +``` + First, run the development server: ```bash diff --git a/src/app/components/building-passport/RecommendationCard.tsx b/src/app/components/building-passport/RecommendationCard.tsx index cace886..f53826c 100644 --- a/src/app/components/building-passport/RecommendationCard.tsx +++ b/src/app/components/building-passport/RecommendationCard.tsx @@ -17,6 +17,7 @@ const alreadyInstalledStyling = const TitleMap = { mechanical_ventilation: "Mechanical Ventilation", + trickle_vents: "Trickle Vents", sealing_open_fireplace: "Sealing Open Fireplace", low_energy_lighting: "Low Energy Lighting", // Walls @@ -33,6 +34,7 @@ const TitleMap = { exposed_floor_insulation: "Exposed Floor Insulation", // Windows windows_glazing: "Window Glazing", + mixed_glazing: "Mixed - Secondary and Double Glazing", // Solar pv solar_pv: "Solar Photovoltaic Panels System", // Heating @@ -47,6 +49,8 @@ const TitleMap = { roof_insulation: "Roof Insulation", // Cylinder thermostat cylinder_thermostat: "Cylinder Thermostat", + // Draught proofing + draught_proofing: "Draught Proofing", }; type RecommendationCardProps = { diff --git a/src/app/components/building-passport/RecommendationContainer.tsx b/src/app/components/building-passport/RecommendationContainer.tsx index 951e6af..50cf27b 100644 --- a/src/app/components/building-passport/RecommendationContainer.tsx +++ b/src/app/components/building-passport/RecommendationContainer.tsx @@ -127,6 +127,21 @@ export default function RecommendationContainer({ (rec: Recommendation) => rec.default ) || emptyImpactState; + const defaultTrickleVentsRecommendations = + categorizedRecommendations.trickle_vents?.find( + (rec: Recommendation) => rec.default + ) || emptyImpactState; + + const defaultMixedGlazingRecommendations = + categorizedRecommendations.mixed_glazing?.find( + (rec: Recommendation) => rec.default + ) || emptyImpactState; + + const defaultDraughtProofingRecommendations = + categorizedRecommendations.draught_proofing?.find( + (rec: Recommendation) => rec.default + ) || emptyImpactState; + const [costMap, setCostMap] = useState({ wall_insulation: defaultWallsRecommendations.estimatedCost || 0, floor_insulation: defaultFloorRecommendations.estimatedCost || 0, @@ -145,6 +160,9 @@ export default function RecommendationContainer({ defaultSecondaryHeatingRecommendations.estimatedCost || 0, cylinder_thermostat: defaultCylinderThermostatRecommendations.estimatedCost || 0, + trickle_vents: defaultTrickleVentsRecommendations.estimatedCost || 0, + mixed_glazing: defaultMixedGlazingRecommendations.estimatedCost || 0, + draught_proofing: defaultDraughtProofingRecommendations.estimatedCost || 0, }); const [sapMap, setSapMap] = useState({ @@ -163,6 +181,9 @@ export default function RecommendationContainer({ secondary_heating: defaultSecondaryHeatingRecommendations.sapPoints || 0, cylinder_thermostat: defaultCylinderThermostatRecommendations.sapPoints || 0, + trickle_vents: defaultTrickleVentsRecommendations.sapPoints || 0, + mixed_glazing: defaultMixedGlazingRecommendations.sapPoints || 0, + draught_proofing: defaultDraughtProofingRecommendations.sapPoints || 0, }); const [labourDaysMap, setLabourDaysMap] = useState({ @@ -181,6 +202,9 @@ export default function RecommendationContainer({ secondary_heating: defaultSecondaryHeatingRecommendations.labourDays || 0, cylinder_thermostat: defaultCylinderThermostatRecommendations.labourDays || 0, + trickle_vents: defaultTrickleVentsRecommendations.labourDays || 0, + mixed_glazing: defaultMixedGlazingRecommendations.labourDays || 0, + draught_proofing: defaultDraughtProofingRecommendations.labourDays || 0, }); const [co2SavingsMap, setCo2SavingsMap] = useState({ @@ -204,6 +228,10 @@ export default function RecommendationContainer({ defaultSecondaryHeatingRecommendations.co2EquivalentSavings || 0, cylinder_thermostat: defaultCylinderThermostatRecommendations.co2EquivalentSavings || 0, + trickle_vents: defaultTrickleVentsRecommendations.co2EquivalentSavings || 0, + mixed_glazing: defaultMixedGlazingRecommendations.co2EquivalentSavings || 0, + draught_proofing: + defaultDraughtProofingRecommendations.co2EquivalentSavings || 0, }); const [energyCostSavingsMap, setEnergyCostSavingsMap] = @@ -228,6 +256,10 @@ export default function RecommendationContainer({ defaultSecondaryHeatingRecommendations.energyCostSavings || 0, cylinder_thermostat: defaultCylinderThermostatRecommendations.energyCostSavings || 0, + trickle_vents: defaultTrickleVentsRecommendations.energyCostSavings || 0, + mixed_glazing: defaultMixedGlazingRecommendations.energyCostSavings || 0, + draught_proofing: + defaultDraughtProofingRecommendations.energyCostSavings || 0, }); const [kwhSavingsMap, setKwhSavingsMap] = useState({ @@ -246,6 +278,9 @@ export default function RecommendationContainer({ secondary_heating: defaultSecondaryHeatingRecommendations.kwhSavings || 0, cylinder_thermostat: defaultCylinderThermostatRecommendations.kwhSavings || 0, + trickle_vents: defaultTrickleVentsRecommendations.kwhSavings || 0, + mixed_glazing: defaultMixedGlazingRecommendations.kwhSavings || 0, + draught_proofing: defaultDraughtProofingRecommendations.kwhSavings || 0, }); const [totalEstimatedCost, setTotalEstimatedCost] = useState( diff --git a/src/app/db/schema/recommendations.ts b/src/app/db/schema/recommendations.ts index b8899bb..d272b2a 100644 --- a/src/app/db/schema/recommendations.ts +++ b/src/app/db/schema/recommendations.ts @@ -185,7 +185,10 @@ export type RecommendationType = | "hot_water_tank_insulation" | "heating_control" | "secondary_heating" - | "cylinder_thermostat"; + | "cylinder_thermostat" + | "trickle_vents" + | "mixed_glazing" + | "draught_proofing"; export type UnnestedRecommendation = { quantity: number; diff --git a/src/types/recommendations.ts b/src/types/recommendations.ts index e113988..fd0f610 100644 --- a/src/types/recommendations.ts +++ b/src/types/recommendations.ts @@ -12,4 +12,7 @@ export interface RecommendationMetricMap { heating_control: number; secondary_heating: number; cylinder_thermostat: number; + trickle_vents: number; + mixed_glazing: number; + draught_proofing: number; }