import { Card, CardContent, CardHeader, CardTitle } from "@workspace/ui/components/card" import { Button } from "@workspace/ui/components/button" import { Badge } from "@workspace/ui/components/badge" import { Separator } from "@workspace/ui/components/separator" import { FileText, Clock, CheckCircle, XCircle, AlertCircle, Building2, Calendar, MapPin, DollarSign, Eye, Download, Share2 } from "lucide-react" import { getStudentApplications } from "../actions" const getStatusConfig = (status: string) => { switch (status) { case 'pending': return { icon: Clock, color: 'bg-yellow-100 text-yellow-700', text: 'Pending Review' } case 'reviewed': return { icon: Eye, color: 'bg-blue-100 text-blue-700', text: 'Under Review' } case 'accepted': return { icon: CheckCircle, color: 'bg-green-100 text-green-700', text: 'Accepted' } case 'rejected': return { icon: XCircle, color: 'bg-red-100 text-red-700', text: 'Rejected' } default: return { icon: AlertCircle, color: 'bg-gray-100 text-gray-700', text: 'Unknown' } } } export default async function ApplicationsPage() { // Get real applications data - using student ID 1 for demo const { success, applications, error } = await getStudentApplications(1); // Fallback to mock data if database query fails const mockApplications = [ { id: 1, job: { title: "Software Engineer Intern", company: { name: "TechCorp Solutions" }, location: "San Francisco, CA", salary: "$25/hour", applicationDeadline: new Date("2024-02-15") }, resume: { title: "Resume_v2.pdf" }, status: "pending", createdAt: new Date("2024-01-15") }, { id: 2, job: { title: "Data Analyst", company: { name: "DataFlow Inc" }, location: "New York, NY", salary: "$30/hour", applicationDeadline: new Date("2024-02-10") }, resume: { title: "Resume_v2.pdf" }, status: "reviewed", createdAt: new Date("2024-01-10") }, { id: 3, job: { title: "Frontend Developer", company: { name: "WebSolutions" }, location: "Remote", salary: "$28/hour", applicationDeadline: new Date("2024-02-05") }, resume: { title: "Resume_v2.pdf" }, status: "accepted", createdAt: new Date("2024-01-05") }, { id: 4, job: { title: "Product Manager Intern", company: { name: "InnovateTech" }, location: "Seattle, WA", salary: "$32/hour", applicationDeadline: new Date("2024-02-01") }, resume: { title: "Resume_v2.pdf" }, status: "rejected", createdAt: new Date("2024-01-01") } ]; const allApplications = success && applications ? applications : mockApplications; // Calculate stats const totalApplications = allApplications.length; const pendingApplications = allApplications.filter(app => app.status === 'pending').length; const acceptedApplications = allApplications.filter(app => app.status === 'accepted').length; const rejectedApplications = allApplications.filter(app => app.status === 'rejected').length; return (
Track your job applications and their status
{!success && error && (Total Applications
{totalApplications}
Pending Review
{pendingApplications}
Accepted
{acceptedApplications}
Rejected
{rejectedApplications}
{application.job.company.name}
Start applying to jobs to see your applications here