Files
gruperly/apps/web/src/components/layout/NavBadge.tsx
Jose Selesan cb872eb8bc feat: soporte multi idioma en la web (infraestructura)
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>
2026-11-03 12:14:59 -03:00

23 lines
933 B
TypeScript

import { useReportedPaymentsCount } from '../../features/payments/reportedPayments'
import { useTranslation } from 'react-i18next'
import { cn } from '../../lib/utils'
/* Counter of a nav item: today only "Pagos para verificar" on Cobros. The
number is in the accessible name too (sr-only), not only in the dot. */
export function NavBadge({ kind, className }: { kind: 'reported-payments'; className?: string }) {
const count = useReportedPaymentsCount()
const { t } = useTranslation('layout')
if (kind !== 'reported-payments' || count === 0) return null
return (
<span
className={cn(
'flex min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-[11px] font-semibold leading-5 text-on-accent',
className,
)}
>
<span aria-hidden="true">{count > 99 ? '99+' : count}</span>
<span className="sr-only">{t('reportedPayments', { count })}</span>
</span>
)
}