mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Merge pull request #116 from Hestia-Homes/eco-project-data
upgraded ui & changed reference of high_heat_retention_storage_heater
This commit is contained in:
commit
4bee026bd3
4 changed files with 33 additions and 21 deletions
|
|
@ -24,7 +24,7 @@ interface RecommendationContainerProps {
|
|||
recommendations: Recommendation[];
|
||||
propertyMeta: PropertyMeta;
|
||||
planMeta: Plan;
|
||||
funding: FundingPackageWithMeasures[]
|
||||
funding: FundingPackageWithMeasures[];
|
||||
}
|
||||
|
||||
const typeToCategoryMap: { [key in RecommendationType]?: RecommendationType } =
|
||||
|
|
@ -56,19 +56,22 @@ export default function RecommendationContainer({
|
|||
recommendations,
|
||||
propertyMeta,
|
||||
planMeta,
|
||||
funding
|
||||
funding,
|
||||
}: RecommendationContainerProps) {
|
||||
const categorizedRecommendations = recommendations.reduce((acc, curr) => {
|
||||
const typeKey = curr.type as RecommendationType;
|
||||
const category = typeToCategoryMap[typeKey] ?? typeKey;
|
||||
const categorizedRecommendations = recommendations.reduce(
|
||||
(acc, curr) => {
|
||||
const typeKey = curr.type as RecommendationType;
|
||||
const category = typeToCategoryMap[typeKey] ?? typeKey;
|
||||
|
||||
if (!acc[category]) {
|
||||
acc[category] = [];
|
||||
}
|
||||
acc[category].push(curr);
|
||||
if (!acc[category]) {
|
||||
acc[category] = [];
|
||||
}
|
||||
acc[category].push(curr);
|
||||
|
||||
return acc;
|
||||
}, {} as Record<RecommendationType, (typeof recommendations)[0][]>);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<RecommendationType, (typeof recommendations)[0][]>
|
||||
);
|
||||
|
||||
const defaultWallsRecommendations =
|
||||
categorizedRecommendations.wall_insulation?.find(
|
||||
|
|
@ -319,8 +322,13 @@ export default function RecommendationContainer({
|
|||
if (funding.length > 1) {
|
||||
console.warn("Multiple funding packages found, using the first one.");
|
||||
}
|
||||
// Sum up project funding and uplift
|
||||
|
||||
const [totalFunding, setTotalFunding] = useState(funding[0]?.projectFunding || 0)
|
||||
const [totalFunding, setTotalFunding] = useState(
|
||||
funding[0]
|
||||
? (funding[0].projectFunding ?? 0) + (funding[0].totalUplift ?? 0)
|
||||
: 0
|
||||
);
|
||||
|
||||
const currentEpcRating = propertyMeta.currentEpcRating;
|
||||
const currentSapPoints = propertyMeta.currentSapPoints;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ export const measuresDisplayLabels = {
|
|||
suspended_floor_insulation: "Suspended Floor Insulation",
|
||||
solid_floor_insulation: "Solid Floor Insulation",
|
||||
boiler_upgrade: "Boiler Upgrade",
|
||||
high_heat_retention_storage_heater: "High Heat Retention Storage Heater",
|
||||
high_heat_retention_storage_heaters: "High Heat Retention Storage Heater",
|
||||
air_source_heat_pump: "Air Source Heat Pump",
|
||||
secondary_heating: "Secondary Heating",
|
||||
solar_pv: "Solar PV",
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ export function ProjectProposal({ plans }: { plans: any[] }) {
|
|||
<div>
|
||||
<p className="text-xs text-gray-500 mb-1">Carbon</p>
|
||||
<p className="text-md font-medium text-brandblue">
|
||||
{((selectedData?.totalCarbon || 0) * 1000).toFixed(2)} kgCO₂e
|
||||
{((selectedData?.totalCarbon || 0) * 1000).toFixed(0)}{" "}
|
||||
<span className="text-sm text-gray-600 align-top">kgCO₂e</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
import RecommendationContainer from "@/app/components/building-passport/RecommendationContainer";
|
||||
import { getPropertyMeta, getRecommendations, getPlanMeta, getPlanFunding } from "../../utils";
|
||||
import {
|
||||
getPropertyMeta,
|
||||
getRecommendations,
|
||||
getPlanMeta,
|
||||
getPlanFunding,
|
||||
} from "../../utils";
|
||||
|
||||
export default async function Recommendations(
|
||||
props: {
|
||||
params: Promise<{ slug: string; propertyId: string; planId: string }>;
|
||||
}
|
||||
) {
|
||||
export default async function Recommendations(props: {
|
||||
params: Promise<{ slug: string; propertyId: string; planId: string }>;
|
||||
}) {
|
||||
const params = await props.params;
|
||||
const propertyMeta = await getPropertyMeta(params.propertyId);
|
||||
const recommendations = await getRecommendations(params.planId);
|
||||
const planMeta = await getPlanMeta(params.planId);
|
||||
const funding = await getPlanFunding(params.planId);
|
||||
|
||||
console.log(funding)
|
||||
console.log("funding", funding);
|
||||
|
||||
return (
|
||||
<div className="leading-loose tracking-wider">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue