import React, { useEffect, useState } from 'react'; import { BookConfig } from '@/types/book'; import { useSettingsStore } from '@/store/settingsStore'; import { useTranslation } from '@/hooks/useTranslation'; import { RiFontSize } from 'react-icons/ri'; import { RiDashboardLine } from 'react-icons/ri'; import { VscSymbolColor } from 'react-icons/vsc'; import { PiDotsThreeVerticalBold } from 'react-icons/pi'; import { IoAccessibilityOutline } from 'react-icons/io5'; import FontPanel from './FontPanel'; import LayoutPanel from './LayoutPanel'; import ColorPanel from './ColorPanel'; import WindowButtons from '@/components/WindowButtons'; import Dropdown from '@/components/Dropdown'; import DialogMenu from './DialogMenu'; import MiscPanel from './MiscPanel'; type SettingsPanelType = 'Font' | 'Layout' | 'Color' | 'Misc'; const SettingsDialog: React.FC<{ bookKey: string; config: BookConfig }> = ({ bookKey }) => { const _ = useTranslation(); const [activePanel, setActivePanel] = useState('Font'); const { setFontLayoutSettingsDialogOpen } = useSettingsStore(); const handleKeyDown = (event: KeyboardEvent) => { if (event.key === 'Escape') { setFontLayoutSettingsDialogOpen(false); } }; useEffect(() => { window.addEventListener('keydown', handleKeyDown); return () => { window.removeEventListener('keydown', handleKeyDown); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return (
} > setFontLayoutSettingsDialogOpen(false)} />
{activePanel === 'Font' && } {activePanel === 'Layout' && } {activePanel === 'Color' && } {activePanel === 'Misc' && }
); }; export default SettingsDialog;