Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 1x | import React from 'react';
import { useParams } from 'react-router-dom';
import { useQuery } from 'react-query';
import axios from 'axios';
import { Building, MapPin, Users, Globe, Phone } from 'lucide-react';
const EmployerDetails = () => {
const { id } = useParams();
const { data: employer, isLoading } = useQuery(['employer', id], async () => {
const response = await axios.get(`/api/employers/${id}`);
return response.data;
});
if (isLoading) {
return (
<div className="flex items-center justify-center h-64">
<div className="animate-spin rounded-full h-32 w-32 border-b-2 border-primary-600"></div>
</div>
);
}
if (!employer) {
return (
<div className="text-center py-12">
<h3 className="text-lg font-medium text-gray-900">Employer not found</h3>
<p className="mt-1 text-sm text-gray-500">
The employer you're looking for doesn't exist.
</p>
</div>
);
}
return (
<div className="space-y-6">
<div className="bg-white shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
<div className="flex items-start">
<div className="flex-shrink-0">
<div className="h-16 w-16 rounded-full bg-primary-100 flex items-center justify-center">
<Building className="h-8 w-8 text-primary-600" />
</div>
</div>
<div className="ml-6 flex-1">
<h1 className="text-2xl font-bold text-gray-900">
{employer.company_name}
</h1>
<p className="text-lg text-gray-600">{employer.first_name} {employer.last_name}</p>
<p className="text-sm text-gray-500">{employer.email}</p>
<div className="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2">
{employer.industry && (
<div className="flex items-center text-sm text-gray-500">
<Building className="h-4 w-4 mr-2" />
{employer.industry}
</div>
)}
{employer.company_size && (
<div className="flex items-center text-sm text-gray-500">
<Users className="h-4 w-4 mr-2" />
{employer.company_size} employees
</div>
)}
{employer.website && (
<div className="flex items-center text-sm text-gray-500">
<Globe className="h-4 w-4 mr-2" />
<a href={employer.website} target="_blank" rel="noopener noreferrer" className="text-primary-600 hover:text-primary-500">
Website
</a>
</div>
)}
{employer.phone && (
<div className="flex items-center text-sm text-gray-500">
<Phone className="h-4 w-4 mr-2" />
{employer.phone}
</div>
)}
</div>
</div>
</div>
</div>
</div>
{employer.description && (
<div className="bg-white shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
<h2 className="text-lg font-medium text-gray-900 mb-4">About {employer.company_name}</h2>
<p className="text-gray-600 whitespace-pre-wrap">{employer.description}</p>
</div>
</div>
)}
{employer.address && (
<div className="bg-white shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
<h2 className="text-lg font-medium text-gray-900 mb-4">Address</h2>
<div className="flex items-start">
<MapPin className="h-5 w-5 text-gray-400 mr-3 mt-0.5" />
<p className="text-gray-600">{employer.address}</p>
</div>
</div>
</div>
)}
</div>
);
};
export default EmployerDetails;
|