'use client';
import React from 'react';
import Link from 'next/link';
import { motion } from 'framer-motion';
import {
Building2,
Briefcase,
MapPin,
DollarSign,
ExternalLink,
TrendingUp,
Users,
Star,
Clock,
CheckCircle,
ArrowRight,
Search,
Filter,
Bookmark,
Share2,
Eye,
AlertCircle,
} from 'lucide-react';
import { Card, CardContent } from '@workspace/ui/components/card';
import { Button } from '@workspace/ui/components/button';
import { Badge } from '@workspace/ui/components/badge';
interface DashboardClientProps {
companies: any[]; // TODO: replace with proper types from @workspace/db
totalStudents: number;
success: boolean;
error?: string;
}
export default function DashboardClient({
companies: data,
totalStudents,
success,
error,
}: DashboardClientProps) {
// Calculate stats
const totalActiveJobs = data.reduce(
(acc, company) => acc + company.jobs.filter((job: any) => job.active).length,
0,
);
const featuredCompanies = data.slice(0, 3);
const recentJobs = data
.flatMap((company) => company.jobs.slice(0, 2).map((job: any) => ({ ...job, company })))
.slice(0, 6);
return (
{/* Hero Section */}
Discover Your Dream Career
Explore opportunities from top companies and find the perfect role that matches your skills and
aspirations
{/* Stats Section */}
{!success && error && (
Using demo data: {error}
)}
{[
{ icon: Building2, color: 'blue', value: data.length, label: 'Active Companies' },
{ icon: Briefcase, color: 'green', value: totalActiveJobs, label: 'Open Positions' },
{ icon: Users, color: 'purple', value: totalStudents, label: 'Students' },
{ icon: TrendingUp, color: 'orange', value: '95%', label: 'Success Rate' },
].map((stat, index) => {
const IconComponent = stat.icon;
return (
{stat.value}
{stat.label}
);
})}
{/* Featured Companies Section */}
Featured Companies
Top companies actively hiring talented students like you
{featuredCompanies.length > 0 ? (
{featuredCompanies.map((company, index) => (
{company.name}
{company.email}
{company.jobs.length} jobs
{company.description && company.description !== 'N/A' && (
{company.description}
)}
{company.jobs.slice(0, 2).map((job: any) => (
{job.title}
{job.location && job.location !== 'N/A' && (
{job.location}
)}
{job.salary && job.salary !== 'N/A' && (
{job.salary}
)}
))}
))}
) : (
No featured companies yet
Check back later for exciting opportunities
)}
{/* Recent Job Opportunities */}
Recent Opportunities
Latest job postings from top companies
{recentJobs.length > 0 ? (
{recentJobs.map((job: any) => (
{job.title}
{job.company.name}
Active
{job.location && job.location !== 'N/A' && (
{job.location}
)}
{job.salary && job.salary !== 'N/A' && (
{job.salary}
)}
Deadline: {new Date(job.applicationDeadline).toLocaleDateString()}
Min CGPA: {job.minCGPA}
{job.description && job.description !== 'N/A' && (
{job.description}
)}
{job.link && (
)}
))}
) : (
No recent opportunities
Check back later for new job postings
)}
{/* Call to Action */}
Ready to Start Your Career Journey?
Join thousands of students who have found their dream jobs through NextPlacement
);
}