From ecdbbbbca647935c384b6dac8962948f926b78c1 Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Tue, 3 Nov 2026 12:27:17 -0300 Subject: [PATCH] =?UTF-8?q?feat(i18n):=20traducir=20Requiere=20atenci?= =?UTF-8?q?=C3=B3n=20y=20redactar=20las=20alertas=20en=20cada=20idioma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Las alertas de shared suman razon + valores para que la web las redacte; etiqueta/detalle se mantienen en español para el backend. Co-Authored-By: Claude Opus 5.5 --- apps/backend/test/student-alerts.test.ts | 2 + .../src/features/attention/AttentionCard.tsx | 19 +++-- .../features/attention/AttentionHeader.tsx | 8 +- .../features/attention/AttentionProvider.tsx | 3 +- .../features/attention/AttentionSection.tsx | 10 ++- .../src/features/attention/AttentionView.tsx | 10 ++- .../src/features/attention/EmptyAttention.tsx | 6 +- .../src/features/attention/FilterChips.tsx | 14 +-- apps/web/src/features/attention/attention.ts | 85 +++++++++++++++---- .../src/features/groups/AttentionPreview.tsx | 4 +- apps/web/src/i18n/i18next.d.ts | 2 + apps/web/src/i18n/locales/en/attention.json | 57 +++++++++++++ .../src/i18n/locales/es-419/attention.json | 57 +++++++++++++ .../web/src/i18n/locales/es-AR/attention.json | 57 +++++++++++++ .../web/src/i18n/locales/pt-BR/attention.json | 57 +++++++++++++ packages/shared/src/lib/student-alerts.ts | 10 +++ packages/shared/src/schemas/attention.ts | 26 ++++++ 17 files changed, 382 insertions(+), 45 deletions(-) create mode 100644 apps/web/src/i18n/locales/en/attention.json create mode 100644 apps/web/src/i18n/locales/es-419/attention.json create mode 100644 apps/web/src/i18n/locales/es-AR/attention.json create mode 100644 apps/web/src/i18n/locales/pt-BR/attention.json diff --git a/apps/backend/test/student-alerts.test.ts b/apps/backend/test/student-alerts.test.ts index d3a32ea..9fd216e 100644 --- a/apps/backend/test/student-alerts.test.ts +++ b/apps/backend/test/student-alerts.test.ts @@ -95,6 +95,8 @@ describe('computeStudentAlerts: pagos', () => { gravedad: 'vigilar', etiqueta: 'Cuota vencida', detalle: 'La cuota de octubre venció el 10/10.', + razon: 'cuota', + valores: { cuotas: 1, vencimientos: ['2026-10-10T12:00:00.000Z'] }, firma: 'pay_1', peso: 1, }, diff --git a/apps/web/src/features/attention/AttentionCard.tsx b/apps/web/src/features/attention/AttentionCard.tsx index 6e325e0..73abff8 100644 --- a/apps/web/src/features/attention/AttentionCard.tsx +++ b/apps/web/src/features/attention/AttentionCard.tsx @@ -1,8 +1,9 @@ import { Link } from '@tanstack/react-router' import { Check } from 'lucide-react' +import { useTranslation } from 'react-i18next' import { cn } from '../../lib/utils' import { AlertTag } from './AlertTag' -import { reminderMessage, whatsappLink, type AttentionItem } from './attention' +import { alertDetail, alertLabel, reminderMessage, whatsappLink, type AttentionItem } from './attention' import { SeverityAvatar } from './SeverityAvatar' const ACTION_CLASS = @@ -15,10 +16,12 @@ type AttentionCardProps = { export function AttentionCard({ item, onResolve }: AttentionCardProps) { const { student, alert } = item + const { t } = useTranslation('attention') + const label = alertLabel(alert) const urgent = alert.gravedad === 'urgente' const isPayment = alert.tipo === 'pago' - const actionLabel = isPayment ? 'Enviar recordatorio' : 'Contactar' + const actionLabel = isPayment ? t('card.remind') : t('card.contact') const href = whatsappLink(student, isPayment ? reminderMessage(student) : undefined) // Urgent: light fill, the strongest action on screen. To watch: subtle gray. const primaryTone = urgent @@ -39,10 +42,10 @@ export function AttentionCard({ item, onResolve }: AttentionCardProps) {

{student.groupName}

- {alert.etiqueta} + {label} -

{alert.detalle}

+

{alertDetail(alert)}

{href ? ( @@ -50,7 +53,7 @@ export function AttentionCard({ item, onResolve }: AttentionCardProps) { href={href} target="_blank" rel="noopener noreferrer" - aria-label={`${actionLabel} a ${student.fullName} por WhatsApp`} + aria-label={t('card.actionWhatsapp', { action: actionLabel, name: student.fullName })} className={cn(ACTION_CLASS, primaryTone)} > {actionLabel} @@ -59,7 +62,7 @@ export function AttentionCard({ item, onResolve }: AttentionCardProps) {
diff --git a/apps/web/src/features/attention/AttentionHeader.tsx b/apps/web/src/features/attention/AttentionHeader.tsx index 69e1ea2..b127db5 100644 --- a/apps/web/src/features/attention/AttentionHeader.tsx +++ b/apps/web/src/features/attention/AttentionHeader.tsx @@ -1,5 +1,6 @@ import { Link } from '@tanstack/react-router' import { ArrowLeft, ListFilter } from 'lucide-react' +import { useTranslation } from 'react-i18next' import { createPortal } from 'react-dom' import { useImmersiveBarHost } from '../../context/ImmersiveBarProvider' @@ -10,18 +11,19 @@ import { useImmersiveBarHost } from '../../context/ImmersiveBarProvider' sticky box, like `LargeTitle`. */ export function AttentionHeader({ subtitle }: { subtitle: string }) { const host = useImmersiveBarHost() + const { t } = useTranslation('attention') const bar = (