import { ColumnDef } from '@tanstack/react-table'; import { students, internships, resumes, grades } from '@workspace/db/schema'; import { Badge } from '@workspace/ui/components/badge'; // import { Button } from '@workspace/ui/components/button'; import { Avatar, AvatarFallback, AvatarImage } from '@workspace/ui/components/avatar'; import { Eye, Mail, Phone, MapPin, Calendar, GraduationCap } from 'lucide-react'; type SelectStudent = typeof students.$inferSelect type SelectInternships = typeof internships.$inferSelect type SelectResume = typeof resumes.$inferSelect type SelectGrades = typeof grades.$inferSelect export type Student = SelectStudent & { internships: SelectInternships[]; resumes: SelectResume[]; grades: SelectGrades[]; }; // export interface Student { // id: number; // email: string; // rollNumber: string | null; // verified: boolean; // firstName: string | null; // middleName: string | null; // lastName: string | null; // mothersName?: string | null; // gender?: string | null; // dob?: Date | null; // personalGmail?: string | null; // phoneNumber?: string | null; // address?: string | null; // profilePicture?: string | null; // degree?: string | null; // branch?: string | null; // year?: string | null; // skills?: string[] | null; // ssc?: number | null; // hsc?: number | null; // isDiploma?: boolean | null; // linkedin?: string | null; // github?: string | null; // createdAt?: Date; // } export const columns: ColumnDef[] = [ { accessorKey: 'id', header: 'ID', cell: ({ row }) => { const student = row.original; return (
{student.firstName ? student.firstName.charAt(0).toUpperCase() : student.email ? student.email.charAt(0).toUpperCase() : 'S'}
#{student.id} {student.verified ? 'Verified' : 'Pending'}
); }, }, { accessorKey: 'name', header: 'Student Name', cell: ({ row }) => { const student = row.original; const fullName = [ student.firstName, student.middleName, student.lastName ].filter(Boolean).join(' ') || 'Not provided'; return (
{fullName} {student.rollNumber || 'No Roll Number'}
); }, filterFn: 'includesString', }, { accessorKey: 'email', header: 'Contact Information', cell: ({ row }) => { const student = row.original; return (
{student.email}
{student.phoneNumber && (
{student.phoneNumber}
)} {student.personalGmail && (
{student.personalGmail}
)}
); }, filterFn: 'includesString', }, { accessorKey: 'academic', header: 'Academic Details', cell: ({ row }) => { const student = row.original; return (
{student.degree || 'Not specified'}
{student.branch || 'Branch not specified'}
{student.year || 'Year not specified'}
); }, }, { accessorKey: 'location', header: 'Location', cell: ({ row }) => { const student = row.original; return (
{student.address || 'Address not provided'}
); }, }, { accessorKey: 'skills', header: 'Skills', cell: ({ row }) => { const student = row.original; const skills = student.skills || []; if (skills.length === 0) { return No skills listed; } return (
{skills.slice(0, 3).map((skill, index) => ( {skill} ))} {skills.length > 3 && ( +{skills.length - 3} more )}
); }, }, { id: 'actions', header: 'Actions', cell: ({ row }) => { const student = row.original; return (
View Details
); }, }, ];