import { Label } from '@/components/ui/label' import { PRIMARY_COLORS, TPrimaryColor } from '@/constants' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { cn } from '@/lib/utils' import { useTheme } from '@/providers/ThemeProvider' import { useUserPreferences } from '@/providers/UserPreferencesProvider' import { Monitor, Moon, Sun, Columns2, PanelLeft } 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: }, { key: 'pure-black', label: 'Pure Black', icon: } ] as const const LAYOUTS = [ { key: false, label: 'Double column', icon: }, { key: true, label: 'Single column', icon: } ] as const const AppearanceSettingsPage = forwardRef(({ index }: { index?: number }, ref) => { const { t } = useTranslation() const { themeSetting, setThemeSetting, primaryColor, setPrimaryColor } = useTheme() const { enableSingleColumnLayout, updateEnableSingleColumnLayout } = useUserPreferences() return (
{LAYOUTS.map(({ key, label, icon }) => ( updateEnableSingleColumnLayout(key)} /> ))}
{THEMES.map(({ key, label, icon }) => ( setThemeSetting(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 ( ) }