feat(i18n): traducir Requiere atención y redactar las alertas en cada idioma
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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) {
|
||||
</Link>
|
||||
<p className="truncate text-sm text-secondary">{student.groupName}</p>
|
||||
</div>
|
||||
<AlertTag severity={alert.gravedad}>{alert.etiqueta}</AlertTag>
|
||||
<AlertTag severity={alert.gravedad}>{label}</AlertTag>
|
||||
</div>
|
||||
|
||||
<p className="mt-3 text-sm text-primary">{alert.detalle}</p>
|
||||
<p className="mt-3 text-sm text-primary">{alertDetail(alert)}</p>
|
||||
|
||||
<div className="mt-3 grid grid-cols-2 gap-2">
|
||||
{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) {
|
||||
<button
|
||||
type="button"
|
||||
disabled
|
||||
aria-label={`${actionLabel}: ${student.fullName} no tiene teléfono cargado`}
|
||||
aria-label={t('card.noPhone', { action: actionLabel, name: student.fullName })}
|
||||
className={cn(ACTION_CLASS, primaryTone, 'cursor-not-allowed opacity-45')}
|
||||
>
|
||||
{actionLabel}
|
||||
@@ -68,11 +71,11 @@ export function AttentionCard({ item, onResolve }: AttentionCardProps) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={onResolve}
|
||||
aria-label={`Marcar como resuelto: ${student.fullName}, ${alert.etiqueta}`}
|
||||
aria-label={t('card.resolveLabel', { name: student.fullName, alert: label })}
|
||||
className={cn(ACTION_CLASS, 'border border-border text-primary hover:bg-primary-soft')}
|
||||
>
|
||||
<Check className="size-4" aria-hidden="true" />
|
||||
Resuelto
|
||||
{t('card.resolve')}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user