Spaces:
Sleeping
Sleeping
File size: 1,890 Bytes
ea9ca44 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import React, { useState } from 'react';
// ✅ Import your new modular page components
// Make sure these paths match exactly where you saved the files
import ApplicantProfile from './ApplicantProfile';
import ApplicantJobPage from './ApplicantJobPage';
import ApplicantInterviews from './ApplicantInterviews';
import ApplicantATS from './ApplicantATS';
import ApplicantMessages from './ApplicantMessages';
export default function ClientDash({ onNavigate: globalNavigate }) {
// Default to the profile page when logging in
const [activePage, setActivePage] = useState('applicant-profile');
// 🛑 Traffic Controller Function
// This decides if we are switching TABS (internal) or LOGGING OUT (external)
const handleNavigation = (destination) => {
if (destination === 'login') {
// Pass 'login' up to App.js to handle logout
globalNavigate('login');
} else {
// Otherwise, just switch the local tab
setActivePage(destination);
}
};
// Render the correct component based on the activePage state
// We pass our new 'handleNavigation' down to the pages so their buttons work
switch (activePage) {
case 'applicant-profile':
return <ApplicantProfile onNavigate={handleNavigation} />;
case 'applicant-jobs':
return <ApplicantJobPage onNavigate={handleNavigation} />;
case 'applicant-interviews':
return <ApplicantInterviews onNavigate={handleNavigation} />;
case 'applicant-ats':
return <ApplicantATS onNavigate={handleNavigation} />;
case 'applicant-messages':
return <ApplicantMessages onNavigate={handleNavigation} />;
default:
return <ApplicantProfile onNavigate={handleNavigation} />;
}
} |