more formatting

This commit is contained in:
Daniel Roth 2026-02-02 12:43:30 +00:00
parent d1514672cc
commit fe1232e63f

View file

@ -1,5 +1,6 @@
"use client";
import { m } from "framer-motion";
import React, { useState } from "react";
export const ELEMENT_TYPE_LABELS: Record<string, string> = {
@ -99,6 +100,39 @@ export const ELEMENT_TYPE_LABELS: Record<string, string> = {
water_heating: "Water Heating",
};
export const ASPECT_TYPE_LABELS: Record<string, string> = {
material: "Material",
condition: "Condition",
type: "Type",
area: "Area",
configuration: "Configuration",
presence: "Presence",
risk: "Risk",
severity: "Severity",
location: "Location",
finish: "Finish",
insulation: "Insulation",
pointing: "Pointing",
spalling: "Spalling",
lintels: "Lintels",
cladding: "Cladding",
category: "Category",
quantity: "Quantity",
adequacy: "Adequacy",
rating: "Rating",
strategy: "Strategy",
extent: "Extent",
distribution: "Distribution",
structure: "Structure",
covering: "Covering",
fire_rating: "Fire Rating",
external_decoration: "External Decoration",
work_required: "Work Required",
age_band: "Age Band",
construction_type: "Construction Type",
classification: "Classification",
system: "System",
}
export type AspectCondition = {
id: string;
@ -291,12 +325,18 @@ export default function ElementTable({ groupedElements }: Props) {
</tr>
</thead>
<tbody>
{group.elements
.sort((a, b) => a.elementType.localeCompare(b.elementType))
.flatMap(el =>
el.aspects.map(aspect => (
{group.elements.flatMap(el =>
el.aspects
.sort((a, b) => {
const labelA = ASPECT_TYPE_LABELS[a.aspectType] ?? a.aspectType;
const labelB = ASPECT_TYPE_LABELS[b.aspectType] ?? b.aspectType;
return labelA.localeCompare(labelB);
})
.map(aspect => (
<tr key={aspect.id}>
<td style={tdStyle}>{aspect.aspectType}</td>
<td style={tdStyle}>
{ASPECT_TYPE_LABELS[aspect.aspectType] ?? aspect.aspectType}
</td>
<td style={tdStyle}>{aspect.value ?? "-"}</td>
<td style={tdStyle}>{aspect.quantity ?? "-"}</td>
<td style={tdStyle}>{aspect.installDate ?? "-"}</td>
@ -304,7 +344,7 @@ export default function ElementTable({ groupedElements }: Props) {
<td style={tdStyle}>{aspect.comments ?? "-"}</td>
</tr>
))
)}
)}
</tbody>
</table>
</td>