diff --git a/src/pages/government/legislative/[chamber].tsx b/src/pages/government/legislative/[chamber].tsx index eccea637a..e837519da 100644 --- a/src/pages/government/legislative/[chamber].tsx +++ b/src/pages/government/legislative/[chamber].tsx @@ -1,5 +1,5 @@ import { useParams } from 'react-router-dom'; -import { ExternalLink, MapPin, Phone, Globe } from 'lucide-react'; +import { ExternalLink, MapPin, Phone, Globe, Mail } from 'lucide-react'; import legislativeData from '../../../data/directory/legislative.json'; // Recursive component to render legislative details @@ -44,21 +44,99 @@ function LegislativeDetailSection({ 'address', 'trunkline', 'website', - 'email', ]; if (isSimpleObject) { - const cols = Object.keys(data).length > 4 ? Object.keys(data).length : 4; - + // Responsive table for Secretariat Officials (level 1) + if ( + level === 1 && + typeof data === 'object' && + data !== null && + 'role' in data && + 'name' in data + ) { + const obj = data as { + role: string; + name: string; + office?: string; + contact?: string; + email?: string; + }; + return ( +
+ + + + + + {obj.office && ( + + )} + + {obj.email && ( + + )} + + +
+ {obj.role} + + {obj.name} + + {obj.office} + + {obj.contact} + + +
+
+ ); + } + // Fallback for other simple objects return ( -
+
{Object.entries(data).map(([key, value]) => { if (skipKeys.includes(key) || value === undefined) return null; - + if (key === 'email' && value) { + return ( +
+
+ + + {String(value)} + +
+
+ ); + } return (