feat(F020): frontend infrastructure foundation
- src/lib/constants.ts: centralized route paths, labels, thresholds - src/lib/utils.ts: formatting, color helpers, math utils - src/hooks/: useProperties, useMatches, useFutureSignals, useNeeds - src/components/scores/MatchScoreRing - src/components/data-quality/DataQualityBar - src/components/future-signals/SignalTypeBadge - src/components/cards/SourceTypeBadge - src/provider/AuthProvider (placeholder, swappable) - main.tsx: AuthProvider + centralized stale time Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { futureSignalService } from '../services/futureSignalService'
|
||||
import { STALE_SIGNALS } from '../lib/constants'
|
||||
|
||||
export function useFutureSignals() {
|
||||
return useQuery({
|
||||
queryKey: ['futureSignals'],
|
||||
queryFn: () => futureSignalService.getAll(),
|
||||
staleTime: STALE_SIGNALS,
|
||||
select: (res) => res.data ?? [],
|
||||
})
|
||||
}
|
||||
|
||||
export function useFutureSignalsByProperty(propertyId: string) {
|
||||
return useQuery({
|
||||
queryKey: ['futureSignals', 'property', propertyId],
|
||||
queryFn: () => futureSignalService.getByProperty(propertyId),
|
||||
staleTime: STALE_SIGNALS,
|
||||
enabled: Boolean(propertyId),
|
||||
select: (res) => res.data ?? [],
|
||||
})
|
||||
}
|
||||
|
||||
export function useVerifySignal() {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (signalId: string) => futureSignalService.verify(signalId, 'current-user'),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['futureSignals'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user