From 05438a8f4462d847a00e31fe36b5a50920cf897f Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 21 Aug 2025 22:07:37 +0000 Subject: [PATCH] added the funding modal --- .../building-passport/RecommendationCard.tsx | 12 +- .../RecommendationContainer.tsx | 4 +- .../ValuationImpactComponent.tsx | 109 ++++++++++++++++-- .../[propertyId]/plans/[planId]/page.tsx | 3 +- 4 files changed, 106 insertions(+), 22 deletions(-) diff --git a/src/app/components/building-passport/RecommendationCard.tsx b/src/app/components/building-passport/RecommendationCard.tsx index 4633e383..c3313210 100644 --- a/src/app/components/building-passport/RecommendationCard.tsx +++ b/src/app/components/building-passport/RecommendationCard.tsx @@ -136,7 +136,7 @@ export default function RecommendationCard({ const optionTextClassName = alreadyInstalled ? "text-brandgold" - : "text-blue-500 hover:text-blue-300"; + : "text-brandbrown hover:text-blue-300"; const optionsText = alreadyInstalled ? "Already installed" @@ -173,22 +173,16 @@ export default function RecommendationCard({ Estimated Cost: - + {cardComponent ? "£" + formatNumber(cardComponent?.estimatedCost || 0) : ""} - {cardComponent.newUValue && ( - - New U-Value: - {cardComponent.newUValue} - - )} {cardComponent.sapPoints != null && ( SAP Points: - + {cardComponent.sapPoints < 0.1 && cardComponent.type !== "mechanical_ventilation" ? "Negligible" diff --git a/src/app/components/building-passport/RecommendationContainer.tsx b/src/app/components/building-passport/RecommendationContainer.tsx index 6c3211b0..af9dc110 100644 --- a/src/app/components/building-passport/RecommendationContainer.tsx +++ b/src/app/components/building-passport/RecommendationContainer.tsx @@ -332,7 +332,7 @@ export default function RecommendationContainer({ return ( <> -
+
- +
{Object.entries(categorizedRecommendations).map( diff --git a/src/app/components/building-passport/ValuationImpactComponent.tsx b/src/app/components/building-passport/ValuationImpactComponent.tsx index f5f797cf..f1856a0f 100644 --- a/src/app/components/building-passport/ValuationImpactComponent.tsx +++ b/src/app/components/building-passport/ValuationImpactComponent.tsx @@ -7,6 +7,10 @@ import { formatNumber } from "@/app/utils"; import {Card, CardContent} from "@/app/shadcn_components/ui/card"; import { Button } from "@/app/shadcn_components/ui/button"; import { PiggyBank } from 'lucide-react' +import { Dialog, Transition } from '@headlessui/react' +import { Fragment } from 'react' +import { FundingPackageMeasure } from "@/app/db/schema/funding"; +import { set } from "cypress/types/lodash"; type FundingSummaryProps = { @@ -27,7 +31,7 @@ export const FundingSummary: React.FC = ({ scheme, onSeeMor {message ? ( -

{message}

+

{message}

) : ( <>
@@ -37,14 +41,16 @@ export const FundingSummary: React.FC = ({ scheme, onSeeMor

Click below to learn more about available funding options.

- + {!message && ( + + )} )} @@ -102,6 +108,91 @@ export default function ValuationImpactComponent({ scheme={funding.scheme} onSeeMore={openFundingModal} /> + setFundingModalIsOpen(false)} + scheme={funding.scheme} + fundingPackageMeasures={funding.fundingPackageMeasures} + />
); } + + +type FundingSummaryModalProps = { + isOpen: boolean + closeModal: () => void + scheme?: string | null; + fundingPackageMeasures: FundingPackageMeasure[] +} + +export function FundingSummaryModal({ + isOpen, + closeModal, + scheme, + fundingPackageMeasures, +}: FundingSummaryModalProps) { + return ( + + + +
+ + +
+
+ + + + + {scheme?.toUpperCase() || 'Funding Details'} + + +

+ This package has been optimised to meet the eligibility criteria of the {scheme?.toUpperCase()} funding scheme. Measures have been selected to maximise the property’s improvement while minimising cost and ensuring compliance. +

+ +
+

Included Measures

+
    + {fundingPackageMeasures.map((measure) => ( +
  • + {measure.measure.replace(/_/g, ' ')} +
  • + ))} +
+
+ +
+ +
+
+
+
+
+
+
+ ) +} diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/[planId]/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/[planId]/page.tsx index a51eee2d..3c270be5 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/[planId]/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/[planId]/page.tsx @@ -12,11 +12,10 @@ export default async function Recommendations( const planMeta = await getPlanMeta(params.planId); const funding = await getPlanFunding(params.planId); - console.log("Funding Data:", funding); + console.log(funding) return (
-
Recommendations