'use client'; import { Loader2, FileWarning } from 'lucide-react'; import { useReviewIQAnalytics } from '@/hooks/useReviewIQAnalytics'; import { AnalystReport } from './AnalystReport'; import { BusinessReport } from './BusinessReport'; import { isSynthesisV2 } from './types'; import type { ReviewIQFilters, LegacySynthesis, SynthesisV2 } from './types'; interface ReportTabProps { jobId?: string; businessId?: string; } // Default filters for Report view - uses 'all' time range for comprehensive analysis const defaultFilters: ReviewIQFilters = { timeRange: 'all', sentiment: [], urtDomain: null, intensity: [], brushRange: null, }; /** * Report Tab - Wraps report components with data fetching. * Automatically detects report version and renders appropriate component. */ export function ReportTab({ jobId, businessId }: ReportTabProps) { const { data, loading, error } = useReviewIQAnalytics({ jobId, businessId, filters: defaultFilters, }); // Loading state if (loading) { return (
); } // Error state if (error) { return (

{error}

); } // No data state if (!data) { return (

No data available for this report.

); } // No synthesis - AI report not generated yet if (!data.synthesis) { return (

AI Report Not Generated Yet

The AI-powered analyst report hasn't been generated for this dataset. Run the pipeline with the "synthesize" stage to generate the report.

Stage 5: Synthesize → Generates narratives, actions & insights
); } // Render the appropriate report based on synthesis version if (isSynthesisV2(data.synthesis)) { // New 6-section Business Report (v2.0) return ; } // Legacy Analyst Report (v1.x) return ( ); } export default ReportTab;