diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/page.tsx index 92c12eed..ed2080be 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/page.tsx @@ -6,8 +6,10 @@ import { SparklesIcon, BuildingOfficeIcon, ShieldCheckIcon, + ExclamationTriangleIcon, } from "@heroicons/react/24/outline"; import { CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/solid"; +import Link from "next/link"; import { getPropertyMeta, getConditionReport, @@ -67,6 +69,43 @@ export default async function BuildingPassportHome(props: { }) { const params = await props.params; const propertyMeta = await getPropertyMeta(params.propertyId); + + // A property with no UPRN isn't matched to an Ordnance Survey address yet, so + // the whole UPRN-keyed passport (spatial data, installed measures, EPC) has + // nothing to show — and getSpatialData(BigInt(null)) would 500. Surface a + // clear "not matched" state and link back to the portfolio instead. + if (!propertyMeta.uprn) { + return ( +
+ {propertyMeta.address ? ( + <> + {propertyMeta.address}{" "} + hasn't{" "} + > + ) : ( + "This property hasn't " + )} + been matched to an Ordnance Survey address, so its building passport + isn't available yet. Match it to a UPRN from the portfolio to + unlock the passport. +
+ + Back to portfolio + +