import { Box, Chip, Divider, Paper, Typography } from '@mui/material' import { Activity, Building2, HardHat, MapPin, Percent, TrendingDown, TrendingUp, Train, Users, Zap, } from 'lucide-react' import { useNavigate } from 'react-router' import { useProperties } from '../../hooks/useProperties' import { getCityIntelligence } from '../../lib/locationIntelligence' import type { Property } from '../../domain/property' import { DS_TEXT, DS_SURFACE, DS_BORDER } from '../../lib/ds' import { SoftFactorBar } from './SoftFactorBar' import { KpiTile } from './KpiTile' import { NEW_PROJECTS } from './locationIntelligenceConstants' // ── Main component ──────────────────────────────────────────────────────────── interface Props { property: Property | null } export function LocationIntelligencePanel({ property }: Props) { const navigate = useNavigate() const { data: allProperties = [] } = useProperties() if (!property) return null const city = property.location.city const intel = getCityIntelligence(city) const sf = property.softFactors const hasSoftFactors = sf && ( sf.footfallScore !== undefined || sf.taxEnvironmentScore !== undefined || sf.commuterAccessScore !== undefined || sf.talentAccessScore !== undefined || sf.prestigeScore !== undefined || sf.prestige !== undefined ) // Market comparables: same type, same city, different property const comparables = allProperties .filter(p => p.id !== property.id && p.assetType === property.assetType && p.location.city === city) .sort((a, b) => b.confidenceScore - a.confidenceScore) .slice(0, 3) const newProjects = NEW_PROJECTS[city] ?? [] const rentTrendPositive = intel && intel.rentTrend12m > 0 return ( Standort-Intelligence Wirtschaftliche Faktoren und Marktkontext — über klassische Flächenangaben hinaus {/* ── City KPIs ── */} {intel && ( <> = 115 ? DS_TEXT.success : intel.purchasingPowerIndex >= 95 ? DS_TEXT.warning : DS_TEXT.error} /> {/* Rent trend interpretation */} {rentTrendPositive ? : } {rentTrendPositive ? `Mietpreise in ${city} sind in den letzten 12 Monaten um ${intel.rentTrend12m}% gestiegen. Frühzeitig abschliessen kann vorteilhaft sein.` : `Mietpreise in ${city} sind leicht rückläufig. Verhandlungsspielraum nutzen.`} {/* Tax + demand */} Steuerindex Kanton {intel.taxIndexCanton} (CH = 100) {intel.taxIndexCanton <= 75 ? 'Sehr steuerattraktiv' : intel.taxIndexCanton <= 95 ? 'Günstige Steuerlast' : intel.taxIndexCanton <= 110 ? 'Durchschnittlich' : 'Hohe Steuerlast'} Nachfragestärke Aktive Nachfrage in {city} {/* Industry clusters */} Dominante Branchen-Cluster {intel.dominantIndustryClusters.map(c => ( ))} {/* Infrastructure */} {intel.plannedInfrastructure.length > 0 && ( Geplante Infrastruktur-Projekte {intel.plannedInfrastructure.map((proj, i) => ( {proj.timeline} {proj.project} {proj.impact} ))} )} )} {/* ── Soft Factors ── */} {hasSoftFactors && ( KI-berechnete Standortqualität } tooltip="Geschätzte Personenfrequenz im Umfeld — relevant für Retail & Sichtbarkeit" /> } tooltip={sf.publicTransportMinutes ? `~${sf.publicTransportMinutes} Min. zum nächsten ÖV-Hub` : 'Öffentliche Erreichbarkeit des Standorts'} /> } tooltip="Verfügbarkeit qualifizierter Fachkräfte in einem 30-Min.-Radius" /> } tooltip="Adress-Prestige und wahrgenommene Standortqualität" /> } tooltip="Möglichkeit zur Flächen-Anpassung (Ausbau, Teilung, Erweiterung)" /> {sf.esgScore !== undefined && ( } tooltip="Umwelt-, Sozial- und Governance-Standard des Gebäudes" /> )} )} {/* ── Market Comparables ── */} {comparables.length > 0 && ( <> Vergleichbare Angebote in {city} {comparables.map(p => ( navigate(`/demand/property/${p.id}`)} sx={{ display: 'flex', alignItems: 'center', gap: 1.5, py: 0.75, borderBottom: '1px solid #f1f5f9', cursor: 'pointer', '&:hover': { bgcolor: DS_SURFACE.neutral.bg, borderRadius: 0.5 }, }} > {p.title} {p.areaSqm} m² · CHF {p.rentPricePerSqm}/m²/Jahr {p.rentPricePerSqm < property.rentPricePerSqm && ' · günstiger'} {p.rentPricePerSqm > property.rentPricePerSqm && ' · teurer'} ))} )} {/* ── New Construction ── */} {newProjects.length > 0 && ( <> Neubauprojekte als Alternative {newProjects.map((proj, i) => ( {proj.title} {proj.area} · Fertigstellung {proj.completion} {proj.note} ))} )} ) }