diff --git a/src/components/supply/NeedMatchCard.tsx b/src/components/supply/NeedMatchCard.tsx index 0c58140..7758df8 100644 --- a/src/components/supply/NeedMatchCard.tsx +++ b/src/components/supply/NeedMatchCard.tsx @@ -4,6 +4,7 @@ import type { PropertyNeedMatch } from '../../domain/match' interface Props { match: PropertyNeedMatch + onClick?: () => void } function ScoreBadge({ score }: { score: number }) { @@ -43,17 +44,19 @@ function InfoRow({ icon, label, value }: { icon: React.ReactNode; label: string; ) } -export function NeedMatchCard({ match }: Props) { +export function NeedMatchCard({ match, onClick }: Props) { return ( diff --git a/src/components/supply/PropertyDetailView.tsx b/src/components/supply/PropertyDetailView.tsx index 8839a4b..b2dde83 100644 --- a/src/components/supply/PropertyDetailView.tsx +++ b/src/components/supply/PropertyDetailView.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react' +import { useNavigate } from 'react-router' import { Alert, Box, @@ -15,6 +16,7 @@ import { } from '@mui/material' import { useQueryClient } from '@tanstack/react-query' import { Edit2, Save, X } from 'lucide-react' +import { useOfferWizardStore } from '../../stores/offerWizardStore' import { PropertyMap } from '../shared' import { NeedMatchCard } from './NeedMatchCard' import { PropertyMarketSignalsTab } from './PropertyMarketSignalsTab' @@ -238,6 +240,8 @@ function OverviewPanel({ p, editing, draft, onDraftChange }: OverviewPanelProps) function MatchabilityTabPanel({ propertyId }: { propertyId: string }) { const [matches, setMatches] = useState([]) const [loading, setLoading] = useState(true) + const navigate = useNavigate() + const setSelectedProperties = useOfferWizardStore(s => s.setSelectedProperties) useEffect(() => { let cancelled = false @@ -248,6 +252,11 @@ function MatchabilityTabPanel({ propertyId }: { propertyId: string }) { return () => { cancelled = true } }, [propertyId]) + function handleNeedCardClick() { + setSelectedProperties([propertyId]) + navigate('/supply/anfragen', { state: { tab: 1 } }) + } + if (loading) { return ( @@ -263,7 +272,7 @@ function MatchabilityTabPanel({ propertyId }: { propertyId: string }) { Matchability - Bedarfsprofile mit ≥ 80% Match-Score für dieses Objekt + Bedarfsprofile mit ≥ 80% Match-Score — Karte klicken um Angebot zu erstellen {matches.length === 0 ? ( @@ -271,7 +280,7 @@ function MatchabilityTabPanel({ propertyId }: { propertyId: string }) { Keine Bedarfsprofile mit ≥ 80% Match-Score für dieses Objekt gefunden. ) : ( - matches.map(m => ) + matches.map(m => ) )} ) diff --git a/src/components/supply/PropertyMarketSignalsTab.tsx b/src/components/supply/PropertyMarketSignalsTab.tsx index 4268f5d..372bfcf 100644 --- a/src/components/supply/PropertyMarketSignalsTab.tsx +++ b/src/components/supply/PropertyMarketSignalsTab.tsx @@ -1,9 +1,7 @@ import { useEffect, useRef, useState } from 'react' -import { useNavigate } from 'react-router' import { Alert, Box, Button, Chip, CircularProgress, Dialog, DialogContent, DialogTitle, LinearProgress, Typography } from '@mui/material' -import { BarChart2, Building2, CheckCircle, Download, FileText, Lightbulb, Send, TrendingUp } from 'lucide-react' +import { BarChart2, Building2, CheckCircle, Download, FileText, Lightbulb, TrendingUp } from 'lucide-react' import { marketReportService } from '../../services/marketReportService' -import { useOfferWizardStore } from '../../stores/offerWizardStore' import type { MarketReport, PropertyMarketSignal, SignalCategory } from '../../domain/marketReport' interface Props { @@ -222,13 +220,6 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) { const [report, setReport] = useState(null) const [loading, setLoading] = useState(true) const [dialogOpen, setDialogOpen] = useState(false) - const navigate = useNavigate() - const setSelectedProperties = useOfferWizardStore(s => s.setSelectedProperties) - - function handleAngebotErstellen() { - setSelectedProperties([propertyId]) - navigate('/supply/anfragen', { state: { tab: 1 } }) - } useEffect(() => { let cancelled = false @@ -260,26 +251,15 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) { )} - - - - + {!report ? (