import { Label } from '@/components/ui/label' import { PRIMARY_COLORS, TPrimaryColor } from '@/constants' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { cn } from '@/lib/utils' import { useScreenSize } from '@/providers/ScreenSizeProvider' import { useTheme } from '@/providers/ThemeProvider' import { useUserPreferences } from '@/providers/UserPreferencesProvider' import { Columns2, LayoutList, List, Monitor, Moon, PanelLeft, Sun } from 'lucide-react' import { forwardRef } from 'react' import { useTranslation } from 'react-i18next' const THEMES = [ { key: 'system', label: 'System', icon: }, { key: 'light', label: 'Light', icon: }, { key: 'dark', label: 'Dark', icon: }, ] as const const LAYOUTS = [ { key: false, label: 'Two-column', icon: }, { key: true, label: 'Single-column', icon: } ] as const const NOTIFICATION_STYLES = [ { key: 'detailed', label: 'Detailed', icon: }, { key: 'compact', label: 'Compact', icon: } ] as const const AppearanceSettingsPage = forwardRef(({ index }: { index?: number }, ref) => { const { t } = useTranslation() const { isSmallScreen } = useScreenSize() const { themeSetting, setThemeSetting, primaryColor, setPrimaryColor } = useTheme() const { enableSingleColumnLayout, updateEnableSingleColumnLayout, notificationListStyle, updateNotificationListStyle } = useUserPreferences() return (
{THEMES.map(({ key, label, icon }) => ( setThemeSetting(key)} /> ))}
{!isSmallScreen && (
{LAYOUTS.map(({ key, label, icon }) => ( updateEnableSingleColumnLayout(key)} /> ))}
)}
{NOTIFICATION_STYLES.map(({ key, label, icon }) => ( updateNotificationListStyle(key)} /> ))}
{Object.entries(PRIMARY_COLORS).map(([key, config]) => ( } label={t(config.name)} onClick={() => setPrimaryColor(key as TPrimaryColor)} /> ))}
) }) AppearanceSettingsPage.displayName = 'AppearanceSettingsPage' export default AppearanceSettingsPage const OptionButton = ({ isSelected, onClick, icon, label }: { isSelected: boolean onClick: () => void icon: React.ReactNode label: string }) => { return ( ) }