import { useTranslation } from 'react-i18next' import { useTheme, type ThemePreference } from '@/stores/ThemeProvider' import { cn } from '@/lib/utils' /** * Theme switch per redesign prototype — 2-button segmented control с text * labels "Earth | Dark". Filled accent-bg на active. * *

Прошлый tri-state (Light/Dark/System icons) был noise — "system" preference * редко используется явно, мало кто понимает Monitor icon. Простой 2-button * `Earth / Dark` toggle — точно повторяет prototype и улучшает discoverability. * *

Internally "Earth" maps на `light` preference (Earthy palette default). * "System" preference больше не выставляется через UI; localStorage value * остаётся валидным (ThemeProvider может read), но новые users получают * explicit light/dark choice. */ export function ThemeSwitch() { const { t } = useTranslation() const { preference, setPreference } = useTheme() // Treat 'system' как 'light' для UI — переключение всё равно flatten'ит // preference на explicit choice. const activeId: Exclude = preference === 'dark' ? 'dark' : 'light' const items: { id: Exclude; label: string }[] = [ { id: 'light', label: t('theme.earth', { defaultValue: 'Earth' }) }, { id: 'dark', label: t('theme.dark', { defaultValue: 'Dark' }) }, ] return (

{items.map((item) => { const active = activeId === item.id return ( ) })}
) }