import { CheckOutlined, ReloadOutlined, SaveOutlined } from '@ant-design/icons'; import { Button, Divider, Drawer, Input, message, Segmented, Slider, Space, Switch } from 'antd'; import { useEffect, useRef } from 'react'; import { defaultLayoutSettings, useAppStore, type LayoutSettingsValue, type NavLayout } from '@/stores/appStore'; interface LayoutSettingsProps { open: boolean; value: LayoutSettingsValue; onChange: (value: LayoutSettingsValue) => void; onOpenChange: (open: boolean) => void; } function SettingRow({ label, children }: { label: string; children: React.ReactNode }) { return (
{label} {children}
); } export default function LayoutSettings({ open, value, onChange, onOpenChange }: LayoutSettingsProps) { const resetLayoutSettings = useAppStore(state => state.resetLayoutSettings); const preferredSideThemeRef = useRef(value.sideTheme); useEffect(() => { if (!value.darkMode) { preferredSideThemeRef.current = value.sideTheme; } }, [value.darkMode, value.sideTheme]); const patchValue = (patch: Partial) => { if (patch.sideTheme) { preferredSideThemeRef.current = patch.sideTheme; } const next = { ...value, ...patch }; if (patch.darkMode === false) { next.sideTheme = preferredSideThemeRef.current; } if (patch.tagsView === false) { next.tagsViewPersist = false; } onChange(next); }; const resetSettings = () => { resetLayoutSettings(); onChange(defaultLayoutSettings); message.success('配置已重置'); }; const selectedSideTheme = value.darkMode ? preferredSideThemeRef.current : value.sideTheme; return ( onOpenChange(false)} className="layout-settings-drawer" >

菜单导航设置

patchValue({ navType: navType as NavLayout })} options={[ { label: '混合菜单', value: 'mix' }, { label: '顶部菜单', value: 'top' } ]} />

主题风格设置

patchValue({ theme: event.target.value })} className="layout-color-input" /> patchValue({ darkMode })} /> patchValue({ radiusBase })} className="layout-radius-slider" />

系统布局配置

patchValue({ tagsView })} /> patchValue({ tagsViewPersist })} /> patchValue({ tagsIcon })} /> patchValue({ fixedHeader })} /> patchValue({ sidebarLogo })} /> patchValue({ dynamicTitle })} /> patchValue({ fullHeightTable })} />
); }