Fix organization setup flow: redirect to onboarding for incomplete setup

This commit is contained in:
Ra
2025-08-18 10:33:45 -07:00
commit 557b113196
60 changed files with 16246 additions and 0 deletions

156
types.ts Normal file
View File

@@ -0,0 +1,156 @@
import React from 'react';
export enum Theme {
Light = 'light',
Dark = 'dark',
System = 'system',
}
export interface Employee {
id: string;
name: string;
initials: string;
email: string;
department?: string;
role?: string;
isOwner?: boolean; // Company owner/HR access
}
export interface Report {
employeeId: string;
department: string;
role: string;
roleAndOutput: {
responsibilities: string;
clarityOnRole: string;
selfRatedOutput: string;
recurringTasks: string;
};
insights: {
personalityTraits: string;
psychologicalIndicators: string[];
selfAwareness: string;
emotionalResponses: string;
growthDesire: string;
strengths?: string[];
weaknesses?: string[];
value?: number;
};
actionableItems?: { id: string; title: string; impact: 'High' | 'Medium' | 'Low'; effort: 'High' | 'Medium' | 'Low'; description: string; }[];
roleFitCandidates?: { employeeId: string; roles: string[]; rationale: string; score: number; }[];
potentialExits?: { employeeId: string; risk: 'Low' | 'Medium' | 'High'; reason: string; }[];
traitWeighting?: { trait: string; weight: number; rationale?: string; }[];
strengths: string[];
weaknesses: {
isCritical: boolean;
description: string;
}[];
opportunities: {
roleAdjustment: string;
accountabilitySupport: string;
};
risks: string[];
recommendation: {
action: 'Keep' | 'Restructure' | 'Terminate';
details: string[];
};
grading: {
department: string;
lead: string;
support: string;
grade: string;
comment: string;
scores: { subject: string; value: number; fullMark: number; }[];
}[];
suitabilityScore?: number;
retentionRisk?: 'Low' | 'Medium' | 'High';
costEffectiveness?: 'Underperforming' | 'Aligned' | 'High Value';
}
export interface Submission {
employeeId: string;
answers: {
question: string;
answer: string;
}[];
}
export interface FaqItem {
question: string;
answer: string;
}
export interface NavItem {
href: string;
label: string;
icon: (props: { className?: string }) => React.ReactNode;
}
export interface ChatMessage {
id: string;
role: 'user' | 'assistant';
text: string;
isLoading?: boolean;
}
export interface CompanyReport {
id: string;
createdAt: number;
overview: {
totalEmployees: number;
departmentBreakdown: { department: string; count: number; }[];
submissionRate: number; // percentage of employees who submitted
lastUpdated: number;
// Optional aggregate metrics
averagePerformanceScore?: number;
riskLevel?: 'Low' | 'Medium' | 'High';
};
// Personnel lifecycle
personnelChanges: {
newHires: { name: string; department: string; role: string; impact?: string }[];
promotions: { name: string; fromRole: string; toRole: string; impact?: string }[];
departures: { name: string; department: string; reason: string; impact?: string }[];
};
// Backward-compatible flattened list (optional)
keyPersonnelChanges?: Array<{ employeeName: string; role: string; department: string; changeType: 'newHire' | 'promotion' | 'departure'; impact?: string }>;
// Hiring / talent gaps
immediateHiringNeeds: {
department: string;
role: string;
priority: 'High' | 'Medium' | 'Low';
reasoning: string;
urgency?: 'high' | 'medium' | 'low'; // UI alias
}[];
// Operating plan (dual naming for UI compatibility)
operatingPlan: {
nextQuarterGoals: string[];
keyInitiatives: string[];
resourceNeeds: string[];
riskMitigation: string[];
};
forwardOperatingPlan?: { // deprecated; kept for existing calls until phased out
quarterlyGoals: string[];
resourceNeeds: string[];
riskMitigation: string[];
};
// Strengths / risks
organizationalStrengths: Array<{ icon?: string; area: string; description: string }>;
organizationalRisks: string[];
organizationalImpactSummary?: string;
// Grading: array + map for UI
gradingBreakdown: {
category: string;
value: number; // 0-100
rationale?: string;
}[];
gradingOverview?: Record<string, number>; // legacy (0-5 scale expected by old UI)
executiveSummary: string;
}
export interface CompanyReportSummary {
id: string;
createdAt: number;
summary: string; // For backwards compatibility
}