import { supabase } from '../supabaseClient'; // Adjust the path if your file is in a different folder
import React, { useState, useMemo } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
// --- IMPORT YOUR PAGE COMPONENTS ---
import JobPosting from './JobPosting'; // 👈 IMPORT THE NEW PAGE
import SettingsPage from './settingsPage'; // 👈 IMPORT THE NEW PAGE
// --- Icon Components ---
const HomeIcon = () => ( );
const UsersIcon = () => ( );
const BriefcaseIcon = () => ( );
const MessageSquareIcon = () => ( );
const SettingsIcon = () => ( );
const LogoutIcon = () => ( );
const PlusIcon = () => ;
const EditIcon = () => ;
const ViewIcon = () => ;
const TrashIcon = () => ;
const UploadIcon = () => ;
const SpinnerIcon = () => ;
const CheckCircleIcon = () => ( );
const SmallCalendarIcon = () => ( );
const ChevronRightIcon = () => ( );
const BriefcasePlusIcon = () => ( );
// --- New Icons for CV Sorting Page ---
const FiltersIcon = () => ( );
const ScoringIcon = () => ( );
const ClearIcon = () => ( );
const ArrowRightOnRectangleIcon = () => ();
// --- Stat Card Component ---
const StatCard = ({ icon, value, label, tint }) => (
Schedule Interview
setSelectedDate(e.target.value)} style={{ padding: '0.75rem', borderRadius: '0.5rem', border: '1px solid rgba(239, 68, 68, 0.3)', backgroundColor: 'rgba(255,255,255,0.1)', color: 'white' }} />
setSelectedTime(e.target.value)} style={{ padding: '0.75rem', borderRadius: '0.5rem', border: '1px solid rgba(239, 68, 68, 0.3)', backgroundColor: 'rgba(255,255,255,0.1)', color: 'white' }} />
Cancel
Schedule
);
};
// --- Message Modal ---
const MessageModal = ({ isOpen, onClose, onSend }) => {
const [message, setMessage] = useState('');
const handleSend = () => {
if (message.trim()) {
onSend(message);
onClose();
} else {
alert('Message cannot be empty.');
}
};
if (!isOpen) return null;
return (
{data.name}
{data.status}
{data.role} • {data.experience}
{data.skills.map(skill => ({skill}))}
{data.date !== 'N/A' &&
Interview: {data.date} at {data.time}
}
{tab === 'interviews' && (
openDateTimeModal(data)} whileHover={{ scale: 1.03 }} whileTap={{ scale: 0.98 }} style={{ backgroundColor: 'rgba(255,255,255,0.1)', border: '1px solid rgba(255,255,255,0.2)', color: 'white', padding: '0.5rem 1rem', borderRadius: '9999px', fontWeight: '500', cursor: 'pointer' }}>Reschedule
)}
{tab === 'accepted' && (
openDateTimeModal(data)} whileHover={{ scale: 1.03 }} whileTap={{ scale: 0.98 }} style={{ backgroundColor: 'rgba(255,255,255,0.1)', border: '1px solid rgba(255,255,255,0.2)', color: 'white', padding: '0.5rem 1rem', borderRadius: '9999px', fontWeight: '500', cursor: 'pointer' }}>Schedule
)}
{(tab === 'interviews' || tab === 'accepted' || tab === 'rejected') && (
openMessageModal(data)} whileHover={{ scale: 1.03 }} whileTap={{ scale: 0.98 }} style={{ backgroundColor: 'rgba(255,255,255,0.1)', border: '1px solid rgba(255,255,255,0.2)', color: 'white', padding: '0.5rem 1rem', borderRadius: '9999px', fontWeight: '500', cursor: 'pointer' }}>Send Message
)}
View CV
);
};
const tabItems = [ { key: 'interviews', label: 'Interviews' }, { key: 'accepted', label: 'Accepted CVs' }, { key: 'rejected', label: 'Rejected CVs' }, ];
return (
setSearchQuery(e.target.value)} style={{ flexGrow: 1, padding: '0.75rem', borderRadius: '0.5rem', border: '1px solid rgba(239, 68, 68, 0.3)', backgroundColor: 'rgba(255,255,255,0.1)', color: 'white' }} />
Filters
Scoring
Clear
Sort by:
{['Match Score', 'Experience', 'Name', 'Date'].map(sortKey => (
))}
{/* Filter Applications Panel */}
Filter Applications
Filters
{/* Job Position Dropdown */}
{/* Application Status Dropdown */}
{/* Only show pending toggle */}
Only show pending
Applications
{['Applicant', 'Experience', 'Skills', 'Job Title', 'Status', 'Score', 'Actions'].map(header => (
| {header} |
))}
{filteredAndSortedApplicants.map((app, index) => (
|
{app.experience} years |
{app.skills.map(skill => {skill})}
|
{app.jobTitle} |
|
{app.score} |
|
))}
);
};
// --- Chart Components ---
const BarChart = () => {
const generateRandomData = () => {
const data = [];
const today = new Date();
for (let i = 0; i < 30; i++) {
const date = new Date(today);
date.setDate(today.getDate() - (29 - i));
const month = date.toLocaleString('en-us', { month: 'short' });
const day = date.getDate();
data.push({ name: `${month} ${day < 10 ? '0' : ''}${day}`, value: Math.floor(Math.random() * 5) + 1 });
}
return data;
};
const data = generateRandomData();
const maxValue = Math.max(...data.map(d => d.value));
return (