From c3c0a01fd640fbb19d9e57f5ee77f753c4a316da Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Wed, 14 Jan 2026 21:27:53 +0000 Subject: [PATCH] added delete button --- package-lock.json | 1 + package.json | 1 + .../[propertyId]/plans/page.tsx | 73 +------------------ .../components/propertyTableColumns.tsx | 9 --- 4 files changed, 6 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index c498cda..469334d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "@tanstack/react-query": "^4.29.12", "@tanstack/react-table": "^8.9.3", "@tremor/react": "^3.18.7", + "@types/node": "20.2.3", "@types/react-dom": "18.3.1", "@vercel/speed-insights": "^1.2.0", "autoprefixer": "10.4.14", diff --git a/package.json b/package.json index cdf3c61..71de13f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@tanstack/react-query": "^4.29.12", "@tanstack/react-table": "^8.9.3", "@tremor/react": "^3.18.7", + "@types/node": "20.2.3", "@types/react-dom": "18.3.1", "@vercel/speed-insights": "^1.2.0", "autoprefixer": "10.4.14", diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/page.tsx index cd4b535..d6f6a85 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/plans/page.tsx @@ -1,65 +1,6 @@ import { getPlans, getPropertyMeta } from "../utils"; -import { formatDateTime, formatNumber, sapToEpc } from "@/app/utils"; -import EpcCard from "@/app/components/building-passport/EpcCard"; -import { Card, CardContent, CardHeader } from "@/app/shadcn_components/ui/card"; -import GoToPlanButton from "@/app/components/building-passport/GoToPlanButton"; - -function PlanCard({ - expectedEpcRating, - createdAt, - totalEstimatedCost, - totalSapPoints, - planName, - planId, - isDefault, -}: { - expectedEpcRating: string; - createdAt: Date; - totalEstimatedCost: number; - totalSapPoints: number; - planName: string | null; - planId: string; - isDefault: boolean; -}) { - return ( - -
- -
-
- - {planName && ( -
- {planName} -
- )} -
- -
- Total cost: - £{formatNumber(totalEstimatedCost)} -
-
- Total SAP points: - - {Math.round((totalSapPoints + Number.EPSILON) * 100) / 100} - -
-
-
-
-
- Created: {formatDateTime(createdAt)} -
- -
-
- ); -} +import { sapToEpc } from "@/app/utils"; +import PlanCard from "./PlanCard"; export default async function RecommendationPlans(props: { params: Promise<{ slug: string; propertyId: string }>; @@ -68,23 +9,18 @@ export default async function RecommendationPlans(props: { const propertyMeta = await getPropertyMeta(params.propertyId); const plans = await getPlans(params.propertyId); - // TODO: We don't currently have any visual identification of plans that have been set as default vs not - return (
Retrofit Plans
- {plans.map((plan, index) => { - // We accumulate the cost and the sap points for only the default recommendations - + {plans.map((plan) => { const totalEstimatedCost = plan.costOfWorks || 0; const totalSapPoints = (plan.postSapPoints || propertyMeta.currentSapPoints) - propertyMeta.currentSapPoints; - // Placeholder while we return 999 for all sap points const expectedSapPoints = Math.min( propertyMeta.currentSapPoints + totalSapPoints, 100 @@ -93,9 +29,8 @@ export default async function RecommendationPlans(props: { const expectedEpcRating = sapToEpc(expectedSapPoints); return ( -
+
[] = [ Settings - { - console.log("[UI] Delete clicked for:", propertyId); - table.options.meta?.onDeleteProperty?.(propertyId); - }} - > - Delete Property -