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 } from '@tanstack/react-query'
|
||||
import { propertyService } from '../services/propertyService'
|
||||
import type { AssetType, ResultType } from '../domain/enums'
|
||||
import { STALE_PROPERTIES } from '../lib/constants'
|
||||
|
||||
interface PropertyFilter {
|
||||
assetType?: AssetType
|
||||
resultType?: ResultType
|
||||
city?: string
|
||||
minAreaSqm?: number
|
||||
maxRentPerSqm?: number
|
||||
organizationId?: string
|
||||
}
|
||||
|
||||
export function useProperties(filter?: PropertyFilter) {
|
||||
return useQuery({
|
||||
queryKey: ['properties', filter ?? {}],
|
||||
queryFn: () => propertyService.getAll(filter),
|
||||
staleTime: STALE_PROPERTIES,
|
||||
select: (res) => res.data ?? [],
|
||||
})
|
||||
}
|
||||
|
||||
export function useProperty(id: string) {
|
||||
return useQuery({
|
||||
queryKey: ['property', id],
|
||||
queryFn: () => propertyService.getById(id),
|
||||
staleTime: STALE_PROPERTIES,
|
||||
enabled: Boolean(id),
|
||||
select: (res) => res.data ?? null,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user