import Footer from "../Layout/Footer"; import Navbar from "../Layout/Navbar"; import { useNavigate, useParams } from "react-router-dom"; import { useEffect, useState } from "react"; import axios from "axios"; const InternshipDetails = () => { const navigate = useNavigate(); const { id } = useParams(); const [intern, setIntern] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { axios .get(`${import.meta.env.VITE_API_BASE_URL}/lowongan-magang-api/get`) .then((res) => { const selected = res.data.data.find((item: any) => item.id === id); setIntern(selected); setLoading(false); }) .catch((err) => { console.error("Failed to fetch internship detail:", err); setLoading(false); }); }, [id]); if (loading) return
Loading...
; if (!intern) return
Internship not found.
; const isExpired = new Date(intern.durasi_akhir) < new Date() || intern.status_lowongan !== "dibuka"; return (
{/* Navbar Section */}
{/* Content Section */}
{/* Header */}

{intern.posisi}

{/* Lokasi */}

{intern.lokasi}

{/* Kelompok Peminatan */}

{intern.kelompok_peminatan}

{/* Paid / Unpaid */}

{intern.paid === "paid" ? "Paid" : "Unpaid"}

{/* Apply Button */}
{/* Job Description Only */}
{/* Footer */}
); }; export default InternshipDetails;