Implement comprehensive report system with detailed viewing and AI enhancements

- Add detailed report viewing with full-screen ReportDetail component for both company and employee reports
- Fix company wiki to display onboarding Q&A in card format matching Figma designs
- Exclude company owners from employee submission counts (owners contribute to wiki, not employee data)
- Fix employee report generation to include company context (wiki + company report + employee answers)
- Fix company report generation to use filtered employee submissions only
- Add proper error handling for submission data format variations
- Update Firebase functions to use gpt-4o model instead of deprecated gpt-4.1
- Fix UI syntax errors and improve report display functionality
- Add comprehensive logging for debugging report generation flow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ra
2025-08-18 19:08:29 -07:00
parent 557b113196
commit 1a9e92d7bd
20 changed files with 1793 additions and 635 deletions

View File

@@ -19,91 +19,52 @@ if (import.meta.env.DEV) {
console.log(` API_URL: ${API_URL}`);
}
export const EMPLOYEES: Employee[] = [
{ id: 'AG', name: 'Alex Green', initials: 'AG', email: 'alex.green@zitlac.com', department: 'Influencer Marketing', role: 'Influencer Coordinator & Business Development Outreach' },
{ id: 'MB', name: 'Michael Brown', initials: 'MB', email: 'michael.brown@zitlac.com', department: 'Engineering', role: 'Senior Developer' },
{ id: 'KT', name: 'Kevin Taylor', initials: 'KT', email: 'kevin.taylor@zitlac.com', department: 'Marketing', role: 'Marketing Manager' },
{ id: 'LR', name: 'Laura Robinson', initials: 'LR', email: 'laura.robinson@zitlac.com', department: 'HR', role: 'HR Manager', isOwner: true },
{ id: 'DS', name: 'David Stone', initials: 'DS', email: 'david.stone@zitlac.com', department: 'Sales', role: 'Sales Representative' },
{ id: 'SR', name: 'Samantha Reed', initials: 'SR', email: 'samantha.reed@zitlac.com', department: 'Operations', role: 'Operations Specialist' },
];
// DEPRECATED: These are legacy sample data that should not be used in production
// Real data should be generated via AI backend calls or user input
export const EMPLOYEES: Employee[] = [];
// DEPRECATED: Sample report data - real reports should be generated via /generateEmployeeReport API
export const REPORT_DATA: Report = {
employeeId: 'AG',
department: 'Influencer Marketing',
role: 'Influencer Coordinator & Business Development Outreach',
employeeId: 'sample',
department: 'Sample Department',
role: 'Sample Role',
roleAndOutput: {
responsibilities: 'Recruiting influencers, onboarding, campaign support, business development.',
clarityOnRole: '10/10 - Feels very clear on responsibilities.',
selfRatedOutput: '7/10 - Indicates decent performance but room to grow.',
recurringTasks: 'Influencer outreach, onboarding, communications.',
responsibilities: 'This is sample data. Real reports are generated via AI.',
clarityOnRole: 'Sample data',
selfRatedOutput: 'Sample data',
recurringTasks: 'Sample data',
},
insights: {
personalityTraits: 'Loyal, well-liked by influencers, eager to grow, client-facing interest.',
psychologicalIndicators: [
'Scores high on optimism and external motivation.',
'Shows ambition but lacks self-discipline in execution.',
'Displays a desire for recognition and community; seeks more appreciation.',
],
selfAwareness: 'High - acknowledges weaknesses like lateness and disorganization.',
emotionalResponses: 'Frustrated by campaign disorganization; would prefer closer collaboration.',
growthDesire: 'Interested in becoming more client-facing and shifting toward biz dev.',
personalityTraits: 'Sample data - use AI-generated reports',
psychologicalIndicators: ['Sample data'],
selfAwareness: 'Sample data',
emotionalResponses: 'Sample data',
growthDesire: 'Sample data',
},
strengths: [
'Builds strong relationships with influencers.',
'Has sales and outreach potential.',
'Loyal, driven, and values-aligned with the company mission.',
'Open to feedback and self-improvement.',
],
strengths: ['Sample data - use AI-generated reports'],
weaknesses: [
{ isCritical: true, description: 'Disorganized and late with deliverables — confirmed by previous internal notes.' },
{ isCritical: false, description: 'Poor implementation and recruiting output — does not effectively close the loop on influencer onboarding.' },
{ isCritical: false, description: 'May unintentionally cause friction with campaigns team by stepping outside process boundaries.' },
{ isCritical: false, description: 'Sample data - use AI-generated reports' }
],
opportunities: {
roleAdjustment: 'Shift fully to Influencer Manager & Biz Dev Outreach as planned. Remove all execution and recruitment responsibilities.',
accountabilitySupport: "Pair with a high-output implementer (new hire) to balance Gentry's strategic skills.",
roleAdjustment: 'Sample data',
accountabilitySupport: 'Sample data',
},
risks: [
"Without strict structure, Gentry's performance will stay flat or become a bottleneck.",
'If kept in a dual-role (recruiting + outreach), productivity will suffer.',
'He needs system constraints and direct oversight to stay focused.',
],
risks: ['Sample data - use AI-generated reports'],
recommendation: {
action: 'Keep',
details: [
'But immediately restructure his role:',
'• Remove recruiting and logistical tasks.',
'• Focus only on influencer relationship-building, pitching, and business development.',
"Pair him with a new hire who is ultra-organized and can execute on Gentry's deals.",
],
action: 'Sample',
details: ['Sample data - use AI-generated reports'],
},
grading: [],
};
// DEPRECATED: Sample submission data - real submissions come from employee questionnaires
export const SUBMISSIONS_DATA: Submission = {
employeeId: 'AG',
employeeId: 'sample',
answers: [
{
question: 'What is the mission of your company?',
answer: 'To empower small businesses with AI-driven automation tools that increase efficiency and reduce operational overhead.',
},
{
question: 'How has your mission evolved in the last 1-3 years?',
answer: 'We shifted from general SaaS tools to vertical-specific solutions, with deeper integrations and onboarding support.',
},
{
question: 'What is your 5-year vision for the company?',
answer: 'To become the leading AI operations platform for SMBs in North America, serving over 100,000 customers.',
},
{
question: "What are your company's top 3 strategic advantages?",
answer: '1. Fast product iteration enabled by in-house AI capabilities\n2. Deep customer understanding from vertical specialization\n3. High customer retention due to integrated onboarding',
},
{
question: 'What are your biggest vulnerabilities or threats?',
answer: 'Dependence on a single marketing channel, weak middle management, and rising customer acquisition costs.',
},
question: 'Sample question',
answer: 'Sample answer - real data comes from employee questionnaires',
}
],
};
@@ -135,74 +96,38 @@ export const FAQ_DATA: FaqItem[] = [
];
export const CHAT_STARTERS = [
"Summarize Alex Green's latest report.",
"What are Alex's biggest strengths?",
"Identify any risks associated with Alex.",
"Should Alex be considered for a promotion?"
"Summarize the latest employee reports.",
"What are the company's organizational strengths?",
"Identify any risks in our current workforce.",
"Which employees should be considered for promotion?",
"What are our immediate hiring needs?",
"How can we improve team performance?"
];
// DEPRECATED: This should not be used in production - real company reports are AI-generated
export const SAMPLE_COMPANY_REPORT: CompanyReport = {
id: 'sample-company-report',
createdAt: Date.now() - 86400000, // 1 day ago
id: 'placeholder-report',
createdAt: Date.now(),
overview: {
totalEmployees: 0, // Fixed: Start with 0 employees instead of hardcoded 6
totalEmployees: 0,
departmentBreakdown: [],
submissionRate: 0,
lastUpdated: Date.now() - 86400000
lastUpdated: Date.now(),
averagePerformanceScore: 0,
riskLevel: 'Unknown'
},
gradingBreakdown: [],
operatingPlan: { nextQuarterGoals: [], keyInitiatives: [], resourceNeeds: [], riskMitigation: [] },
personnelChanges: { newHires: [], promotions: [], departures: [] },
keyPersonnelChanges: [
{ employeeName: "Alex Green", department: "Influencer Marketing", role: "Influencer Coordinator", changeType: "newHire" },
{ employeeName: "Jordan Smith", department: "Engineering", role: "Software Engineer", changeType: "promotion" }
],
immediateHiringNeeds: [
{
department: 'Engineering',
role: 'Frontend Developer',
priority: 'High',
reasoning: 'Growing product development workload requires additional frontend expertise'
},
{
department: 'Marketing',
role: 'Content Creator',
priority: 'Medium',
reasoning: 'Increasing content demands for influencer campaigns'
}
],
keyPersonnelChanges: [],
immediateHiringNeeds: [],
forwardOperatingPlan: {
quarterlyGoals: [
'Expand influencer network by 40%',
'Launch automated campaign tracking system',
'Implement comprehensive onboarding process',
'Increase team collaboration efficiency by 25%'
],
resourceNeeds: [
'Additional engineering talent',
'Enhanced project management tools',
'Training budget for skill development',
'Upgraded communication infrastructure'
],
riskMitigation: [
'Cross-train team members to reduce single points of failure',
'Implement backup processes for critical operations',
'Regular performance reviews and feedback cycles',
'Diversify client base to reduce dependency risks'
]
quarterlyGoals: [],
resourceNeeds: [],
riskMitigation: []
},
organizationalStrengths: [
],
organizationalRisks: [
'Key personnel dependency in critical roles',
'Limited project management oversight',
'Potential burnout from rapid growth',
'Communication gaps between departments'
],
gradingOverview: {
"overallGrade": 4,
"strengths": 3,
"weaknesses": 1
},
executiveSummary: `Your organization is ready to get started with employee assessments. Begin by inviting team members to complete their questionnaires and build comprehensive insights about your workforce.`
organizationalStrengths: [],
organizationalRisks: [],
gradingOverview: {},
executiveSummary: `Welcome to Auditly! Generate your first AI-powered company report by inviting employees and completing the onboarding process.`
};