/** * Theme Select Modal * A modal dialog for selecting terminal themes in settings */ import React, { useCallback } from 'react'; import { createPortal } from 'react-dom'; import { Palette, X } from 'lucide-react'; import { useI18n } from '../../application/i18n/I18nProvider'; import { Button } from '../ui/button'; import { ThemeList } from '../ThemeList'; interface ThemeSelectModalProps { open: boolean; onClose: () => void; selectedThemeId: string; onSelect: (themeId: string) => void; filterType?: 'dark' | 'light'; showAutoOption?: boolean; } export const ThemeSelectModal: React.FC = ({ open, onClose, selectedThemeId, onSelect, filterType, showAutoOption, }) => { const { t } = useI18n(); // Handle theme selection - select and close const handleThemeSelect = useCallback((themeId: string) => { onSelect(themeId); onClose(); }, [onSelect, onClose]); // Handle ESC key React.useEffect(() => { if (!open) return; const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; document.addEventListener('keydown', handleKeyDown); return () => document.removeEventListener('keydown', handleKeyDown); }, [open, onClose]); // Handle backdrop click const handleBackdropClick = useCallback((e: React.MouseEvent) => { if (e.target === e.currentTarget) onClose(); }, [onClose]); if (!open) return null; const modalTitleId = 'theme-select-modal-title'; const modalContent = (
e.stopPropagation()} > {/* Header */}

{t('settings.terminal.themeModal.title')}

{/* Theme List */}
{/* Footer */}
); // Use Portal to render at document root return createPortal(modalContent, document.body); }; export default ThemeSelectModal;