i18next + react-i18next con es-AR (fuente), es-419, pt-BR y en; el idioma sale del dispositivo (fallback a inglés) y se puede cambiar en Ajustes. La elección se guarda en localStorage y, para el profe, en users.locale. Las validaciones de shared pasan a claves y los errores de la API se traducen por code (con params para límites de plan y cupo). Migrados: layout, Ajustes, auth, PWA y lib/format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
import { Check } from 'lucide-react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTheme } from '../../context/ThemeProvider'
|
|
import { cn } from '../../lib/utils'
|
|
import { THEME_ICONS, THEME_OPTIONS } from './constants'
|
|
|
|
export function AppearanceCard() {
|
|
const { theme, setTheme } = useTheme()
|
|
const { t } = useTranslation('settings')
|
|
|
|
return (
|
|
<div className="divide-y divide-border rounded-xl border border-border bg-surface">
|
|
<div className="px-4 py-3">
|
|
<p className="text-sm font-medium text-primary">{t('appearance.title')}</p>
|
|
<p className="text-xs text-foreground/50">{t('appearance.description')}</p>
|
|
</div>
|
|
{THEME_OPTIONS.map((option) => {
|
|
const Icon = THEME_ICONS[option.value]
|
|
const isSelected = theme === option.value
|
|
return (
|
|
<button
|
|
key={option.value}
|
|
type="button"
|
|
onClick={() => setTheme(option.value)}
|
|
className="flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-primary-soft"
|
|
>
|
|
<span className={cn('rounded-lg p-2', isSelected ? 'bg-accent-soft' : 'bg-primary-soft')}>
|
|
<Icon
|
|
className={cn('size-4', isSelected ? 'text-accent-fg' : 'text-foreground/70')}
|
|
/>
|
|
</span>
|
|
<div className="min-w-0 flex-1">
|
|
<p className={cn('text-sm font-medium', isSelected ? 'text-accent-fg' : 'text-primary')}>
|
|
{t(option.label)}
|
|
</p>
|
|
<p className="text-xs text-foreground/50">{t(option.description)}</p>
|
|
</div>
|
|
{isSelected ? <Check className="size-4 text-accent-fg" /> : null}
|
|
</button>
|
|
)
|
|
})}
|
|
</div>
|
|
)
|
|
} |