import React from 'react'; import ReactDOM from 'react-dom'; import { motion, AnimatePresence } from 'framer-motion'; // --- Icons --- const BuildingIcon = () => (); const LocationIcon = () => (); const MoneyIcon = () => (); const CloseIcon = () => (); const CheckIcon = () => (); const JobDetail = ({ job, onClose, onApply, isApplied, isApplying }) => { // Determine if the job is expired based on the deadline string const isExpired = React.useMemo(() => { if (!job || !job.deadline || job.deadline === 'Open') return false; const deadlineDate = new Date(job.deadline); const today = new Date(); today.setHours(0, 0, 0, 0); return deadlineDate < today; }, [job]); // Portal renders this outside the main app flow return ReactDOM.createPortal( {job && ( e.stopPropagation()} > {/* Modal Header */}

{job.title}

{job.company}
{/* Modal Content */}
{job.location} {job.salary} {job.type}

About the Role

{job.description || "No description provided."}

{/* Safe Skills Rendering */} {job.skills && job.skills.length > 0 && ( <>

Skills Required

{job.skills.map((skill, index) => ( {skill} ))}
)}
Posted: {job.postedAt} • Deadline: {job.deadline}
{/* Modal Footer */}
{/* Logic for Apply Button */} {isApplied ? ( ) : ( )}
)}
, document.body ); }; export default JobDetail;