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 { useQuery } from 'react-query';
import axios from 'axios';
import { FileText, Building, Clock, CheckCircle, XCircle, AlertCircle } from 'lucide-react';
const Applications = () => {
const { data, isLoading } = useQuery('applications', async () => {
const response = await axios.get('/api/applications');
return response.data;
});
const getStatusIcon = (status) => {
switch (status) {
case 'applied': return <Clock className="h-4 w-4" />;
case 'reviewed': return <AlertCircle className="h-4 w-4" />;
case 'shortlisted': return <CheckCircle className="h-4 w-4" />;
case 'interviewed': return <CheckCircle className="h-4 w-4" />;
case 'offered': return <CheckCircle className="h-4 w-4" />;
case 'rejected': return <XCircle className="h-4 w-4" />;
default: return <Clock className="h-4 w-4" />;
}
};
const getStatusColor = (status) => {
switch (status) {
case 'applied': return 'bg-blue-100 text-blue-800';
case 'reviewed': return 'bg-yellow-100 text-yellow-800';
case 'shortlisted': return 'bg-green-100 text-green-800';
case 'interviewed': return 'bg-green-100 text-green-800';
case 'offered': return 'bg-green-100 text-green-800';
case 'rejected': return 'bg-red-100 text-red-800';
case 'withdrawn': return 'bg-gray-100 text-gray-800';
default: return 'bg-gray-100 text-gray-800';
}
};
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>
);
}
return (
<div className="space-y-6">
<div>
<h1 className="text-2xl font-bold text-gray-900">Applications</h1>
<p className="mt-1 text-sm text-gray-500">
Track your job applications and their status
</p>
</div>
<div className="space-y-4">
{data?.applications?.length > 0 ? (
data.applications.map((application) => (
<div key={application.id} className="bg-white shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center">
<h3 className="text-lg font-medium text-gray-900">
{application.job_title}
</h3>
<span className={`ml-3 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusColor(application.status)}`}>
{getStatusIcon(application.status)}
<span className="ml-1 capitalize">{application.status}</span>
</span>
</div>
<div className="mt-1 flex items-center text-sm text-gray-500">
<Building className="h-4 w-4 mr-1" />
{application.company_name}
</div>
<div className="mt-2 flex items-center text-sm text-gray-500">
<Clock className="h-4 w-4 mr-1" />
Applied on {new Date(application.applied_at).toLocaleDateString()}
</div>
{application.cover_letter && (
<div className="mt-3">
<p className="text-sm text-gray-600 line-clamp-2">
{application.cover_letter}
</p>
</div>
)}
{application.notes && (
<div className="mt-3">
<p className="text-sm text-gray-600">
<strong>Notes:</strong> {application.notes}
</p>
</div>
)}
</div>
</div>
</div>
</div>
))
) : (
<div className="text-center py-12">
<FileText className="mx-auto h-12 w-12 text-gray-400" />
<h3 className="mt-2 text-sm font-medium text-gray-900">No applications found</h3>
<p className="mt-1 text-sm text-gray-500">
You haven't applied to any jobs yet.
</p>
</div>
)}
</div>
</div>
);
};
export default Applications;
|