import { useState, useRef } from 'react' import { useLang } from '@/context/LangContext' import { MapPin, Phone, Mail, ChevronDown, Paperclip, Send, X } from 'lucide-react' const NAVY = '#032340' const GOLD = '#CD9E53' const tr = { fa: { breadcrumbHome: 'خانه', breadcrumbContact: 'تماس با ما', title: 'تماس با ما', address: 'پارک علم و فناوری دانشگاه تهران', phone: '۰۲۱-۱۲۳۴۵۶۷', email: 'info@steelforesight.com', addressLabel: 'آدرس', phoneLabel: 'تلفن', emailLabel: 'ایمیل', description: 'اندیشکده فولاد آینده، بستری برای تبادل دانش و هم‌افزایی است. ما با نگاهی تحلیلی به دیدگاه‌ها و پرسش‌های شما می‌نگریم و مشتاقانه آماده‌ایم تا در مسیر خلق ارزش‌های راهبردی برای صنعت فولاد کشور، همراه و پاسخگوی شما باشیم.', nameLabel: 'نام و نام خانوادگی', namePlaceholder: 'علیرضا اکبریان', subjectLabel: 'موضوع', subjectPlaceholder: 'موضوع خود را انتخاب کنید', subjects: ['همکاری پژوهشی', 'درخواست مشاوره', 'عضویت', 'گزارش فنی', 'سایر'], emailLabel2: 'ایمیل', emailPlaceholder: 'M.jalali@gamil.com', phoneLabel2: 'شماره تماس', phonePlaceholder: '۰۹۱۲۳۴۵۶۷۸۹', messageLabel: 'متن پیام', messagePlaceholder: 'پیام خود را وارد کنید...', fileHint: 'حداکثر ۵ تصویر حداکثر یک مگابایت، یک ویدیو MP4 حداکثر ۵۰ مگابایت', addFile: 'افزودن فایل', submit: 'ثبت و ارسال', required: 'این فیلد الزامی است', subjectRequired: 'لطفاً توضیحات خود را وارد کنید.', }, en: { breadcrumbHome: 'Home', breadcrumbContact: 'Contact Us', title: 'Contact Us', address: 'Tehran, North Kargar Street', phone: '021-1234567', email: 'info@steelforesight.com', addressLabel: 'Address', phoneLabel: 'Phone', emailLabel: 'Email', description: 'The Steel Futures Institute is a platform for knowledge exchange and synergy. We approach your ideas and questions with an analytical lens, and are eager to accompany you in creating strategic value.', nameLabel: 'Full Name', namePlaceholder: 'Alireza Akbarian', subjectLabel: 'Subject', subjectPlaceholder: 'Select a subject', subjects: ['Research Collaboration', 'Consulting Request', 'Membership', 'Technical Report', 'Other'], emailLabel2: 'Email', emailPlaceholder: 'M.jalali@email.com', phoneLabel2: 'Phone Number', phonePlaceholder: '+98 912 345 6789', messageLabel: 'Message', messagePlaceholder: 'Write your message here...', fileHint: 'Max 5 images up to 1MB each, one MP4 video up to 50MB', addFile: 'Add File', submit: 'Submit', required: 'This field is required', subjectRequired: 'Please enter your details.', }, } type FormState = { name: string subject: string email: string phone: string message: string files: File[] } type Errors = Partial> export default function Contact() { const { lang } = useLang() const t = tr[lang] const isRtl = lang === 'fa' const dir = isRtl ? 'rtl' : 'ltr' const [form, setForm] = useState({ name: '', subject: '', email: '', phone: '', message: '', files: [] }) const [errors, setErrors] = useState({}) const [subjectOpen, setSubjectOpen] = useState(false) const fileRef = useRef(null) const set = (field: keyof FormState, value: string) => { setForm(f => ({ ...f, [field]: value })) if (errors[field]) setErrors(e => ({ ...e, [field]: undefined })) } const validate = () => { const e: Errors = {} if (!form.name.trim()) e.name = t.required if (!form.subject) e.subject = t.subjectRequired if (!form.email.trim()) e.email = t.required if (!form.phone.trim()) e.phone = t.required setErrors(e) return Object.keys(e).length === 0 } const handleSubmit = (ev: React.FormEvent) => { ev.preventDefault() if (validate()) alert(isRtl ? 'پیام شما ارسال شد' : 'Your message has been sent') } const handleFiles = (ev: React.ChangeEvent) => { const picked = Array.from(ev.target.files ?? []) setForm(f => ({ ...f, files: [...f.files, ...picked].slice(0, 6) })) ev.target.value = '' } const removeFile = (i: number) => setForm(f => ({ ...f, files: f.files.filter((_, idx) => idx !== i) })) return (
{/* ── breadcrumb ── */}
| {t.breadcrumbHome} {isRtl ? '›' : '›'} {t.breadcrumbContact}
{/* ── breathing pin keyframes ── */} {/* ── map + contact card ── */}
{/* wrapper: relative so card can overflow downward */}
{/* map */}