import React, { useState } from 'react'; import { Button } from './ui/button'; import { Input } from './ui/input'; import { Label } from './ui/label'; import { Textarea } from './ui/textarea'; import { Dialog, DialogContent, DialogTitle } from './ui/dialog'; import type { User as UserType } from '../App'; import { toast } from 'sonner'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from './ui/select'; interface ProfileEditorProps { user: UserType; onSave: (user: UserType) => void; onClose: () => void; } export function ProfileEditor({ user, onSave, onClose }: ProfileEditorProps) { const [name, setName] = useState(user.name); const [email, setEmail] = useState(user.email); const [studentId, setStudentId] = useState('S12345678'); const [department, setDepartment] = useState('Computer Science'); const [year, setYear] = useState('3rd Year'); const [major, setMajor] = useState('Artificial Intelligence'); const [bio, setBio] = useState('Passionate about AI and machine learning'); const handleSave = () => { if (name.trim() && email.trim()) { onSave({ name: name.trim(), email: email.trim() }); toast.success('Profile updated successfully!'); onClose(); } else { toast.error('Please fill in all required fields'); } }; return ( { if (!open) onClose(); }}>
{/* Header */}
Edit Profile
{/* Content */}
{/* Profile Picture */}
{name.charAt(0).toUpperCase()}

JPG, PNG or GIF. Max size 2MB

{/* Basic Information */}

Basic Information

setName(e.target.value)} placeholder="Enter your full name" />
setEmail(e.target.value)} placeholder="Enter your email" />
setStudentId(e.target.value)} placeholder="Enter your student ID" />
setDepartment(e.target.value)} placeholder="Enter your department" />
{/* Academic Background */}

Academic Background

setMajor(e.target.value)} placeholder="Enter your major" />
{/* Bio */}