diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/condition/components/ElementTable.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/condition/components/ElementTable.tsx index fd5c3cf5..1355b5c7 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/condition/components/ElementTable.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/condition/components/ElementTable.tsx @@ -2,6 +2,104 @@ import React, { useState } from "react"; +export const ELEMENT_TYPE_LABELS: Record = { + access_ramp: "Access Ramp", + accessible_housing_register: "Accessible Housing Register", + additional_wc_or_whb: "Additional WC or WHB", + asbestos: "Asbestos", + bathroom: "Bathroom", + bathroom_remaining_life_source: "Bathroom Remaining Life Source", + boiler_fuel: "Boiler Fuel", + central_heating: "Central Heating", + chimney: "Chimney", + community_heating: "Community Heating", + downpipes: "Downpipes", + drop_kerb: "Drop Kerb", + electrics: "Electrics", + external_brickwork_pointing: "External Brickwork Pointing", + external_decoration: "External Decoration", + external_door: "External Door", + external_noise_insulation: "External Noise Insulation", + external_structural_defects: "External Structural Defects", + external_wall: "External Wall", + external_windows: "External Windows", + fascia_soffit_bargeboards: "Fascia Soffit Bargeboards", + ffhh_damp: "FFHH Damp", + ffhh_drainage_lavatories: "FFHH Drainage Lavatories", + ffhh_food_prep_and_washup: "FFHH Food Prep and Washup", + ffhh_hold_and_cold_water: "FFHH Hold and Cold Water", + ffhh_natural_light: "FFHH Natural Light", + ffhh_neglected: "FFHH Neglected", + ffhh_unsafe_layout: "FFHH Unsafe Layout", + ffhh_unstable_building: "FFHH Unstable Building", + ffhh_ventilation: "FFHH Ventilation", + fire_risk_assessment: "Fire Risk Assessment", + floor_level: "Floor Level", + floor_level_front_door: "Floor Level Front Door", + garage_and_store_door: "Garage and Store Door", + garage_and_store_roof: "Garage and Store Roof", + garage_and_store_windows: "Garage and Store Windows", + garage_door: "Garage Door", + garage_roof: "Garage Roof", + garage_windows: "Garage Windows", + gas_available: "Gas Available", + gutters: "Gutters", + heat_recovery_units: "Heat Recovery Units", + heating_system: "Heating System", + hhsrs_amenities: "HHSRS Amenities", + hhsrs_asbestos_and_mmf: "HHSRS Asbestos and MMF", + hhsrs_biocides: "HHSRS Biocides", + hhsrs_carbon_monoxide: "HHSRS Carbon Monoxide", + hhsrs_collision_and_entrapment: "HHSRS Collision and Entrapment", + hhsrs_crowding_and_space: "HHSRS Crowding and Space", + hhsrs_damp_and_mould: "HHSRS Damp and Mould", + hhsrs_domestic_hygiene_pests_refuse: "HHSRS Domestic Hygiene, Pests & Refuse", + hhsrs_electrical_hazards: "HHSRS Electrical Hazards", + hhsrs_entry_by_intruders: "HHSRS Entry by Intruders", + hhsrs_excess_cold: "HHSRS Excess Cold", + hhsrs_excess_heat: "HHSRS Excess Heat", + hhsrs_explosions: "HHSRS Explosions", + hhsrs_falls_associated_with_baths: "HHSRS Falls Associated with Baths", + hhsrs_falls_between_levels: "HHSRS Falls Between Levels", + hhsrs_falls_on_level_surfaces: "HHSRS Falls on Level Surfaces", + hhsrs_falls_on_stairs: "HHSRS Falls on Stairs", + hhsrs_fire: "HHSRS Fire", + hhsrs_flames_hot_surfaces: "HHSRS Flames / Hot Surfaces", + hhsrs_food_safety: "HHSRS Food Safety", + hhsrs_lead: "HHSRS Lead", + hhsrs_lighting: "HHSRS Lighting", + hhsrs_noise: "HHSRS Noise", + hhsrs_personal_hygiene_sanitation: "HHSRS Personal Hygiene & Sanitation", + hhsrs_radiation: "HHSRS Radiation", + hhsrs_structural_collapse: "HHSRS Structural Collapse", + hhsrs_uncombusted_fuel_gas: "HHSRS Uncombusted Fuel Gas", + hhsrs_volatile_organic_compounds: "HHSRS Volatile Organic Compounds", + hhsrs_water_supply: "HHSRS Water Supply", + internal_downpipes_external_area: "Internal Downpipes External Area", + kitchen: "Kitchen", + kitchen_remaining_life_source: "Kitchen Remaining Life Source", + lintel: "Lintel", + loft_insulation: "Loft Insulation", + outbuilding_overhaul: "Outbuilding Overhaul", + parking_areas: "Parking Areas", + paths_and_hardstandings: "Paths and Hardstandings", + patio_french_door: "Patio French Door", + porch_canopy: "Porch Canopy", + private_balcony: "Private Balcony", + programmable_heating: "Programmable Heating", + property: "Property", + quality_standard: "Quality Standard", + roof: "Roof", + smoke_detection: "Smoke Detection", + steps_to_front_door: "Steps to Front Door", + store_door: "Store Door", + store_roof: "Store Roof", + store_windows: "Store Windows", + tenant_installed_kitchen: "Tenant Installed Kitchen", + water_heating: "Water Heating", +}; + + export type AspectCondition = { id: string; elementId: string; @@ -84,7 +182,7 @@ export default function ElementTable({ groupedElements }: Props) { - Element Type + Element
- {uniqueElementTypes.map(type => ( - - ))} + + {uniqueElementTypes + .sort((a, b) => { + // Sort alphabetically by human-readable label + const labelA = ELEMENT_TYPE_LABELS[a] ?? a.replaceAll("_", " "); + const labelB = ELEMENT_TYPE_LABELS[b] ?? b.replaceAll("_", " "); + return labelA.localeCompare(labelB); + }) + .map(type => ( + + ))} + )} + - Instance - # Aspects + No. Aspects @@ -154,8 +261,12 @@ export default function ElementTable({ groupedElements }: Props) { fontWeight: "bold", }} > - {group.elementType.replaceAll("_", " ")} - {group.elementInstance} + {/* + {group.elementType.replaceAll("_", " ") + (group.elementInstance > 1 ? " (" + group.elementInstance + ")" : "")} + */} + + {`${ELEMENT_TYPE_LABELS[group.elementType] ?? group.elementType.replaceAll("_", " ")}${group.elementInstance > 1 ? ` (${group.elementInstance})` : ""}`} + {totalAspects}