import React, { useState } from 'react'; import { ChevronDown, ChevronUp, ShieldAlert, Sparkles, HelpCircle, Lightbulb } from 'lucide-react'; export default function AnalysisPanel({ report, metrics }) { const [openSection, setOpenSection] = useState('creatures'); const getStatusColor = (status) => { switch (status?.toLowerCase()) { case 'auspicious': case 'high vitality': case 'safe': return '#50c878'; // Jade Green case 'balanced': case 'neutral': case 'moderate': return '#d4af37'; // Gold case 'inauspicious': case 'stagnant': case 'hazardous': default: return '#e53e3e'; // Rose Red } }; const toggleSection = (section) => { setOpenSection(openSection === section ? null : section); }; const sections = [ { id: 'creatures', title: '⛰️ Four Celestial Creatures', subtitle: 'Terrain configurations, protection, and viewsheds', data: report.creatures, metricsContent: [ { label: 'Aspect (Facing Direction)', value: `${metrics.aspect_deg}°` }, { label: 'Slope Gradient', value: `${metrics.slope_deg}°` }, { label: 'Backing Ridge Height', value: metrics.relative_backing_elevation_m > 0 ? `+${metrics.relative_backing_elevation_m}m` : 'None' }, { label: 'Front Openness (Bright Hall)', value: `${metrics.front_openness_deg}°` } ] }, { id: 'vitality', title: '🌱 Qi Flow & Microclimate', subtitle: 'Photosynthetic vitality and thermal balance', data: report.vitality, metricsContent: [ { label: 'Vegetation Index (NDVI)', value: metrics.ndvi }, { label: 'Thermal Deviation (LST)', value: `${metrics.lst_deviation_c > 0 ? '+' : ''}${metrics.lst_deviation_c}°C` } ] }, { id: 'water', title: '💧 Water Feng Shui', subtitle: 'Sinuosity, hydrology, and curvature safety', data: report.water, metricsContent: [ { label: 'Water Distance', value: metrics.water_distance_m < 9000 ? `${metrics.water_distance_m}m` : 'None nearby' }, { label: 'Hydrologic Bend Type', value: metrics.water_curve_type === 'concave_embrace' ? 'Embracing (Concave)' : (metrics.water_curve_type === 'convex_bow' ? 'Bow (Convex)' : 'None/Linear') } ] }, { id: 'sha_qi', title: '⚡ Sha Qi & Urban Hazards', subtitle: 'Road clashing, corner knives, and electromagnetic fields', data: report.sha_qi, metricsContent: [ { label: 'T-Junction Road Clashes', value: metrics.sha_qi_t_junctions }, { label: 'Adjacent Corner Knives', value: metrics.sha_qi_building_corners }, { label: 'EMF Proximity Distance', value: `${metrics.emf_distance_m}m` } ] } ]; return (
{sec.subtitle}
"{sec.data.feng_shui_exp}"
{sec.data.scientific_exp}