import { memo, useState } from 'react' import { Box, Button, Paper, Typography } from '@mui/material' import { ChevronDown, ChevronUp } from 'lucide-react' import { PropertyMap } from '../shared' import { ExecutiveSummaryPanel, NeedAlignmentPanel, LocationIntelligencePanel, TradeoffPanel, RiskPanel, MissingInformationPanel, FutureAvailabilityContextPanel, ScoreBreakdownPanel, } from '.' import { MatchDetailPropertySections } from './MatchDetailPropertySections' import { useMatchDetail } from '../../hooks/useMatches' import type { Property } from '../../domain/property' import type { Need } from '../../domain/need' import type { FutureSignal } from '../../domain/futureSignal' import { DS_TEXT, DS_BORDER, DS_BG } from '../../lib/ds' import { lookupCityCoords } from '../../lib/locationIntelligence' type Match = NonNullable['data']> interface Props { match: Match property: Property | null need: Need | null signal: FutureSignal | null isFuture: boolean taxCalculatorUrl?: string } export const MatchDetailScoreBreakdown = memo(function MatchDetailScoreBreakdown({ match, property, need, signal, isFuture, taxCalculatorUrl, }: Props) { const [showFullAnalysis, setShowFullAnalysis] = useState(false) const searchCenter = need?.preferredLocations?.[0] ? lookupCityCoords(need.preferredLocations[0]) : null const searchLabel = need?.preferredLocations?.[0] return ( <> {/* ── Full analysis toggle ── */} {/* ── Full analysis (hidden by default) ── */} {showFullAnalysis && ( <> {!isFuture && property && } {!isFuture && property?.images?.[0] && property?.location?.coordinates && ( Standort {property.address.street} {property.address.houseNumber}, {property.address.postalCode} {property.address.city} )} {isFuture && } )} ) })