refactor(arch): eliminate direct service calls in components — route all through hooks
New hook files: - useAuth.ts: useLogin, useSwitchDemoRole, useSwitchOrganization - useAI.ts: useParseNeed, useGenerateOfferEmail, useGenerateDecisionBrief, useParseListingText - useAssistant.ts: useAssistantSuggestions (useQuery), useAssistantAnswer (useMutation) - useOfferReport.ts: useOfferReportByInquiry, useCreateOfferReport, useUpdateOfferReport, useGenerateOfferReportPdf - useInquiryReport.ts: useInquiryReportByInquiry, useCreateInquiryReport, useUpdateInquiryReport, useFinalizeInquiryReport - useMarketReport.ts: useMarketReport - useWeighting.ts: useDefaultWeights (synchronous wrapper) - useUnitMatches.ts: useUnitMatchesMap, useUnitBundle, useBundleMatches (useMemo wrappers) Extended hooks: useProperties (add update/create/remove mutations), useNeeds (add useCreateNeed), useMatches (add useNeedMatchesForProperty, useAdditionalMatchesForInquiry), useReviewQueue (add useCreateReviewTask) Updated 21 components/pages: all direct service imports replaced with hooks. Deliberate exception: getRecommendedActions in DataQuality.tsx (pure sync utility, no provider access). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,12 @@ import { Box, CircularProgress, Typography } from '@mui/material'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { useMatchesByProperty, useApproveMatch } from '../../hooks/useMatches'
|
||||
import { usePropertyById } from '../../hooks/useProperties'
|
||||
import { useCreateReviewTask } from '../../hooks/useReviewQueue'
|
||||
import { useMatchCenterStore } from '../../stores/matchCenterStore'
|
||||
import { useCompareStore } from '../../stores/compareStore'
|
||||
import { useToastStore } from '../../stores/toastStore'
|
||||
import { MatchCardExpanded } from '../match-card/MatchCardExpanded'
|
||||
import { buildMatchCardViewModel } from '../../features/matching/matchCardAdapter'
|
||||
import { reviewService } from '../../services/reviewService'
|
||||
import { MatchCenterEmptyState } from './MatchCenterEmptyState'
|
||||
import { MatchStatusBadge } from './MatchStatusBadge'
|
||||
import type { MatchCardAction } from '../match-card/MatchCardViewModel'
|
||||
@@ -18,6 +18,7 @@ export function MatchBriefingPanel() {
|
||||
const { selectedPropertyId, selectedNeedId } = useMatchCenterStore()
|
||||
const { addToCompare } = useCompareStore()
|
||||
const approveMatch = useApproveMatch()
|
||||
const createReviewTask = useCreateReviewTask()
|
||||
const showToast = useToastStore((s) => s.showToast)
|
||||
|
||||
const { data: matches = [], isLoading: matchesLoading } = useMatchesByProperty(selectedPropertyId ?? '')
|
||||
@@ -64,7 +65,7 @@ export function MatchBriefingPanel() {
|
||||
label: 'Zur Prüfung',
|
||||
actionType: 'SEND_REVIEW',
|
||||
variant: 'secondary',
|
||||
onClick: () => { reviewService.createReviewTask(match.id) },
|
||||
onClick: () => { createReviewTask.mutate(match.id) },
|
||||
},
|
||||
{
|
||||
id: 'compare',
|
||||
|
||||
Reference in New Issue
Block a user