"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 */}