"use client"; import { useState /* useRef, useEffect - Remove these if no longer needed */, } from "react"; // Updated imports import Link from "next/link"; import { Vacancy } from "@/types"; import VacancyApplicationForm from "@/components/VacancyApplicationForm"; import { FaMapMarkerAlt, FaBriefcase, FaClock, FaCalendarAlt, FaDollarSign, FaGraduationCap, FaShareAlt, FaCheckCircle, FaBuilding, FaLink, FaListUl, FaInfoCircle, FaStar, FaGift, FaTools, } from "react-icons/fa"; import { formatDate } from "@/lib/helpers"; import { COLORS } from "@/constants"; import Image from "next/image"; import { MetadataItem } from "./MetadataItem"; import { Badge } from "./Badge"; import { ListSection } from "./ListSection"; import Button from "@/components/ui/Button"; // Assuming you have a Button component import Modal from "@/components/ui/Modal"; interface VacancyClientContentProps { vacancy: Vacancy & { company?: { name: string; logoUrl?: string; websiteUrl?: string }; skills?: string[]; }; shareUrl: string; shareTitle: string; } export default function VacancyClientContent({ vacancy, shareUrl, shareTitle, }: VacancyClientContentProps) { // State to control modal visibility const [isApplyModalOpen, setIsApplyModalOpen] = useState(false); // const applyFormRef = useRef(null); // Remove this ref // Remove the useEffect for scrolling const handleOpenApplyModal = () => { setIsApplyModalOpen(true); }; const handleCloseApplyModal = () => { setIsApplyModalOpen(false); }; return (
{" "} {/* Adjusted padding */} {/* --- Company Header --- */} {vacancy.company && (
{" "} {/* Added flex-grow and min-w-0 for wrapping */} {vacancy.company.logoUrl ? ( {`${vacancy.company.name} ) : (
)}
{" "} {/* Added min-w-0 here too */}

{" "} {/* Consider truncate */} {vacancy.title}

at {vacancy.company.name}

{vacancy.company.websiteUrl && ( Visit website{" "} )}
{/* Apply Button in Header */}
)} {/* --- End Company Header --- */} {/* --- Main Grid Layout --- */}
{/* --- Main Content Area (Left Column) --- */}
{/* Title if no company header */} {!vacancy.company && (

{vacancy.title}

{/* Apply Button if no header */}
)} {/* Job Description */}

{" "} Job Description

{/* Or render as text if plain:

{vacancy.description}

*/}
{/* --- List Sections (Responsibilities, Qualifications, Skills, Benefits) --- */} {/* Assuming ListSection renders conditionally if items are empty */} {/* Skills Section */} {vacancy.skills && vacancy.skills.length > 0 && (

{" "} Skills

{vacancy.skills.map((skill, index) => ( {skill} ))}
)} {/* Benefits Section */} {vacancy.benefits && vacancy.benefits.length > 0 && (

{" "} Benefits

    {vacancy.benefits.map((item, index) => (
  • {item}
  • ))}
)} {/* --- End List Sections --- */} {/* Apply button below main content (redundant if header button exists, keep or remove as needed) */}
{/* --- End Main Content Area --- */} {/* --- Sidebar (Right Column) --- */}
{/* Metadata Card */}

Job Overview

{vacancy.location.city}, {vacancy.location.country}{" "} {vacancy.location.remote && Remote Possible} } /> {vacancy.employmentType}} /> {vacancy.salary && ( {vacancy.salary.min.toLocaleString()} -{" "} {vacancy.salary.max.toLocaleString()}{" "} {vacancy.salary.currency} {vacancy.salary.period} } /> )} {vacancy.applicationDeadline && ( )}
{/* Share Card */}

{" "} Share this opening

); }