import React, { useState } from 'react'; import { CompanyWikiEmptyState } from './CompanyWikiEmptyState'; import { CompanyWikiCompletedState } from './CompanyWikiCompletedState'; import { InviteEmployeesModal } from './InviteEmployeesModal'; import { InviteMultipleEmployeesModal } from './InviteMultipleEmployeesModal'; export type WikiState = 'empty' | 'completed'; export type InviteModalState = 'none' | 'single' | 'multiple'; interface Employee { id: string; name: string; email: string; avatar?: string; } interface CompanyWikiManagerProps { initialState?: WikiState; onboardingProgress?: number; onCompleteOnboarding?: () => void; qaItems?: Array<{ question: string; answer: string }>; suggestedEmployees?: Employee[]; } export const CompanyWikiManager: React.FC = ({ initialState = 'empty', onboardingProgress = 60, onCompleteOnboarding, qaItems, suggestedEmployees }) => { const [wikiState, setWikiState] = useState(initialState); const [inviteModalState, setInviteModalState] = useState('none'); const [activeSection, setActiveSection] = useState(1); const handleCompleteOnboarding = () => { onCompleteOnboarding?.(); setWikiState('completed'); }; const handleInviteEmployee = (email: string) => { console.log('Inviting employee:', email); // Here you would typically call an API to send the invitation setInviteModalState('none'); // You could show a success toast here }; const handleInviteMultipleEmployees = (employees: Employee[]) => { console.log('Inviting multiple employees:', employees); // Here you would typically call an API to send multiple invitations setInviteModalState('none'); // You could show a success toast here }; const handleSectionClick = (section: number) => { setActiveSection(section); }; const handleCopyLink = () => { // Copy wiki link to clipboard const wikiUrl = `${window.location.origin}/#/company-wiki`; navigator.clipboard.writeText(wikiUrl).then(() => { console.log('Wiki link copied to clipboard'); // You could show a success toast here }); }; const renderWikiContent = () => { switch (wikiState) { case 'empty': return ( setInviteModalState('single')} onCopyLink={handleCopyLink} /> ); case 'completed': return ( setInviteModalState('single')} onCopyLink={handleCopyLink} /> ); default: return null; } }; return (
{renderWikiContent()} {/* Modals */} setInviteModalState('none')} onInvite={handleInviteEmployee} onMultipleInvite={() => setInviteModalState('multiple')} /> setInviteModalState('none')} onInviteSelected={handleInviteMultipleEmployees} suggestedEmployees={suggestedEmployees} />
); };