diff --git a/src/app/components/building-passport/FeatureTable.tsx b/src/app/components/building-passport/FeatureTable.tsx index a7ec59d3..d711dbc1 100644 --- a/src/app/components/building-passport/FeatureTable.tsx +++ b/src/app/components/building-passport/FeatureTable.tsx @@ -16,48 +16,19 @@ import { TableRow, } from "@/app/shadcn_components/ui/table"; -import { Badge } from "@/app/shadcn_components/ui/badge"; -import { Feature, Rating } from "@/app/db/schema/property"; +import { Feature, GeneralFeature } from "@/app/db/schema/property"; -function RatingBadge({ rating }: { rating: Rating }) { - const colourMap = { - "Very good": "bg-green-500", - Good: "bg-green-300", - Poor: "bg-yellow-300", - "Very poor": "bg-red-500", - }; - const ratingConfig = colourMap[rating]; - return {rating}; +interface DataTableProps { + columns: ColumnDef[]; + data: T[]; } -export const columns: ColumnDef[] = [ - { - accessorKey: "feature", - header: "Feature", - }, - { - accessorKey: "description", - header: "Description", - }, - { - accessorKey: "rating", - header: "Rating", - cell: ({ row }) => { - return ( -
- -
- ); - }, - }, -]; - -interface DataTableProps { - data: Feature[]; -} - -export default function FeatureTable({ data }: DataTableProps) { +export default function FeatureTable({ + data, + columns, +}: DataTableProps) { // Initialise the table + const table = useReactTable({ data, columns, diff --git a/src/app/db/schema/property.ts b/src/app/db/schema/property.ts index 8b07f898..7a4214b6 100644 --- a/src/app/db/schema/property.ts +++ b/src/app/db/schema/property.ts @@ -16,7 +16,7 @@ export interface PropertyMeta { currentEpcRating: string; } -export type Rating = "Very good" | "Good" | "Poor" | "Very poor"; +export type Rating = "Very good" | "Good" | "Poor" | "Very poor" | "N/A"; export interface Feature { feature: string; @@ -24,6 +24,11 @@ export interface Feature { rating: Rating; } +export interface GeneralFeature { + feature: string; + description: string | number; +} + export interface ConditionReportData { id: number; lastUpdated: string; @@ -35,6 +40,7 @@ export interface ConditionReportData { builtForm: string; totalFloorArea: number; tenure: string; - features: Feature[]; + retrofitFeatures: Feature[]; + generalFeatures: GeneralFeature[]; yearBuilt: string; } diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx index 5a70d6ed..04a44155 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx @@ -2,6 +2,10 @@ import EpcCard from "@/app/components/building-passport/EpcCard"; import FeatureTable from "@/app/components/building-passport/FeatureTable"; import { ConditionReportData, PropertyMeta } from "@/app/db/schema/property"; import { formatDateTime } from "@/app/utils"; +import { + generalColumns, + retrofitColumns, +} from "@/app/components/building-passport/FeatureTableColumns"; function AddressCard({ address }: { address: string }) { // In the future, we might want to use react-wrap-balancer for some of this text @@ -116,7 +120,7 @@ export default async function PreAssessmentReport() { totalFloorArea: 60, tenure: "Rented (social)", yearBuilt: "1990", - features: [ + retrofitFeatures: [ { feature: "Wall", description: "Cavity wall", rating: "Poor" }, { feature: "Roof", @@ -145,10 +149,37 @@ export default async function PreAssessmentReport() { description: "Suspended timber", rating: "Poor", }, + { + feature: "Ventilation", + description: "Natural", + rating: "N/A", + }, + { + feature: "Solar Photo Voltaic", + description: "Not present in the property", + rating: "N/A", + }, + { + feature: "Solar Hot Water", + description: "Heating is not solar powered", + rating: "N/A", + }, + { + feature: "Wind Turbines", + description: "No wind turbines present", + rating: "N/A", + }, + ], + generalFeatures: [ + { + feature: "Floor Height", + description: 2.4, + }, ], }; - const features = conditionReportData.features; + const retrofitFeatures = conditionReportData.retrofitFeatures; + const generalFeatures = conditionReportData.generalFeatures; return (
@@ -170,8 +201,14 @@ export default async function PreAssessmentReport() { />
-
Property Features
- +
General Features
+ + { + // Floor height, number of heated rooms, heat loss corridoor and heat loss corridor length, number of open fire places, number of extensions, + // floor level if a flat, number of storeys if a flat, whether mains gas is available, energy tarigg, + } +
Retrotfit Property Features
+
Heating Demand
);