diff --git a/src/app/profile/components/CustomerSupportPanel.tsx b/src/app/profile/components/CustomerSupportPanel.tsx new file mode 100644 index 00000000..a812d3cd --- /dev/null +++ b/src/app/profile/components/CustomerSupportPanel.tsx @@ -0,0 +1,214 @@ +'use client'; + +import { memo, useCallback, useState } from 'react'; +import { ChevronDown, ChevronUp, Mail, MessageCircle, Phone } from 'lucide-react'; +import { supportFaqs, supportContactOptions } from '../profile-data'; + +// ── FAQ Accordion Item ──────────────────────────────────────────────────────── + +interface FaqItemProps { + id: string; + question: string; + answer: string; +} + +function FaqItem({ id, question, answer }: FaqItemProps) { + const [isOpen, setIsOpen] = useState(false); + const headingId = `faq-heading-${id}`; + const panelId = `faq-panel-${id}`; + + const toggle = useCallback(() => setIsOpen((prev) => !prev), []); + + return ( +
+

+ +

+ + +
+ ); +} + +// ── Contact Form ────────────────────────────────────────────────────────────── + +type SubmitState = 'idle' | 'submitting' | 'success' | 'error'; + +function ContactForm() { + const [submitState, setSubmitState] = useState('idle'); + const [subject, setSubject] = useState(''); + const [message, setMessage] = useState(''); + + const handleSubmit = useCallback( + async (e: React.FormEvent) => { + e.preventDefault(); + setSubmitState('submitting'); + + // Simulated async submission — replace with real API call + await new Promise((resolve) => setTimeout(resolve, 1200)); + + setSubmitState('success'); + setSubject(''); + setMessage(''); + }, + [], + ); + + if (submitState === 'success') { + return ( +
+

+ ✅ Your message has been sent. We'll get back to you within 24 hours. +

+ +
+ ); + } + + return ( +
+
+ + setSubject(e.target.value)} + placeholder="Briefly describe your issue" + className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-blue-500" + /> +
+ +
+ +