609a3634bd
All external market properties now surface as VERIFIED_PORTFOLIO. Removes the type from enums, domain types, mock data, matching engine, components, hooks, and tests — zero user-visible distinction remains. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
2.0 KiB
TypeScript
49 lines
2.0 KiB
TypeScript
import type { IDashboardProvider, DashboardStats } from './IDashboardProvider'
|
|
import { mockProperties } from '../mock-data/properties'
|
|
import { mockMatches } from '../mock-data/matches'
|
|
import { mockNeeds } from '../mock-data/needs'
|
|
import { mockFutureSignals } from '../mock-data/futureSignals'
|
|
import { mockReviewQueue } from '../mock-data/reviewQueue'
|
|
import { mockDelay } from '../lib/mockUtils'
|
|
|
|
export const MockupDashboardProvider: IDashboardProvider = {
|
|
async getStats(organizationId?) {
|
|
await mockDelay()
|
|
|
|
let props = mockProperties
|
|
let matches = mockMatches
|
|
let needs = mockNeeds
|
|
let signals = mockFutureSignals
|
|
let queue = mockReviewQueue
|
|
|
|
if (organizationId) {
|
|
props = props.filter(p => p.organizationId === organizationId)
|
|
matches = matches.filter(m => m.organizationId === organizationId)
|
|
needs = needs.filter(n => n.organizationId === organizationId)
|
|
signals = signals.filter(s => s.organizationId === organizationId)
|
|
queue = queue.filter(r => r.relatedOrganizationId === organizationId)
|
|
}
|
|
|
|
const avgScore =
|
|
matches.length > 0
|
|
? matches.reduce((sum, m) => sum + m.matchScore, 0) / matches.length
|
|
: 0
|
|
|
|
const stats: DashboardStats = {
|
|
totalProperties: props.length,
|
|
verifiedProperties: props.filter(p => p.resultType === 'VERIFIED_PORTFOLIO').length,
|
|
verifiedPortfolioProperties: props.filter(p => p.resultType === 'VERIFIED_PORTFOLIO').length,
|
|
futureSignalProperties: props.filter(p => p.resultType === 'FUTURE_AVAILABILITY').length,
|
|
totalMatches: matches.length,
|
|
pendingReviews: queue.filter(r => r.status === 'PENDING').length,
|
|
approvedMatches: matches.filter(m => m.isApproved === true).length,
|
|
activeNeeds: needs.length,
|
|
totalSignals: signals.length,
|
|
verifiedSignals: signals.filter(s => s.isVerified).length,
|
|
averageMatchScore: Math.round(avgScore),
|
|
highConfidenceMatches: matches.filter(m => m.confidenceLevel >= 0.75).length,
|
|
}
|
|
return stats
|
|
},
|
|
}
|