import {
Box,
Button,
Chip,
Paper,
Typography,
} from '@mui/material'
import {
Building2,
Clock,
ExternalLink,
Info,
Layers,
ShieldCheck,
Tag,
Train,
TrendingUp,
} from 'lucide-react'
import type { Property } from '../../domain/property'
import {
ASSET_LABELS,
FLOOR_LABEL,
KeyFactRow,
PASSERBY_LABELS,
RISK_LABELS,
SOURCE_LABELS,
UnitRow,
} from './MatchDetailPropertyDetails'
import { DS_TEXT, DS_BG, DS_SURFACE, DS_BORDER, DS_MARKET_SIGNAL } from '../../lib/ds'
interface PropertyDetailPublicSectionsProps {
property: Property
highlightUnitId?: string | null
}
export function PropertyDetailPublicSections({ property, highlightUnitId }: PropertyDetailPublicSectionsProps) {
const preMarketUnits = (property.units ?? []).filter(u => u.schattenmarktRelease?.enabled)
const otherUnits = (property.units ?? []).filter(u => !u.schattenmarktRelease?.enabled)
const flexibleUnits = (property.units ?? []).filter(u => u.isFlexible && u.minLettableSqm !== undefined)
const totalMonthly = Math.round(property.areaSqm * property.rentPricePerSqm / 12)
const rawMonthlyPerSqm = property.rentPricePerSqm / 12
const monthlyPerSqmLabel = Number.isInteger(rawMonthlyPerSqm)
? `CHF ${rawMonthlyPerSqm}.–`
: `CHF ${rawMonthlyPerSqm.toLocaleString('de-CH', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
const minLettable = property.areaSqmMin
?? (flexibleUnits.length > 0
? Math.min(...flexibleUnits.map(u => u.minLettableSqm!))
: undefined)
const sourceLabel = property.sourceLabel
?? property.sourceMeta?.sourceLabel
?? SOURCE_LABELS[property.sourceType]
?? property.sourceType
return (
<>
{/* ── Preis ── */}
Preis
{property.ancillaryCosts != null && (
)}
{/* ── Hauptangaben ── */}
Hauptangaben
{minLettable != null && (
)}
{property.contractDurationMonths != null && (
)}
{property.floorLevel != null && (
)}
{property.currentTenant && (
)}
{property.leaseEndDate && (
)}
{property.breakoutOption && (
)}
{property.riskLevel && (
)}
{property.expansionPotentialSqm != null && (
)}
{/* ── Eigenschaften ── */}
{property.softFactors && (
Eigenschaften
{property.softFactors.publicTransportMinutes != null && (
}
label={`ÖV: ${property.softFactors.publicTransportMinutes} Min. zu Fuss`}
sx={{ bgcolor: DS_SURFACE.blue.bg, color: DS_MARKET_SIGNAL.accent, border: `1px solid ${DS_SURFACE.blue.border}`, fontWeight: 500 }}
/>
)}
{property.softFactors.parkingSpots != null && property.softFactors.parkingSpots > 0 && (
)}
{property.softFactors.prestige != null && property.softFactors.prestige >= 80 && (
)}
{property.softFactors.visibilityScore != null && property.softFactors.visibilityScore >= 80 && (
)}
{property.softFactors.passerbyFrequency && (
)}
{property.softFactors.talentAccess != null && property.softFactors.talentAccess >= 80 && (
)}
{property.softFactors.talentAccess != null && property.softFactors.talentAccess >= 80 && (
)}
)}
{/* ── Wegzeit ── */}
{property.softFactors?.publicTransportMinutes != null && (
Wegzeit
{property.softFactors.publicTransportMinutes} Min. zu Fuss
Nächster ÖV-Anschluss — {property.location.city}
{property.softFactors.infrastructureNotes && (
{property.softFactors.infrastructureNotes}
)}
Die Zeiten beziehen sich auf die Strecke zu Fuss.
)}
{/* ── Einheiten ── */}
{(property.units ?? []).length > 0 && (
Einheiten
{['Einheit', 'Fläche', 'Miete', 'Verfügbar ab', 'Status'].map(h => (
{h}
))}
{preMarketUnits.map(u => (
))}
{otherUnits.map(u => (
))}
)}
{/* ── Beschreibung ── */}
{property.description && (
Beschreibung
{property.description}
)}
{/* ── Quelle & Referenz ── */}
Quelle & Referenz
{property.propertyNumber && (
)}
{property.importedFrom && (
)}
{property.dataQuality.lastVerifiedAt && (
)}
{property.sourceUrl && (
}
href={property.sourceUrl}
target="_blank"
rel="noopener noreferrer"
sx={{ textTransform: 'none', fontSize: '0.8rem', borderColor: DS_BORDER.strong, color: DS_TEXT.primary }}
>
Zum Originalinserat
)}
>
)
}