mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
added percentage valuation uplift
This commit is contained in:
parent
4e40a51ba5
commit
da5e957772
1 changed files with 27 additions and 7 deletions
|
|
@ -87,12 +87,11 @@ export default function ValuationImpactComponent({
|
|||
setFundingModalIsOpen(true);
|
||||
}
|
||||
|
||||
function renderCurrency(value: number | null) {
|
||||
return value ? (
|
||||
`£${formatNumber(value)}`
|
||||
) : (
|
||||
<span className="text-gray-300 italic">Not available</span>
|
||||
);
|
||||
function formatPercent(value: number | null): string {
|
||||
if (value === null || isNaN(value)) return "–";
|
||||
const percent = value * 100;
|
||||
// Show no decimals if it's a whole number, otherwise 1 decimal
|
||||
return Number.isInteger(percent) ? percent.toString() : percent.toFixed(1);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -110,7 +109,9 @@ export default function ValuationImpactComponent({
|
|||
{/* After Retrofit Valuation */}
|
||||
<div className="flex flex-col items-center justify-center text-center space-y-1">
|
||||
<span className="text-gray-100 text-lg">After Retrofit Valuation</span>
|
||||
{lowerBoundValuation && upperBoundValuation ? (
|
||||
|
||||
{currentValuation && lowerBoundValuation && upperBoundValuation ? (
|
||||
// CASE 1: Absolute £ valuations available
|
||||
<>
|
||||
<div className="text-2xl text-brandbrown font-bold">
|
||||
£{formatNumber(lowerBoundValuation)} - £
|
||||
|
|
@ -124,7 +125,26 @@ export default function ValuationImpactComponent({
|
|||
{formatNumber(valuationIncreaseUpperBound || 0)}
|
||||
</span>
|
||||
</>
|
||||
) : valuationIncreaseLowerBound !== null &&
|
||||
valuationIncreaseUpperBound !== null ? (
|
||||
// CASE 2: No base valuation, show % improvement
|
||||
<>
|
||||
<div className="text-2xl font-bold text-brandbrown flex items-baseline justify-center">
|
||||
<span className="text-3xl font-extrabold text-brandbrown mr-1">
|
||||
+
|
||||
</span>
|
||||
<span>{formatPercent(valuationIncreaseLowerBound)}</span>
|
||||
<span className="mx-1">–</span>
|
||||
<span>{formatPercent(valuationIncreaseUpperBound)}</span>
|
||||
<span className="ml-1">%</span>
|
||||
</div>
|
||||
|
||||
<span className="text-gray-100 text-lg">
|
||||
Estimated value improvement
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
// CASE 3: Nothing available
|
||||
<span className="text-lg text-gray-300 italic">Not available</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue