"use client"; import { useState, useRef, useEffect } from "react"; 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"; 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) { const [showApplyForm, setShowApplyForm] = useState(false); const applyFormRef = useRef(null); const handleApplyClick = () => { setShowApplyForm(true); }; useEffect(() => { if (showApplyForm && applyFormRef.current) { setTimeout(() => { applyFormRef.current?.scrollIntoView({ behavior: "smooth", block: "start", }); }, 100); } }, [showApplyForm]); return ( // Container is now within the client component
{/* --- Re-include the FULL Company Header --- */} {vacancy.company && (
{vacancy.company.logoUrl ? ( {`${vacancy.company.name} ) : (
)}

{vacancy.title}

at {vacancy.company.name}

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

{vacancy.title}

)} {/* Job Description */}

{" "} Job Description

{vacancy.description}

{/* --- All List Sections (Responsibilities, Qualifications, Skills, Benefits) --- */} {/* Skills Section - RE-INCLUDED */} {vacancy.skills && vacancy.skills.length > 0 && (

{" "} Skills

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

{" "} Benefits

    {vacancy.benefits.map((item, index) => (
  • {item}
  • ))}
)} {/* --- End List Sections --- */} {/* Apply button below main content (conditional) */} {!showApplyForm && (
)}
{/* --- End Main Content Area --- */} {/* --- Sidebar (Right Column) --- */}
{/* Metadata Card - Exactly as before */}

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 - Exactly as before */}

{" "} Share this opening

{/* --- Conditionally Rendered Application Form Section --- */} {showApplyForm && (
{" "} {/* scroll-mt helps anchor links, lg:mt-0 aligns with other cards */}

Apply for: {vacancy.title}

setShowApplyForm(false)} />
)} {/* --- End Form Section --- */}
{/* --- End Sidebar --- */}
{/* --- End Main Grid --- */}
// End Container ); }