-
+
A
-
Submitting Your Responses...
-
Please wait while we process your assessment and generate your report.
+
Submitting Your Responses...
+
Please wait while we process your assessment and generate your report.
);
diff --git a/src/pages/Onboarding.tsx b/src/pages/Onboarding.tsx
index 924e446..4db639b 100644
--- a/src/pages/Onboarding.tsx
+++ b/src/pages/Onboarding.tsx
@@ -1,17 +1,19 @@
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
+import { useAuth } from '../contexts/AuthContext';
import { useOrg } from '../contexts/OrgContext';
import { onboardingSteps, OnboardingData, initializeOnboardingData } from '../data/onboardingSteps';
-import { secureApiPOST } from '../services/secureApi';
+import { secureApiPOST, secureApi } from '../services/secureApi';
import {
- FigmaOnboardingIntro,
- FigmaOnboardingQuestion,
- FigmaOnboardingMultipleChoice,
- FigmaOnboardingForm
+ FigmaOnboardingIntro,
+ FigmaOnboardingQuestion,
+ FigmaOnboardingMultipleChoice,
+ FigmaOnboardingForm
} from '../components/onboarding/FigmaOnboardingComponents';
const Onboarding: React.FC = () => {
const { org, upsertOrg, generateCompanyWiki } = useOrg();
+ const { user } = useAuth();
const navigate = useNavigate();
useEffect(() => {
@@ -36,10 +38,12 @@ const Onboarding: React.FC = () => {
switch (currentStep.type) {
case 'form':
- // Check required fields for form step - using companyDetails field
- const companyDetails = formData.companyDetails;
- return typeof companyDetails === 'string' && companyDetails.trim().length > 0;
-
+ // Check required fields for form step - company name and user name
+ const companyName = formData.companyName;
+ const yourName = formData.yourName;
+ return typeof companyName === 'string' && companyName.trim().length > 0 &&
+ typeof yourName === 'string' && yourName.trim().length > 0;
+
case 'question':
// Check if field is filled
if (currentStep.field) {
@@ -47,7 +51,7 @@ const Onboarding: React.FC = () => {
return Array.isArray(fieldValue) ? fieldValue.length > 0 : String(fieldValue || '').trim().length > 0;
}
return false;
-
+
case 'multiple_choice':
// Check if option is selected
if (currentStep.field) {
@@ -55,10 +59,10 @@ const Onboarding: React.FC = () => {
return String(fieldValue || '').trim().length > 0;
}
return false;
-
+
case 'intro':
return true;
-
+
default:
return false;
}
@@ -75,25 +79,15 @@ const Onboarding: React.FC = () => {
// Final step: submit all data and complete onboarding
setIsGeneratingReport(true);
try {
- // Submit the complete onboarding data
- const response = await secureApiPOST('onboarding/complete', formData);
-
- if (response.success) {
- // Update org with completion status
- const updatedOrg = {
- ...org,
- name: formData.companyName,
- onboardingCompleted: true,
- updatedAt: Date.now()
- };
-
- await upsertOrg(updatedOrg);
-
- // Navigate to reports
- navigate('/reports', { replace: true });
- } else {
- throw new Error(response.error || 'Failed to complete onboarding');
- }
+ await upsertOrg({
+ ...org,
+ companyName: formData.companyName,
+ companyLogo: formData.companyLogo,
+ onboardingData: formData,
+ onboardingCompleted: true,
+ updatedAt: Date.now(),
+ });
+ navigate('/reports', { replace: true });
} catch (error) {
console.error('Error completing onboarding:', error);
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
@@ -119,7 +113,7 @@ const Onboarding: React.FC = () => {
const sectionSteps = onboardingSteps.filter(step => step.section === currentStep.section);
const currentSectionIndex = sectionSteps.findIndex(step => step.id === currentStep.id);
const sectionName = currentStep.sectionName || `Section ${currentStep.section}`;
-
+
return {
sectionPosition: currentStep.section,
totalInSection: sectionSteps.length,
@@ -130,7 +124,7 @@ const Onboarding: React.FC = () => {
const renderStepContent = () => {
if (!currentStep) return null;
-
+
const sectionInfo = getSectionInfo();
switch (currentStep.type) {
@@ -160,18 +154,18 @@ const Onboarding: React.FC = () => {
);
case 'question':
- const questionValue = currentStep.fieldMapping
- ? String(formData[currentStep.fieldMapping as keyof OnboardingData] || '')
+ const questionValue = currentStep.field
+ ? String(formData[currentStep.field as keyof OnboardingData] || '')
: '';
-
+
return (
{
- if (currentStep.fieldMapping) {
- updateFormData(currentStep.fieldMapping as keyof OnboardingData, value);
+ if (currentStep.field) {
+ updateFormData(currentStep.field as keyof OnboardingData, value);
}
}}
onBack={handleBack}
@@ -180,24 +174,24 @@ const Onboarding: React.FC = () => {
totalInSection={sectionInfo.totalInSection}
sectionName={sectionInfo.sectionName}
canProceed={canProceed()}
- canSkip={currentStep.optional}
+ canSkip={!currentStep.required}
rows={6}
/>
);
case 'multiple_choice':
- const multipleChoiceValue = currentStep.fieldMapping
- ? String(formData[currentStep.fieldMapping as keyof OnboardingData] || '')
+ const multipleChoiceValue = currentStep.field
+ ? String(formData[currentStep.field as keyof OnboardingData] || '')
: '';
-
+
return (
{
- if (currentStep.fieldMapping) {
- updateFormData(currentStep.fieldMapping as keyof OnboardingData, value);
+ if (currentStep.field) {
+ updateFormData(currentStep.field as keyof OnboardingData, value);
}
}}
onBack={handleBack}
@@ -205,7 +199,7 @@ const Onboarding: React.FC = () => {
sectionPosition={sectionInfo.sectionPosition}
totalInSection={sectionInfo.totalInSection}
sectionName={sectionInfo.sectionName}
- canSkip={currentStep.optional}
+ canSkip={!currentStep.required}
/>
);
diff --git a/src/pages/ReportDetail.tsx b/src/pages/ReportDetail.tsx
deleted file mode 100644
index f5d7573..0000000
--- a/src/pages/ReportDetail.tsx
+++ /dev/null
@@ -1,411 +0,0 @@
-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.reasoning}
-
- ))}
-
-
- )}
-
- {/* Forward Operating Plan */}
- {companyReport.forwardOperatingPlan && (
-
-
-
- Forward Operating Plan
-
-
-
-
Next Quarter Goals
-
- {companyReport.forwardOperatingPlan.quarterlyGoals?.map((goal, idx) => (
- -
-
- {goal}
-
- ))}
-
-
-
-
Key Initiatives
-
- {companyReport.forwardOperatingPlan.riskMitigation?.map((initiative, idx) => (
- -
-
- {initiative}
-
- ))}
-
-
-
-
- )}
-
- {/* Organizational Strengths */}
- {companyReport.organizationalStrengths && companyReport.organizationalStrengths.length > 0 && (
-
-
-
- Organizational Strengths
-
-
- {companyReport.organizationalStrengths.map((strength, idx) => (
-
-
-
{strength.icon || '💪'}
-
-
{strength.area || strength.description}
-
{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.role} • {employeeReport.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;
\ No newline at end of file
diff --git a/src/pages/Reports.tsx b/src/pages/Reports.tsx
index 8dbfc4c..1464ea4 100644
--- a/src/pages/Reports.tsx
+++ b/src/pages/Reports.tsx
@@ -1,12 +1,13 @@
import React, { useState, useEffect } from 'react';
import { useOrg } from '../contexts/OrgContext';
-import { CompanyReport, Employee, Report } from '../types';
+import { CompanyReport, Employee, EmployeeReport } from '../types';
import { SAMPLE_COMPANY_REPORT } from '../constants';
+import RadarPerformanceChart from '../components/charts/RadarPerformanceChart';
const Reports: React.FC = () => {
const { employees, reports, user, isOwner, getFullCompanyReportHistory, generateEmployeeReport, generateCompanyReport, orgId } = useOrg();
const [companyReport, setCompanyReport] = useState(null);
- const [selectedReport, setSelectedReport] = useState<{ report: CompanyReport | Report; type: 'company' | 'employee'; employeeName?: string } | null>(null);
+ const [selectedReport, setSelectedReport] = useState<{ report: CompanyReport | EmployeeReport; type: 'company' | 'employee'; employeeName?: string } | null>(null);
const [searchQuery, setSearchQuery] = useState('');
const [generatingReports, setGeneratingReports] = useState>(new Set());
const [generatingCompanyReport, setGeneratingCompanyReport] = useState(false);
@@ -75,22 +76,22 @@ const Reports: React.FC = () => {
};
return (
-
+
{/* Left Sidebar - Navigation */}
-
+
{/* Company Logo */}
-
+
-
-
Auditly Company
+
Auditly Company
@@ -109,7 +110,7 @@ const Reports: React.FC = () => {
-
Company Wiki
+
Company Wiki
@@ -117,9 +118,9 @@ const Reports: React.FC = () => {
-
Submissions
+
Submissions
-
+
-
Reports
+
Reports
@@ -140,7 +141,7 @@ const Reports: React.FC = () => {
-
Chat
+
Chat
@@ -155,7 +156,7 @@ const Reports: React.FC = () => {
-
Help
+
Help
@@ -171,23 +172,23 @@ const Reports: React.FC = () => {
-
Settings
+
Settings
{/* CTA Card */}
-
+
-
Build [Company]'s Report
-
Share this form with your team members to capture valuable info about your company to train Auditly.
+
Build [Company]'s Report
+
Share this form with your team members to capture valuable info about your company to train Auditly.
-
+
{/* Middle Section - Employee List */}
-
+
{/* Search */}
-
+
@@ -247,12 +248,12 @@ const Reports: React.FC = () => {
}`}
onClick={handleCompanyReportSelect}
>
-
+
-
Company Report
+
Company Report
)}
@@ -265,11 +266,11 @@ const Reports: React.FC = () => {
onClick={() => handleEmployeeSelect(employee)}
>
-
-
@@ -289,17 +290,17 @@ const Reports: React.FC = () => {
/>
) : (
)
) : (
-
+
Select a Report
-
+
Choose a company or employee report from the list to view details.
@@ -318,14 +319,16 @@ const CompanyReportContent: React.FC<{
onRegenerate: () => void;
isGenerating: boolean;
}> = ({ report, onRegenerate, isGenerating }) => {
+ const [activeDepartmentTab, setActiveDepartmentTab] = useState('Campaigns');
+
return (
<>
{/* Header */}