import React from 'react'; import { Card, Button } from '../components/UiKit'; import { CompanyReport, Report } from '../types'; import RadarPerformanceChart from '../components/charts/RadarPerformanceChart'; import ScoreBarList from '../components/charts/ScoreBarList'; interface ReportDetailProps { report: CompanyReport | Report; type: 'company' | 'employee'; employeeName?: string; onClose: () => void; } const ReportDetail: React.FC = ({ report, type, employeeName, onClose }) => { if (type === 'company') { const companyReport = report as CompanyReport; return (

Company Report

Last updated: {new Date(companyReport.createdAt).toLocaleDateString()}

{/* Executive Summary */}

Executive Summary

{companyReport.executiveSummary}

{/* Overview Stats */}

Company Overview

{companyReport.overview.totalEmployees}
Total Employees
{companyReport.overview.departmentBreakdown?.length || 0}
Departments
{companyReport.overview.averagePerformanceScore || 'N/A'}
Avg Performance
{companyReport.overview.riskLevel || 'Low'}
Risk Level
{/* Key Personnel Changes */} {companyReport.keyPersonnelChanges && companyReport.keyPersonnelChanges.length > 0 && (

Key Personnel Changes

{companyReport.keyPersonnelChanges.map((change, idx) => (

{change.employeeName}

{change.role} • {change.department}

{change.changeType}

{change.impact}

))}
)} {/* Immediate Hiring Needs */} {companyReport.immediateHiringNeeds && companyReport.immediateHiringNeeds.length > 0 && (

Immediate Hiring Needs

{companyReport.immediateHiringNeeds.map((need, idx) => (

{need.role}

{need.urgency}

{need.department}

{need.reason}

))}
)} {/* Forward Operating Plan */} {companyReport.forwardOperatingPlan && (

Forward Operating Plan

Next Quarter Goals

    {companyReport.forwardOperatingPlan.nextQuarterGoals?.map((goal, idx) => (
  • {goal}
  • ))}

Key Initiatives

    {companyReport.forwardOperatingPlan.keyInitiatives?.map((initiative, idx) => (
  • {initiative}
  • ))}
)} {/* Organizational Strengths */} {companyReport.organizationalStrengths && companyReport.organizationalStrengths.length > 0 && (

Organizational Strengths

{companyReport.organizationalStrengths.map((strength, idx) => (
{strength.icon || '💪'}

{strength.area || strength}

{strength.description}

))}
)} {/* Grading Overview */} {companyReport.gradingOverview && (

Grading Overview

{Object.entries(companyReport.gradingOverview).map(([category, score], idx) => (
{score}/5
{category.replace(/([A-Z])/g, ' $1').trim()}
))}
)} {/* Organizational Impact Summary */} {companyReport.organizationalImpactSummary && (

Organizational Impact Summary

{companyReport.organizationalImpactSummary}

)}
); } else { const employeeReport = report as Report; return (

{employeeName}'s Performance Report

{employeeReport.employee?.role} • {employeeReport.employee?.department}

{/* Self-Reported Role & Output */} {employeeReport.roleAndOutput && (

Self-Reported Role & Output

Responsibilities

{employeeReport.roleAndOutput.responsibilities}

Clarity on Role

{employeeReport.roleAndOutput.clarityOnRole}

Self-Rated Output

{employeeReport.roleAndOutput.selfRatedOutput}

)} {/* Performance Charts */} {employeeReport.grading?.[0]?.scores && (

Performance Analysis

({ label: s.subject, value: (s.value / s.fullMark) * 100 }))} />
({ label: s.subject, value: s.value, max: s.fullMark }))} />
)} {/* Behavioral & Psychological Insights */} {employeeReport.insights && (

Behavioral & Psychological Insights

Personality Traits

{employeeReport.insights.personalityTraits || 'No personality traits data available.'}

Self-awareness

{employeeReport.insights.selfAwareness || 'No self-awareness data available.'}

Psychological Indicators

    {employeeReport.insights.psychologicalIndicators?.map((indicator, idx) => (
  • {indicator}
  • )) ||
  • No psychological indicators available.
  • }

Growth Desire

{employeeReport.insights.growthDesire || 'No growth desire data available.'}

)} {/* Strengths & Weaknesses */}

Strengths

{employeeReport.insights?.strengths?.map((strength, idx) => (
{strength}
))}

Development Areas

{employeeReport.insights?.weaknesses?.map((weakness, idx) => (
! {weakness}
))}
{/* Opportunities */} {employeeReport.opportunities && employeeReport.opportunities.length > 0 && (

Opportunities

{employeeReport.opportunities.map((opp, idx) => (

{opp.roleAdjustment || 'Opportunity'}

{opp.accountabilitySupport || opp.description}

))}
)} {/* Risks */} {employeeReport.risks && employeeReport.risks.length > 0 && (

Risks

{employeeReport.risks.map((risk, idx) => (
{risk}
))}
)} {/* Recommendations */} {employeeReport.recommendations && employeeReport.recommendations.length > 0 && (

Recommendations

{employeeReport.recommendations.map((rec, idx) => (
{rec}
))}
)}
); } }; export default ReportDetail;