"use client"; import { useEffect } from 'react'; import CreateTicketForm from './CreateTicketForm'; import KnowledgeBase from './KnowledgeBase'; import TicketStatusCheck from './TicketStatusCheck'; type ModalType = 'create' | 'knowledge' | 'status' | null; interface SupportCenterContentProps { activeModal: ModalType; onClose: () => void; onOpenModal?: (type: ModalType) => void; } const SupportCenterContent = ({ activeModal, onClose, onOpenModal }: SupportCenterContentProps) => { // Close modal on escape key useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape' && activeModal) { onClose(); } }; document.addEventListener('keydown', handleEscape); return () => document.removeEventListener('keydown', handleEscape); }, [activeModal, onClose]); // Prevent body scroll when modal is open useEffect(() => { if (activeModal) { document.body.style.overflow = 'hidden'; } else { document.body.style.overflow = ''; } return () => { document.body.style.overflow = ''; }; }, [activeModal]); if (!activeModal) return null; return ( <> {/* Modal Overlay */}
{/* Modal Content */}
e.stopPropagation()} style={{ backgroundColor: '#fff', borderRadius: '12px', maxWidth: '1000px', width: '100%', maxHeight: '90vh', overflow: 'auto', position: 'relative', boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)', animation: 'modalSlideIn 0.3s ease-out', }} > {/* Close Button */} {/* Modal Body */}
{activeModal === 'create' && ( { if (onOpenModal) { onOpenModal('status'); } }} /> )} {activeModal === 'knowledge' && } {activeModal === 'status' && }
{/* Modal Animation Keyframes */} ); }; export default SupportCenterContent;