'use client'; import React from 'react'; import { Student } from './columns'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogClose, } from '@workspace/ui/components/dialog'; import { Badge } from '@workspace/ui/components/badge'; import { Avatar, AvatarFallback, AvatarImage } from '@workspace/ui/components/avatar'; import { Separator } from '@workspace/ui/components/separator'; import { Button } from '@workspace/ui/components/button'; import { Mail, Phone, MapPin, Calendar, GraduationCap, User, Linkedin, Github, Award, BookOpen, ExternalLink, X, Edit, Download, Share2 } from 'lucide-react'; import { Switch } from '@workspace/ui/components/switch'; interface StudentDetailsModalProps { student: Student; isOpen: boolean; onClose: () => void; markoutAction: (state: boolean) => void; } export function StudentDetailsModal({ student, isOpen, onClose, markoutAction }: StudentDetailsModalProps) { const fullName = [ student.firstName, student.middleName, student.lastName ].filter(Boolean).join(' ') || 'Name not provided'; const formatDate = (date: Date | null) => { if (!date) return 'Not provided'; return new Date(date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); }; const formatPercentage = (value: number | null) => { if (value === null) return 'Not provided'; return `${value}%`; }; const [markedOut, setMarkedOut] = React.useState(student.markedOut ?? false); React.useEffect(() => { setMarkedOut(student.markedOut ?? false); }, [student.markedOut]); const handleMarkoutChange = (checked: boolean) => { setMarkedOut(checked); markoutAction(checked); }; return (
Student Details
Marked Out
{/* Header Section */}
{student.firstName ? student.firstName.charAt(0).toUpperCase() : student.email ? student.email.charAt(0).toUpperCase() : 'S'}

{fullName}

{student.verified ? 'Verified' : 'Pending Verification'}
ID: #{student.id} {student.rollNumber && ( Roll: {student.rollNumber} )} Joined: {formatDate(new Date(Number(student.createdAt)))}
{/* Personal Information */}

Personal Information

Email

{student.email}

{student.personalGmail && (

Personal Gmail

{student.personalGmail}

)} {student.phoneNumber && (

Phone Number

{student.phoneNumber}

)} {student.address && (

Address

{student.address}

)} {student.dob && (

Date of Birth

{formatDate(student.dob)}

)} {student.gender && (

Gender

{student.gender}

)} {student.mothersName && (

Mother's Name

{student.mothersName}

)}
{/* Academic Information */}

Academic Information

{student.degree && (

Degree

{student.degree}

)} {student.branch && (

Branch

{student.branch}

)} {student.year && (

Year

{student.year}

)}

Diploma Student

{student.isDiploma ? 'Yes' : 'No'}

{/* Academic Scores */}

Academic Scores

SSC Score

{formatPercentage(Number(student.ssc))}

HSC Score

{formatPercentage(Number(student.hsc))}

{/* Skills Section */} {student.skills && student.skills.length > 0 && (

Skills & Expertise

{student.skills.map((skill, index) => ( {skill} ))}
)} {/* Professional Links */} {(student.linkedin || student.github) && (

Professional Links

{student.linkedin && ( )} {student.github && ( )}
)} {/* Footer Actions */}
); }