mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
implementing general geatures
This commit is contained in:
parent
f1945945ec
commit
f70ddb0f4d
3 changed files with 76 additions and 3 deletions
|
|
@ -10,7 +10,11 @@ import {
|
|||
generalColumns,
|
||||
retrofitColumns,
|
||||
} from "@/app/components/building-passport/FeatureTableColumns";
|
||||
import { getConditionReport, getPropertyMeta } from "../utils";
|
||||
import {
|
||||
formatGeneralFeatures,
|
||||
getConditionReport,
|
||||
getPropertyMeta,
|
||||
} from "../utils";
|
||||
|
||||
function AddressCard({ address }: { address: string | null }) {
|
||||
// In the future, we might want to use react-wrap-balancer for some of this text
|
||||
|
|
@ -259,6 +263,11 @@ export default async function PreAssessmentReport({
|
|||
// const generalFeatures = conditionReportData.generalFeatures;
|
||||
// const heatingDemand = conditionReportData.heatingDemand;
|
||||
|
||||
const generalFeatures = formatGeneralFeatures(
|
||||
conditionReportData,
|
||||
propertyMeta.propertyType
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="leading-loose tracking-wider">
|
||||
<div className="flex py-8 text-lg">Pre Assessment Report</div>
|
||||
|
|
|
|||
|
|
@ -36,3 +36,58 @@ export async function getConditionReport(
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
export function formatGeneralFeatures(
|
||||
conditionReportData: PropertyDetailsEpc,
|
||||
propertyType: string
|
||||
) {
|
||||
// if a property is a flat/maisonette, we show heat loss coridoor information, otherwise we won't show it
|
||||
|
||||
const flatOnlyFeatures = [
|
||||
{
|
||||
feature: "Heat loss corridor",
|
||||
description: Boolean(conditionReportData.heatLossCorridor) ? "Yes" : "No",
|
||||
},
|
||||
{
|
||||
feature: "Heat loss corridor length",
|
||||
description:
|
||||
conditionReportData.unheatedCorridorLength || "No heat loss corridor",
|
||||
},
|
||||
{
|
||||
feature: "Number of storeys",
|
||||
description: conditionReportData.numberStoreys || "unknown",
|
||||
},
|
||||
];
|
||||
|
||||
const generealFeatures = [
|
||||
{
|
||||
feature: "Floor Height",
|
||||
description: conditionReportData.floorHeight || "unknown",
|
||||
},
|
||||
{
|
||||
feature: "Number of heated rooms",
|
||||
description: conditionReportData.numberHeatedRooms || "unknown",
|
||||
},
|
||||
{
|
||||
feature: "Number of open fire places",
|
||||
description: conditionReportData.numberOpenFireplaces || "unknown",
|
||||
},
|
||||
{
|
||||
feature: "Number of extensions",
|
||||
description: conditionReportData.numberExtensions || "unknown",
|
||||
},
|
||||
{
|
||||
feature: "Mains gas",
|
||||
description: conditionReportData.mainsGas || "unknown",
|
||||
},
|
||||
{
|
||||
feature: "Energy tariff",
|
||||
description: conditionReportData.energyTariff,
|
||||
},
|
||||
...(propertyType === "Flat" || propertyType === "Maisonette"
|
||||
? flatOnlyFeatures
|
||||
: []),
|
||||
];
|
||||
|
||||
return generealFeatures;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ type SearchData = {
|
|||
rows: SearchResult[];
|
||||
};
|
||||
|
||||
type PropertyType = "Bungalow" | "House" | "Flat" | "Maisonette" | "Park Home";
|
||||
|
||||
type SearchResult = {
|
||||
"low-energy-fixed-light-count": string;
|
||||
address: string;
|
||||
|
|
@ -22,7 +24,7 @@ type SearchResult = {
|
|||
address3: string;
|
||||
"mainheatcont-description": string;
|
||||
"sheating-energy-eff": string;
|
||||
"property-type": string;
|
||||
"property-type": PropertyType;
|
||||
"local-authority-label": string;
|
||||
"fixed-lighting-outlets-count": string;
|
||||
"energy-tariff": string;
|
||||
|
|
@ -105,4 +107,11 @@ interface EpcDataProps {
|
|||
type EpcRating = SearchResult["current-energy-rating"];
|
||||
type EpcKey = keyof SearchResult;
|
||||
|
||||
export type { SearchData, SearchResult, EpcDataProps, EpcRating, EpcKey };
|
||||
export type {
|
||||
SearchData,
|
||||
SearchResult,
|
||||
EpcDataProps,
|
||||
EpcRating,
|
||||
EpcKey,
|
||||
PropertyType,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue