feat(i18n): traducir la ficha del alumno

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-03 12:30:11 -03:00
parent ecdbbbbca6
commit 8a5768e0c0
27 changed files with 856 additions and 164 deletions

View File

@@ -5,6 +5,7 @@ import type { LucideIcon } from 'lucide-react'
import { CalendarCheck, CalendarX, History, Loader2, MoveRight, UserPlus, Wallet } from 'lucide-react'
import { Button, Modal } from '../../components/ui'
import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
type Consequence = { key: string; icon: LucideIcon; text: string }
@@ -39,6 +40,7 @@ export function ChangeGroupDialog({
const [targetGroupId, setTargetGroupId] = useState('')
const wasOpen = useRef(false)
const { t } = useTranslation(['attendeeDetail', 'common'])
// Cada apertura arranca sin destino elegido; al cerrar, el foco vuelve al "⋯".
useEffect(() => {
@@ -62,7 +64,7 @@ export function ChangeGroupDialog({
.map((membership) => membership.groupId),
)
const otherGroups = groups.filter((group) => group.id !== groupId && !blocked.has(group.id))
const currentName = groupName ?? 'el grupo actual'
const currentName = groupName ?? t('changeGroup.currentGroup')
const isSubmitting = isAdd ? isAddingToGroup : isMovingAttendee
const consequences: Consequence[] = isAdd
@@ -70,34 +72,34 @@ export function ChangeGroupDialog({
{
key: 'sigue',
icon: CalendarCheck,
text: `Sigue en ${currentName}: va a estar en los dos grupos.`,
text: t('changeGroup.addStays', { group: currentName }),
},
{
key: 'datos',
icon: History,
text: 'Comparte el contacto, las notas y el acceso a la app de alumnos.',
text: t('changeGroup.addShares'),
},
{
key: 'cuotas',
icon: Wallet,
text: 'La asistencia y las cuotas se llevan por separado en cada grupo.',
text: t('changeGroup.addSeparate'),
},
]
: [
{
key: 'historial',
icon: History,
text: 'Conserva su historial, sus cuotas y su acceso a la app de alumnos.',
text: t('changeGroup.moveKeeps'),
},
{
key: 'cuotas',
icon: Wallet,
text: `Las cuotas pendientes de ${currentName} siguen vigentes.`,
text: t('changeGroup.moveFees', { group: currentName }),
},
{
key: 'faltas',
icon: CalendarX,
text: `Se cancelan las faltas avisadas para clases futuras de ${currentName}.`,
text: t('changeGroup.moveNotices', { group: currentName }),
},
]
@@ -105,25 +107,27 @@ export function ChangeGroupDialog({
<Modal
isOpen={isOpen}
onClose={closeGroupDialog}
title={isAdd ? 'Agregar a otro grupo' : 'Cambiar de grupo'}
title={isAdd ? t('changeGroup.titleAdd') : t('changeGroup.title')}
description={`${attendee.fullName}${groupName ? ` · ${groupName}` : ''}`}
maxWidth="sm"
>
<div className="space-y-4">
{groupsPending ? (
<div className="flex justify-center py-4">
<Loader2 className="size-5 animate-spin text-foreground/60" aria-label="Cargando grupos" />
<Loader2 className="size-5 animate-spin text-foreground/60" aria-label={t('changeGroup.loadingGroups')} />
</div>
) : otherGroups.length === 0 ? (
<p className="rounded-xl border border-border bg-primary-soft/30 px-4 py-3 text-sm text-foreground/70">
{groups.length > 1
? 'Ya es miembro de todos tus otros grupos.'
: `No tenés otros grupos. Creá uno para poder ${isAdd ? 'agregar' : 'mover'} a este miembro.`}
? t('changeGroup.allGroups')
: isAdd
? t('changeGroup.noGroupsAdd')
: t('changeGroup.noGroupsMove')}
</p>
) : (
<label className="block">
<span className="mb-1.5 block text-sm font-medium text-primary">
{isAdd ? 'Agregar a' : 'Mover a'}
{isAdd ? t('changeGroup.addTo') : t('changeGroup.moveTo')}
</span>
<select
autoFocus
@@ -132,14 +136,13 @@ export function ChangeGroupDialog({
className="h-10 w-full rounded-xl border border-border bg-surface px-3 text-base text-primary sm:text-sm focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30"
>
<option value="" disabled>
Elegí un grupo
{t('changeGroup.pick')}
</option>
{otherGroups.map((group) => {
const full = isFull(group)
return (
<option key={group.id} value={group.id} disabled={full}>
{group.name}
{full ? ' (sin cupo)' : ''}
{full ? t('changeGroup.full', { name: group.name }) : group.name}
</option>
)
})}
@@ -158,7 +161,7 @@ export function ChangeGroupDialog({
<div className="flex flex-col-reverse gap-2.5 border-t border-border pt-3 sm:flex-row sm:justify-end">
<Button variant="ghost" onClick={closeGroupDialog}>
Cancelar
{t('common:actions.cancel')}
</Button>
<Button
variant="primary"
@@ -173,7 +176,7 @@ export function ChangeGroupDialog({
) : (
<MoveRight className="size-4" />
)}
<span>{isAdd ? 'Agregar' : 'Cambiar de grupo'}</span>
<span>{isAdd ? t('changeGroup.add') : t('changeGroup.move')}</span>
</Button>
</div>
</div>