mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
formatting titles on retrofit plans
This commit is contained in:
parent
bf0c0c81f3
commit
7d9e328f74
7 changed files with 67 additions and 27 deletions
|
|
@ -20,6 +20,10 @@ const TitleMap = {
|
|||
mechanical_ventilation: "Mechanical Ventilation",
|
||||
sealing_open_fireplace: "Sealing Open Fireplace",
|
||||
low_energy_lighting: "Low Energy Lighting",
|
||||
iwi: "Internal Wall Insulation",
|
||||
ewi: "External Wall Insulation",
|
||||
cwi: "Cavity Wall Insulation",
|
||||
loft_insulation: "Loft Insulation",
|
||||
};
|
||||
|
||||
export default function RecommendationCard({
|
||||
|
|
@ -54,6 +58,29 @@ export default function RecommendationCard({
|
|||
|
||||
const [modalIsOpen, setModalIsOpen] = useState(false);
|
||||
|
||||
const getTitle = () => {
|
||||
if (componentType === "wall_insulation" && cardComponent) {
|
||||
const description = cardComponent.description.toLowerCase();
|
||||
if (description.includes("internal")) {
|
||||
return TitleMap.iwi;
|
||||
} else if (description.includes("external")) {
|
||||
return TitleMap.ewi;
|
||||
} else if (description.includes("cavity")) {
|
||||
return TitleMap.cwi;
|
||||
}
|
||||
}
|
||||
|
||||
if (componentType === "roof_insulation" && cardComponent) {
|
||||
const description = cardComponent.description.toLowerCase();
|
||||
if (description.includes("loft")) {
|
||||
return TitleMap.loft_insulation;
|
||||
}
|
||||
}
|
||||
|
||||
// Logic for other componentTypes can be added here
|
||||
return TitleMap[componentType];
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cardComponent ? selectionStyling : noSelectionStyling}
|
||||
|
|
@ -61,7 +88,7 @@ export default function RecommendationCard({
|
|||
setModalIsOpen(true);
|
||||
}}
|
||||
>
|
||||
<h2 className="font-bold mb-4 text-lg">{TitleMap[componentType]}</h2>
|
||||
<h2 className="font-bold mb-4 text-lg">{getTitle()}</h2>
|
||||
<div className="mb-3">
|
||||
{cardComponent ? (
|
||||
cardComponent.description
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ export default function RecommendationContainer({
|
|||
/>
|
||||
</div>
|
||||
|
||||
<Separator className="mb-4" />
|
||||
<Separator className="mb-4 bg-brandblue" />
|
||||
|
||||
<div className="flex-col grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 items-stretch">
|
||||
{Object.entries(categorizedRecommendations).map(
|
||||
([componentType, recommendationData], idx) => {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default function RecommendationCostSummaryCard({
|
|||
totalSapPoints: number;
|
||||
}) {
|
||||
return (
|
||||
<table className="text-left bg-green-700 rounded-md text-gray-100">
|
||||
<table className="text-left bg-brandblue rounded-md text-gray-100">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="font-medium pl-4 py-2">Total Cost:</td>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export default function RecommendationEpcSummaryCard({
|
|||
expectedEpcRating,
|
||||
}: RecommendationEpcSummaryCardProps) {
|
||||
return (
|
||||
<table className="text-left bg-green-700 rounded-md text-gray-100">
|
||||
<table className="text-left bg-brandblue rounded-md text-gray-100">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="font-medium pl-4 py-2">Current EPC Rating:</td>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { PropertyMeta } from "@/app/db/schema/property";
|
||||
import RecommendationContainer from "@/app/components/building-passport/RecommendationContainer";
|
||||
import { getPropertyMeta, getRecommendations } from "../../utils";
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,12 @@ interface PropertyDetailsCardProps {
|
|||
propertyMeta: PropertyMeta;
|
||||
propertyDetailsSpatial: {
|
||||
inConservationArea: string;
|
||||
isListedorHeritage: string;
|
||||
};
|
||||
}
|
||||
|
||||
const rowTitleStyle = "text-gray-100 align-top pb-3";
|
||||
const rowValueStyle = "text-gray-100 text-end pr-8 pt-1 align-top pb-3";
|
||||
const rowTitleStyle = "text-brandblue align-top pb-3";
|
||||
const rowValueStyle = "text-brandblue text-end pr-8 pt-1 align-top pb-3";
|
||||
|
||||
function PropertyDetailsCard({
|
||||
conditionReportData,
|
||||
|
|
@ -48,7 +49,7 @@ function PropertyDetailsCard({
|
|||
.join(" ");
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-col items-center p-4 shadow rounded-md justify-start text-gray-100 bg-brandblue">
|
||||
<div className="w-full flex flex-col items-center p-4 shadow rounded-md justify-start bg-gray-100">
|
||||
<div className="grid grid-cols-2 gap-8 text-m w-full h-full text-sm">
|
||||
<div className="border-r">
|
||||
<table className="w-full ">
|
||||
|
|
@ -74,6 +75,12 @@ function PropertyDetailsCard({
|
|||
{propertyDetailsSpatial.inConservationArea}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className={rowTitleStyle}>Is listed or heritage:</td>
|
||||
<td className={rowValueStyle}>
|
||||
{propertyDetailsSpatial.isListedorHeritage}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -113,6 +120,7 @@ export default async function PreAssessmentReport({
|
|||
const conditionReportData = await getConditionReport(params.propertyId);
|
||||
const propertyDetailsSpatial = {
|
||||
inConservationArea: "No",
|
||||
isListedorHeritage: "No",
|
||||
};
|
||||
const generalFeatures = formatGeneralFeatures(
|
||||
conditionReportData,
|
||||
|
|
@ -135,7 +143,6 @@ export default async function PreAssessmentReport({
|
|||
epcRating={propertyMeta.currentEpcRating}
|
||||
fullMargin={false}
|
||||
/>
|
||||
<AddressCard address={conditionReportData.fullAddress} />
|
||||
|
||||
<PropertyDetailsCard
|
||||
conditionReportData={conditionReportData}
|
||||
|
|
|
|||
|
|
@ -126,26 +126,26 @@ export function formatGeneralFeatures(
|
|||
},
|
||||
{
|
||||
feature: "Number of storeys",
|
||||
description: conditionReportData.numberStoreys || "unknown",
|
||||
description: conditionReportData.numberStoreys || "Unknown",
|
||||
},
|
||||
];
|
||||
|
||||
const generealFeatures: GeneralFeature[] = [
|
||||
{
|
||||
feature: "Floor Height",
|
||||
description: conditionReportData.floorHeight || "unknown",
|
||||
description: conditionReportData.floorHeight || "Unknown",
|
||||
},
|
||||
{
|
||||
feature: "Number of heated rooms",
|
||||
description: conditionReportData.numberHeatedRooms || "unknown",
|
||||
description: conditionReportData.numberHeatedRooms || "Unknown",
|
||||
},
|
||||
{
|
||||
feature: "Number of open fire places",
|
||||
description: conditionReportData.numberOpenFireplaces || "unknown",
|
||||
description: conditionReportData.numberOpenFireplaces || "Unknown",
|
||||
},
|
||||
{
|
||||
feature: "Number of extensions",
|
||||
description: conditionReportData.numberExtensions || "unknown",
|
||||
description: conditionReportData.numberExtensions || "Unknown",
|
||||
},
|
||||
{
|
||||
feature: "Mains gas",
|
||||
|
|
@ -153,7 +153,7 @@ export function formatGeneralFeatures(
|
|||
},
|
||||
{
|
||||
feature: "Energy tariff",
|
||||
description: conditionReportData.energyTariff || "unknown",
|
||||
description: conditionReportData.energyTariff || "Unknown",
|
||||
},
|
||||
...(propertyType === "Flat" || propertyType === "Maisonette"
|
||||
? flatOnlyFeatures
|
||||
|
|
@ -171,52 +171,52 @@ export function formatRetrofitFeatures(
|
|||
const retrofitFeatures: Feature[] = [
|
||||
{
|
||||
feature: "Wall",
|
||||
description: conditionReportData.walls || "unknown",
|
||||
description: conditionReportData.walls || "Unknown",
|
||||
rating: getRating(conditionReportData.wallsRating),
|
||||
},
|
||||
{
|
||||
feature: "Roof",
|
||||
description: conditionReportData.roof || "unknown",
|
||||
description: conditionReportData.roof || "Unknown",
|
||||
rating: getRating(conditionReportData.roofRating),
|
||||
},
|
||||
{
|
||||
feature: "Windows",
|
||||
description: conditionReportData.windows || "unknown",
|
||||
description: conditionReportData.windows || "Unknown",
|
||||
rating: getRating(conditionReportData.windowsRating),
|
||||
},
|
||||
{
|
||||
feature: "Heating",
|
||||
description: conditionReportData.heating || "unknown",
|
||||
description: conditionReportData.heating || "Unknown",
|
||||
rating: getRating(conditionReportData.heatingRating),
|
||||
},
|
||||
{
|
||||
feature: "Heating Control",
|
||||
description: conditionReportData.heatingControls || "unknown",
|
||||
description: conditionReportData.heatingControls || "Unknown",
|
||||
rating: getRating(conditionReportData.heatingControlsRating),
|
||||
},
|
||||
{
|
||||
feature: "Hot Water",
|
||||
description: conditionReportData.hotWater || "unknown",
|
||||
description: conditionReportData.hotWater || "Unknown",
|
||||
rating: getRating(conditionReportData.hotWaterRating),
|
||||
},
|
||||
{
|
||||
feature: "Lighting",
|
||||
description: conditionReportData.lighting || "unknown",
|
||||
description: conditionReportData.lighting || "Unknown",
|
||||
rating: getRating(conditionReportData.lightingRating),
|
||||
},
|
||||
{
|
||||
feature: "Floor",
|
||||
description: conditionReportData.floor || "unknown",
|
||||
description: conditionReportData.floor || "Unknown",
|
||||
rating: getRating(conditionReportData.floorRating),
|
||||
},
|
||||
{
|
||||
feature: "Ventilation",
|
||||
description: conditionReportData.ventilation || "unknown",
|
||||
description: conditionReportData.ventilation || "Unknown",
|
||||
rating: "N/A",
|
||||
},
|
||||
{
|
||||
feature: "Main Fuel",
|
||||
description: conditionReportData.mainfuel || "unknown",
|
||||
description: conditionReportData.mainfuel || "Unknown",
|
||||
rating: "N/A",
|
||||
},
|
||||
{
|
||||
|
|
@ -251,17 +251,23 @@ export function formatHeatDemandFeatures(
|
|||
conditionReportData: PropertyDetailsEpc
|
||||
): GeneralFeature[] {
|
||||
return [
|
||||
{
|
||||
feature: "Estimated energy consumption",
|
||||
description: conditionReportData.adjustedEnergyConsumption
|
||||
? `${conditionReportData.adjustedEnergyConsumption.toFixed(0)} kWh/year`
|
||||
: "Unknown",
|
||||
},
|
||||
{
|
||||
feature: "EPC primary energy consumption",
|
||||
description: conditionReportData.primaryEnergyConsumption
|
||||
? `${conditionReportData.primaryEnergyConsumption} kWh/m2/year`
|
||||
: "unknown",
|
||||
: "Unknown",
|
||||
},
|
||||
{
|
||||
feature: "EPC CO2 emissions",
|
||||
description: conditionReportData.co2Emissions
|
||||
? `${conditionReportData.co2Emissions} tonnes/year`
|
||||
: "unknown",
|
||||
: "Unknown",
|
||||
},
|
||||
// These features haven't been implemented yet
|
||||
// {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue