development #14

Merged
jselesan merged 102 commits from development into main 2026-11-07 13:21:43 +00:00
891 changed files with 105242 additions and 1335 deletions
Showing only changes of commit 8a5768e0c0 - Show all commits

View File

@@ -5,10 +5,12 @@ import { useAttendeeDetail } from './AttendeeDetailProvider'
import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton' import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
import { Section } from './Section' import { Section } from './Section'
import { useCopyToClipboard } from './useCopyToClipboard' import { useCopyToClipboard } from './useCopyToClipboard'
import { useTranslation } from 'react-i18next'
export function AbsenceLinkSection() { export function AbsenceLinkSection() {
const { attendee } = useAttendeeDetail() const { attendee } = useAttendeeDetail()
const { copied, copy } = useCopyToClipboard() const { copied, copy } = useCopyToClipboard()
const { t } = useTranslation(['attendeeDetail', 'common'])
const [isOpen, setIsOpen] = useState(false) const [isOpen, setIsOpen] = useState(false)
const panelId = useId() const panelId = useId()
@@ -19,14 +21,14 @@ export function AbsenceLinkSection() {
const phoneDigits = attendee.phone?.replace(/\D/g, '') ?? '' const phoneDigits = attendee.phone?.replace(/\D/g, '') ?? ''
const shareUrl = phoneDigits const shareUrl = phoneDigits
? `https://wa.me/${phoneDigits}?text=${encodeURIComponent( ? `https://wa.me/${phoneDigits}?text=${encodeURIComponent(
`Hola ${attendee.fullName.split(' ')[0]}, desde este link podés avisar tus ausencias en ${url}`, t('absenceLink.message', { name: attendee.fullName.split(' ')[0], url }),
)}` )}`
: null : null
return ( return (
<Section <Section
title="Link de ausencias" title={t('absenceLink.title')}
description="Para que avise si no puede venir" description={t('absenceLink.description')}
toggle={{ isOpen, panelId, onToggle: () => setIsOpen((value) => !value) }} toggle={{ isOpen, panelId, onToggle: () => setIsOpen((value) => !value) }}
> >
{/* The panel stays in the DOM but hidden: `aria-controls` always resolves and {/* The panel stays in the DOM but hidden: `aria-controls` always resolves and
@@ -43,18 +45,18 @@ export function AbsenceLinkSection() {
className={cn(ACTION_BUTTON_CLASS, 'w-full')} className={cn(ACTION_BUTTON_CLASS, 'w-full')}
> >
<Copy className="size-4" aria-hidden="true" /> <Copy className="size-4" aria-hidden="true" />
Copiar link {t('absenceLink.copy')}
</button> </button>
{shareUrl ? ( {shareUrl ? (
<a <a
href={shareUrl} href={shareUrl}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
aria-label={`Enviar el link por WhatsApp a ${attendee.fullName}`} aria-label={t('absenceLink.sendLabel', { name: attendee.fullName })}
className={PRIMARY_ACTION_CLASS} className={PRIMARY_ACTION_CLASS}
> >
<MessageCircle className="size-4" aria-hidden="true" /> <MessageCircle className="size-4" aria-hidden="true" />
Enviar por WhatsApp {t('absenceLink.send')}
</a> </a>
) : null} ) : null}
</div> </div>
@@ -65,7 +67,7 @@ export function AbsenceLinkSection() {
{copied ? ( {copied ? (
<> <>
<Check className="size-3.5" aria-hidden="true" /> <Check className="size-3.5" aria-hidden="true" />
Link copiado {t('absenceLink.copied')}
</> </>
) : null} ) : null}
</p> </p>

View File

@@ -3,6 +3,7 @@ import type { KeyboardEvent, RefObject } from 'react'
import { Ellipsis, MoveRight, Pause, Pencil, UserMinus, UserPlus } from 'lucide-react' import { Ellipsis, MoveRight, Pause, Pencil, UserMinus, UserPlus } from 'lucide-react'
import { useToast } from '../../components/ui' import { useToast } from '../../components/ui'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
const ITEM_CLASS = const ITEM_CLASS =
'flex min-h-11 w-full items-center gap-2.5 rounded-lg px-3 text-left text-sm font-medium text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent' 'flex min-h-11 w-full items-center gap-2.5 rounded-lg px-3 text-left text-sm font-medium text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent'
@@ -17,6 +18,7 @@ export function AttendeeActionsMenu({
}) { }) {
const { beginContactEdit, openRemoveDialog, openChangeGroupDialog, openAddToGroupDialog } = useAttendeeDetail() const { beginContactEdit, openRemoveDialog, openChangeGroupDialog, openAddToGroupDialog } = useAttendeeDetail()
const toast = useToast() const toast = useToast()
const { t } = useTranslation(['attendeeDetail', 'common'])
const [isOpen, setIsOpen] = useState(false) const [isOpen, setIsOpen] = useState(false)
const menuRef = useRef<HTMLDivElement>(null) const menuRef = useRef<HTMLDivElement>(null)
const itemRef = useRef<HTMLButtonElement>(null) const itemRef = useRef<HTMLButtonElement>(null)
@@ -72,7 +74,7 @@ export function AttendeeActionsMenu({
const showPendingPause = () => { const showPendingPause = () => {
close() close()
// TODO(miembros): conectar la pausa cuando se defina su efecto sobre cupos y cobros. // TODO(miembros): conectar la pausa cuando se defina su efecto sobre cupos y cobros.
toast.info('Pausar la membresía estará disponible cuando se confirme su lógica de negocio.') toast.info(t('menu.pausePending'))
} }
return ( return (
@@ -84,7 +86,7 @@ export function AttendeeActionsMenu({
aria-haspopup="menu" aria-haspopup="menu"
aria-expanded={isOpen} aria-expanded={isOpen}
aria-controls={isOpen ? menuId : undefined} aria-controls={isOpen ? menuId : undefined}
aria-label="Más acciones" aria-label={t('menu.more')}
className="inline-flex size-11 items-center justify-center rounded-xl text-primary transition-colors hover:bg-primary-soft active:scale-[0.96] motion-reduce:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent" className="inline-flex size-11 items-center justify-center rounded-xl text-primary transition-colors hover:bg-primary-soft active:scale-[0.96] motion-reduce:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
> >
<Ellipsis className="size-5" aria-hidden="true" /> <Ellipsis className="size-5" aria-hidden="true" />
@@ -95,7 +97,7 @@ export function AttendeeActionsMenu({
ref={menuRef} ref={menuRef}
id={menuId} id={menuId}
role="menu" role="menu"
aria-label="Acciones del miembro" aria-label={t('menu.label')}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
className="absolute right-0 top-full z-40 mt-1 w-60 rounded-xl bg-primary-soft p-1.5 shadow-lg" className="absolute right-0 top-full z-40 mt-1 w-60 rounded-xl bg-primary-soft p-1.5 shadow-lg"
> >
@@ -110,7 +112,7 @@ export function AttendeeActionsMenu({
}} }}
> >
<MoveRight className="size-4 shrink-0 text-secondary" aria-hidden="true" /> <MoveRight className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Cambiar de grupo {t('menu.changeGroup')}
</button> </button>
<button <button
type="button" type="button"
@@ -122,7 +124,7 @@ export function AttendeeActionsMenu({
}} }}
> >
<UserPlus className="size-4 shrink-0 text-secondary" aria-hidden="true" /> <UserPlus className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Agregar a otro grupo {t('menu.addToGroup')}
</button> </button>
<button <button
type="button" type="button"
@@ -137,7 +139,7 @@ export function AttendeeActionsMenu({
}} }}
> >
<Pencil className="size-4 shrink-0 text-secondary" aria-hidden="true" /> <Pencil className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Editar contacto {t('menu.editContact')}
</button> </button>
<button <button
type="button" type="button"
@@ -146,7 +148,7 @@ export function AttendeeActionsMenu({
onClick={showPendingPause} onClick={showPendingPause}
> >
<Pause className="size-4 shrink-0 text-secondary" aria-hidden="true" /> <Pause className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Pausar membresía {t('menu.pause')}
</button> </button>
<div className="my-1 border-t border-border/70" aria-hidden="true" /> <div className="my-1 border-t border-border/70" aria-hidden="true" />
<button <button
@@ -159,7 +161,7 @@ export function AttendeeActionsMenu({
}} }}
> >
<UserMinus className="size-4 shrink-0" aria-hidden="true" /> <UserMinus className="size-4 shrink-0" aria-hidden="true" />
Quitar del grupo {t('menu.remove')}
</button> </button>
</div> </div>
) : null} ) : null}

View File

@@ -16,6 +16,7 @@ import {
} from './attendance' } from './attendance'
import { Section } from './Section' import { Section } from './Section'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
const STATUS_ICONS: Record<AttendanceStatus | 'UNMARKED', LucideIcon> = { const STATUS_ICONS: Record<AttendanceStatus | 'UNMARKED', LucideIcon> = {
PRESENT: Check, PRESENT: Check,
@@ -31,10 +32,11 @@ function iconFor(status: AttendanceSession['status']): LucideIcon {
export function AttendeeAttendanceSection() { export function AttendeeAttendanceSection() {
const { history, historyPending, historyFailed } = useAttendeeDetail() const { history, historyPending, historyFailed } = useAttendeeDetail()
const [showAll, setShowAll] = useState(false) const [showAll, setShowAll] = useState(false)
const { t } = useTranslation(['attendeeDetail', 'common'])
if (historyPending) { if (historyPending) {
return ( return (
<Section title="Asistencia" trailing="—"> <Section title={t('attendance.title')} trailing="—">
<div className="flex items-center justify-center py-5"> <div className="flex items-center justify-center py-5">
<Loader2 className="size-5 animate-spin text-accent" /> <Loader2 className="size-5 animate-spin text-accent" />
</div> </div>
@@ -44,9 +46,9 @@ export function AttendeeAttendanceSection() {
if (historyFailed) { if (historyFailed) {
return ( return (
<Section title="Asistencia"> <Section title={t('attendance.title')}>
<p className="py-3 text-sm text-foreground"> <p className="py-3 text-sm text-foreground">
No pudimos cargar la asistencia de este miembro. {t('attendance.loadError')}
</p> </p>
</Section> </Section>
) )
@@ -56,9 +58,9 @@ export function AttendeeAttendanceSection() {
if (sessions.length === 0) { if (sessions.length === 0) {
return ( return (
<Section title="Asistencia"> <Section title={t('attendance.title')}>
<p className="py-3 text-sm text-foreground"> <p className="py-3 text-sm text-foreground">
Todavía no hay clases registradas. {t('attendance.empty')}
</p> </p>
</Section> </Section>
) )
@@ -70,7 +72,7 @@ export function AttendeeAttendanceSection() {
const summary = attendanceSummary(visible) const summary = attendanceSummary(visible)
return ( return (
<Section title="Asistencia" trailing={summary.label}> <Section title={t('attendance.title')} trailing={summary.label}>
<ul className="divide-y divide-border/60"> <ul className="divide-y divide-border/60">
{visible.map((session) => { {visible.map((session) => {
const Icon = iconFor(session.status) const Icon = iconFor(session.status)
@@ -98,7 +100,7 @@ export function AttendeeAttendanceSection() {
{showAll && isCapped ? ( {showAll && isCapped ? (
<p className="px-3 pt-2 text-xs text-foreground"> <p className="px-3 pt-2 text-xs text-foreground">
El historial guarda las últimas {HISTORY_LIMIT} clases. {t('attendance.capped', { count: HISTORY_LIMIT })}
</p> </p>
) : null} ) : null}
@@ -110,7 +112,7 @@ export function AttendeeAttendanceSection() {
aria-expanded={showAll} aria-expanded={showAll}
className="h-11 gap-1 px-3 text-sm text-accent-fg hover:text-primary" className="h-11 gap-1 px-3 text-sm text-accent-fg hover:text-primary"
> >
{showAll ? 'Ver menos' : `Ver todas (${sessions.length})`} {showAll ? t('attendance.showLess') : t('attendance.showAll', { count: sessions.length })}
<ChevronDown className={cn('size-4 transition-transform', showAll && 'rotate-180')} /> <ChevronDown className={cn('size-4 transition-transform', showAll && 'rotate-180')} />
</Button> </Button>
</div> </div>

View File

@@ -3,13 +3,15 @@ import { formatPhoneDisplay } from '../../lib/format'
import { cn } from '../../lib/utils' import { cn } from '../../lib/utils'
import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton' import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
export function AttendeeContactActions() { export function AttendeeContactActions() {
const { attendee } = useAttendeeDetail() const { attendee } = useAttendeeDetail()
const { t } = useTranslation(['attendeeDetail', 'common'])
const phone = attendee?.phone const phone = attendee?.phone
const digits = phone?.replace(/\D/g, '') ?? '' const digits = phone?.replace(/\D/g, '') ?? ''
const label = formatPhoneDisplay(phone) ?? attendee?.fullName ?? 'el miembro' const label = formatPhoneDisplay(phone) ?? attendee?.fullName ?? t('actions.theMember')
return ( return (
<div> <div>
@@ -19,7 +21,7 @@ export function AttendeeContactActions() {
href={`https://wa.me/${digits}`} href={`https://wa.me/${digits}`}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
aria-label={`Abrir WhatsApp con ${label}`} aria-label={t('actions.whatsappLabel', { name: label })}
className={PRIMARY_ACTION_CLASS} className={PRIMARY_ACTION_CLASS}
> >
<MessageCircle className="size-4" aria-hidden="true" /> <MessageCircle className="size-4" aria-hidden="true" />
@@ -39,11 +41,11 @@ export function AttendeeContactActions() {
{phone ? ( {phone ? (
<a <a
href={`tel:${digits}`} href={`tel:${digits}`}
aria-label={`Llamar a ${label}`} aria-label={t('actions.callLabel', { name: label })}
className={cn(ACTION_BUTTON_CLASS, 'w-full')} className={cn(ACTION_BUTTON_CLASS, 'w-full')}
> >
<Phone className="size-4 text-accent-fg" aria-hidden="true" /> <Phone className="size-4 text-accent-fg" aria-hidden="true" />
Llamar {t('actions.call')}
</a> </a>
) : ( ) : (
<button <button
@@ -53,13 +55,13 @@ export function AttendeeContactActions() {
className={cn(ACTION_BUTTON_CLASS, 'w-full cursor-not-allowed opacity-45')} className={cn(ACTION_BUTTON_CLASS, 'w-full cursor-not-allowed opacity-45')}
> >
<Phone className="size-4 text-secondary" aria-hidden="true" /> <Phone className="size-4 text-secondary" aria-hidden="true" />
Llamar {t('actions.call')}
</button> </button>
)} )}
</div> </div>
{!phone ? ( {!phone ? (
<p id="missing-phone-feedback" className="mt-2 text-xs text-secondary"> <p id="missing-phone-feedback" className="mt-2 text-xs text-secondary">
Agregá un teléfono para usar estas acciones {t('actions.missingPhone')}
</p> </p>
) : null} ) : null}
</div> </div>

View File

@@ -1,6 +1,8 @@
import type { ReactNode } from 'react' import type { ReactNode } from 'react'
import { Loader2, Mail, Phone } from 'lucide-react' import { Loader2, Mail, Phone } from 'lucide-react'
import { Button, Input } from '../../components/ui' import { Button, Input } from '../../components/ui'
import { validationMessage } from '../../i18n'
import { useTranslation } from 'react-i18next'
type AttendeeContactFormProps = { type AttendeeContactFormProps = {
phone: string phone: string
@@ -26,26 +28,27 @@ export function AttendeeContactForm({
onCancel, onCancel,
onSave, onSave,
}: AttendeeContactFormProps) { }: AttendeeContactFormProps) {
const { t } = useTranslation(['attendeeDetail', 'common'])
return ( return (
<div className="space-y-3 px-3 pb-1"> <div className="space-y-3 px-3 pb-1">
<ContactInput icon={Phone} label="Teléfono"> <ContactInput icon={Phone} label={t('contact.phone')}>
<Input <Input
type="tel" type="tel"
value={phone} value={phone}
onChange={(event) => onPhoneChange(event.target.value)} onChange={(event) => onPhoneChange(event.target.value)}
autoComplete="tel" autoComplete="tel"
autoFocus autoFocus
aria-label="Teléfono" aria-label={t('contact.phone')}
/> />
</ContactInput> </ContactInput>
<ContactInput icon={Mail} label="Email"> <ContactInput icon={Mail} label={t('contact.email')}>
<Input <Input
type="email" type="email"
value={email} value={email}
invalid={error === 'Ingresá un email válido'} invalid={error === validationMessage('email.invalid')}
onChange={(event) => onEmailChange(event.target.value)} onChange={(event) => onEmailChange(event.target.value)}
autoComplete="email" autoComplete="email"
aria-label="Email" aria-label={t('contact.email')}
aria-describedby={error ? 'contact-error' : undefined} aria-describedby={error ? 'contact-error' : undefined}
/> />
</ContactInput> </ContactInput>
@@ -57,11 +60,11 @@ export function AttendeeContactForm({
) : null} ) : null}
<div className="flex justify-end gap-2 pt-1"> <div className="flex justify-end gap-2 pt-1">
<Button variant="ghost" onClick={onCancel} disabled={isSaving}> <Button variant="ghost" onClick={onCancel} disabled={isSaving}>
Cancelar {t('common:actions.cancel')}
</Button> </Button>
<Button variant="primary" onClick={onSave} disabled={isSaving}> <Button variant="primary" onClick={onSave} disabled={isSaving}>
{isSaving ? <Loader2 className="size-4 animate-spin" /> : null} {isSaving ? <Loader2 className="size-4 animate-spin" /> : null}
Guardar {t('common:actions.save')}
</Button> </Button>
</div> </div>
</div> </div>

View File

@@ -7,6 +7,7 @@ import { AttendeeContactForm } from './AttendeeContactForm'
import { contactEmailError } from './detail' import { contactEmailError } from './detail'
import { Section } from './Section' import { Section } from './Section'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
export function AttendeeContactSection() { export function AttendeeContactSection() {
const { const {
@@ -18,6 +19,7 @@ export function AttendeeContactSection() {
isUpdatingAttendee, isUpdatingAttendee,
} = useAttendeeDetail() } = useAttendeeDetail()
const [phone, setPhone] = useState('') const [phone, setPhone] = useState('')
const { t } = useTranslation(['attendeeDetail', 'common'])
const [email, setEmail] = useState('') const [email, setEmail] = useState('')
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
@@ -47,8 +49,8 @@ export function AttendeeContactSection() {
} catch (err) { } catch (err) {
setError( setError(
err instanceof ApiError && err.problem?.code === 'person_phone_taken' err instanceof ApiError && err.problem?.code === 'person_phone_taken'
? 'Ese teléfono ya es de otra persona que tenés registrada.' ? t('contact.phoneTaken')
: 'No pudimos guardar los cambios. Revisá tu conexión e intentá de nuevo.', : t('contact.saveError'),
) )
} }
} }
@@ -56,7 +58,7 @@ export function AttendeeContactSection() {
return ( return (
<Section <Section
id="attendee-contact" id="attendee-contact"
title="Contacto" title={t('contact.title')}
trailing={ trailing={
!isEditingContact ? ( !isEditingContact ? (
<button <button
@@ -64,7 +66,7 @@ export function AttendeeContactSection() {
onClick={beginContactEdit} onClick={beginContactEdit}
className="min-h-11 rounded-lg px-2 text-sm font-medium text-accent-fg transition-colors hover:bg-primary-soft hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent" className="min-h-11 rounded-lg px-2 text-sm font-medium text-accent-fg transition-colors hover:bg-primary-soft hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
> >
Editar {t('contact.edit')}
</button> </button>
) : null ) : null
} }
@@ -76,7 +78,7 @@ export function AttendeeContactSection() {
error={error} error={error}
sharedNote={ sharedNote={
attendee.otherGroups.length > 0 attendee.otherGroups.length > 0
? 'El cambio se aplica en todos sus grupos.' ? t('contact.shared')
: null : null
} }
isSaving={isUpdatingAttendee} isSaving={isUpdatingAttendee}
@@ -95,15 +97,15 @@ export function AttendeeContactSection() {
<div className="divide-y divide-border/60"> <div className="divide-y divide-border/60">
<ContactRow <ContactRow
icon={Phone} icon={Phone}
label="Teléfono" label={t('contact.phone')}
value={formatPhoneDisplay(attendee.phone) ?? 'Agregar teléfono'} value={formatPhoneDisplay(attendee.phone) ?? t('contact.addPhone')}
href={attendee.phone ? `tel:${attendee.phone.replace(/\D/g, '')}` : undefined} href={attendee.phone ? `tel:${attendee.phone.replace(/\D/g, '')}` : undefined}
placeholder={!attendee.phone} placeholder={!attendee.phone}
/> />
<ContactRow <ContactRow
icon={Mail} icon={Mail}
label="Email" label={t('contact.email')}
value={attendee.email ?? 'Agregar email'} value={attendee.email ?? t('contact.addEmail')}
href={attendee.email ? `mailto:${attendee.email}` : undefined} href={attendee.email ? `mailto:${attendee.email}` : undefined}
placeholder={!attendee.email} placeholder={!attendee.email}
/> />

View File

@@ -9,6 +9,8 @@ import type {
GroupWaitlistEntryDto, GroupWaitlistEntryDto,
UpdateAttendee, UpdateAttendee,
} from '@gruperly/shared' } from '@gruperly/shared'
import { errorMessage } from '../../i18n'
import { i18n } from '../../i18n/instance'
import { useToast } from '../../components/ui' import { useToast } from '../../components/ui'
import { import {
addAttendeeToGroup, addAttendeeToGroup,
@@ -143,8 +145,8 @@ export function AttendeeDetailProvider({
const moveMutation = useMutation({ const moveMutation = useMutation({
mutationFn: (targetGroupId: string) => moveGroupAttendee(groupId, attendeeId, targetGroupId), mutationFn: (targetGroupId: string) => moveGroupAttendee(groupId, attendeeId, targetGroupId),
onSuccess: (moved, targetGroupId) => { onSuccess: (moved, targetGroupId) => {
const targetName = groups.find((group) => group.id === targetGroupId)?.name ?? 'otro grupo' const targetName = groups.find((group) => group.id === targetGroupId)?.name ?? i18n.t('attendeeDetail:changeGroup.otherGroup')
toast.success(`${moved.fullName} pasó a ${targetName}.`) toast.success(i18n.t('attendeeDetail:changeGroup.moved', { name: moved.fullName, group: targetName }))
for (const id of [groupId, targetGroupId]) { for (const id of [groupId, targetGroupId]) {
void queryClient.invalidateQueries({ queryKey: ['group-attendees', id] }) void queryClient.invalidateQueries({ queryKey: ['group-attendees', id] })
void queryClient.invalidateQueries({ queryKey: ['group', id] }) void queryClient.invalidateQueries({ queryKey: ['group', id] })
@@ -163,11 +165,11 @@ export function AttendeeDetailProvider({
onError: (err: Error) => { onError: (err: Error) => {
const code = err instanceof ApiError ? err.problem?.code : undefined const code = err instanceof ApiError ? err.problem?.code : undefined
if (code === 'group_capacity_reached') { if (code === 'group_capacity_reached') {
toast.error('Ese grupo alcanzó su cupo. Elegí otro o liberá un lugar primero.') toast.error(i18n.t('attendeeDetail:changeGroup.targetFull'))
} else if (code === 'attendee_already_registered') { } else if (code === 'attendee_already_registered') {
toast.error('Esta persona ya es miembro de ese grupo.') toast.error(i18n.t('attendeeDetail:changeGroup.alreadyMember'))
} else { } else {
toast.error(err.message || 'No se pudo cambiar de grupo.') toast.error(errorMessage(err, i18n.t('attendeeDetail:changeGroup.moveError')))
} }
}, },
}) })
@@ -175,8 +177,8 @@ export function AttendeeDetailProvider({
const addToGroupMutation = useMutation({ const addToGroupMutation = useMutation({
mutationFn: (targetGroupId: string) => addAttendeeToGroup(groupId, attendeeId, targetGroupId), mutationFn: (targetGroupId: string) => addAttendeeToGroup(groupId, attendeeId, targetGroupId),
onSuccess: (added, targetGroupId) => { onSuccess: (added, targetGroupId) => {
const targetName = groups.find((group) => group.id === targetGroupId)?.name ?? 'otro grupo' const targetName = groups.find((group) => group.id === targetGroupId)?.name ?? i18n.t('attendeeDetail:changeGroup.otherGroup')
toast.success(`${added.fullName} ahora también está en ${targetName}.`) toast.success(i18n.t('attendeeDetail:changeGroup.added', { name: added.fullName, group: targetName }))
void queryClient.invalidateQueries({ queryKey: ['group-attendees', targetGroupId] }) void queryClient.invalidateQueries({ queryKey: ['group-attendees', targetGroupId] })
void queryClient.invalidateQueries({ queryKey: ['group', targetGroupId] }) void queryClient.invalidateQueries({ queryKey: ['group', targetGroupId] })
// "También está en" de esta ficha (y la de sus otros grupos). // "También está en" de esta ficha (y la de sus otros grupos).
@@ -188,11 +190,11 @@ export function AttendeeDetailProvider({
onError: (err: Error) => { onError: (err: Error) => {
const code = err instanceof ApiError ? err.problem?.code : undefined const code = err instanceof ApiError ? err.problem?.code : undefined
if (code === 'group_capacity_reached') { if (code === 'group_capacity_reached') {
toast.error('Ese grupo alcanzó su cupo. Elegí otro o liberá un lugar primero.') toast.error(i18n.t('attendeeDetail:changeGroup.targetFull'))
} else if (code === 'attendee_already_registered') { } else if (code === 'attendee_already_registered') {
toast.error('Esta persona ya es miembro de ese grupo.') toast.error(i18n.t('attendeeDetail:changeGroup.alreadyMember'))
} else { } else {
toast.error(err.message || 'No se pudo agregar al grupo.') toast.error(errorMessage(err, i18n.t('attendeeDetail:changeGroup.addError')))
} }
}, },
}) })

View File

@@ -17,23 +17,25 @@ import { ConfirmRemoveAttendeeDialog } from './ConfirmRemoveAttendeeDialog'
import { formatMemberSince } from './attendance' import { formatMemberSince } from './attendance'
import { paymentPresentation } from './detail' import { paymentPresentation } from './detail'
import { StudentAccessSection } from './StudentAccessSection' import { StudentAccessSection } from './StudentAccessSection'
import { useTranslation } from 'react-i18next'
export function AttendeeDetailView() { export function AttendeeDetailView() {
const { groupId, groupName, attendee, attendeePending, attendeeFailed } = useAttendeeDetail() const { groupId, groupName, attendee, attendeePending, attendeeFailed } = useAttendeeDetail()
const navigate = useNavigate() const navigate = useNavigate()
const { t } = useTranslation(['attendeeDetail', 'common', 'groupDetail'])
const menuTriggerRef = useRef<HTMLButtonElement>(null) const menuTriggerRef = useRef<HTMLButtonElement>(null)
const payment = attendee ? paymentPresentation(attendee.payment) : null const payment = attendee ? paymentPresentation(attendee.payment) : null
return ( return (
<section className="mx-auto w-full max-w-md animate-fade-in lg:max-w-2xl"> <section className="mx-auto w-full max-w-md animate-fade-in lg:max-w-2xl">
<LargeTitle <LargeTitle
title={attendee?.fullName ?? 'Miembro'} title={attendee?.fullName ?? t('fallbackName')}
barContext={groupName ?? 'Grupo'} barContext={groupName ?? t('groupDetail:fallbackTitle')}
leading={ leading={
<Link <Link
to="/groups/$groupId" to="/groups/$groupId"
params={{ groupId }} params={{ groupId }}
aria-label="Volver al grupo" aria-label={t('backToGroup')}
className="relative z-10 hidden size-11 shrink-0 lg:inline-flex items-center justify-center rounded-xl text-primary transition-colors hover:bg-primary-soft active:scale-[0.96] motion-reduce:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent" className="relative z-10 hidden size-11 shrink-0 lg:inline-flex items-center justify-center rounded-xl text-primary transition-colors hover:bg-primary-soft active:scale-[0.96] motion-reduce:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
> >
<ArrowLeft className="size-5" aria-hidden="true" /> <ArrowLeft className="size-5" aria-hidden="true" />
@@ -54,7 +56,7 @@ export function AttendeeDetailView() {
<Badge variant={payment.isDue ? 'warning' : 'success'} className="text-[11px]"> <Badge variant={payment.isDue ? 'warning' : 'success'} className="text-[11px]">
{payment.chipLabel} {payment.chipLabel}
</Badge> </Badge>
<span>Desde {formatMemberSince(attendee.createdAt)}</span> <span>{t('since', { date: formatMemberSince(attendee.createdAt) })}</span>
</div> </div>
) : null} ) : null}
</LargeTitle> </LargeTitle>
@@ -67,16 +69,16 @@ export function AttendeeDetailView() {
{attendeeFailed || (!attendeePending && !attendee) ? ( {attendeeFailed || (!attendeePending && !attendee) ? (
<div className="mt-6 rounded-2xl bg-danger-soft p-6"> <div className="mt-6 rounded-2xl bg-danger-soft p-6">
<h2 className="text-lg font-bold text-danger-fg">Miembro no encontrado</h2> <h2 className="text-lg font-bold text-danger-fg">{t('notFound.title')}</h2>
<p className="mt-2 text-sm text-primary"> <p className="mt-2 text-sm text-primary">
No se pudo cargar la información de este miembro. {t('notFound.description')}
</p> </p>
<Button <Button
variant="ghost" variant="ghost"
className="mt-4 px-0 text-accent-fg hover:bg-transparent hover:text-primary" className="mt-4 px-0 text-accent-fg hover:bg-transparent hover:text-primary"
onClick={() => void navigate({ to: '/groups/$groupId', params: { groupId } })} onClick={() => void navigate({ to: '/groups/$groupId', params: { groupId } })}
> >
Volver al grupo {t('backToGroup')}
</Button> </Button>
</div> </div>
) : null} ) : null}

View File

@@ -1,5 +1,6 @@
import { Loader2 } from 'lucide-react' import { Loader2 } from 'lucide-react'
import { Button } from '../../components/ui' import { Button } from '../../components/ui'
import { useTranslation } from 'react-i18next'
type AttendeeNotesFormProps = { type AttendeeNotesFormProps = {
draft: string draft: string
@@ -18,6 +19,7 @@ export function AttendeeNotesForm({
onCancel, onCancel,
onSave, onSave,
}: AttendeeNotesFormProps) { }: AttendeeNotesFormProps) {
const { t } = useTranslation(['attendeeDetail', 'common'])
return ( return (
<div className="space-y-3 px-3 pb-1"> <div className="space-y-3 px-3 pb-1">
<textarea <textarea
@@ -25,7 +27,7 @@ export function AttendeeNotesForm({
onChange={(event) => onDraftChange(event.target.value)} onChange={(event) => onDraftChange(event.target.value)}
rows={4} rows={4}
autoFocus autoFocus
aria-label="Notas del miembro" aria-label={t('notes.label')}
className="w-full resize-y rounded-xl border border-border bg-surface px-3 py-2.5 text-base leading-relaxed text-primary placeholder:text-secondary transition-colors focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30 sm:text-sm" className="w-full resize-y rounded-xl border border-border bg-surface px-3 py-2.5 text-base leading-relaxed text-primary placeholder:text-secondary transition-colors focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30 sm:text-sm"
/> />
{error ? ( {error ? (
@@ -35,11 +37,11 @@ export function AttendeeNotesForm({
) : null} ) : null}
<div className="flex justify-end gap-2"> <div className="flex justify-end gap-2">
<Button variant="ghost" onClick={onCancel} disabled={isSaving}> <Button variant="ghost" onClick={onCancel} disabled={isSaving}>
Cancelar {t('common:actions.cancel')}
</Button> </Button>
<Button variant="primary" onClick={onSave} disabled={isSaving}> <Button variant="primary" onClick={onSave} disabled={isSaving}>
{isSaving ? <Loader2 className="size-4 animate-spin" /> : null} {isSaving ? <Loader2 className="size-4 animate-spin" /> : null}
Guardar {t('common:actions.save')}
</Button> </Button>
</div> </div>
</div> </div>

View File

@@ -3,10 +3,12 @@ import { AttendeeNotesForm } from './AttendeeNotesForm'
import { formatNotesUpdatedAt } from './detail' import { formatNotesUpdatedAt } from './detail'
import { Section } from './Section' import { Section } from './Section'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
export function AttendeeNotesSection() { export function AttendeeNotesSection() {
const { attendee, saveAttendee, isUpdatingAttendee } = useAttendeeDetail() const { attendee, saveAttendee, isUpdatingAttendee } = useAttendeeDetail()
const [isEditing, setIsEditing] = useState(false) const [isEditing, setIsEditing] = useState(false)
const { t } = useTranslation(['attendeeDetail', 'common'])
const [draft, setDraft] = useState('') const [draft, setDraft] = useState('')
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
@@ -23,13 +25,13 @@ export function AttendeeNotesSection() {
await saveAttendee({ notes: draft }) await saveAttendee({ notes: draft })
setIsEditing(false) setIsEditing(false)
} catch { } catch {
setError('No pudimos guardar la nota. Revisá tu conexión e intentá de nuevo.') setError(t('notes.saveError'))
} }
} }
return ( return (
<Section <Section
title="Notas" title={t('notes.title')}
trailing={ trailing={
!isEditing ? ( !isEditing ? (
<button <button
@@ -37,7 +39,7 @@ export function AttendeeNotesSection() {
onClick={beginEditing} onClick={beginEditing}
className="min-h-11 rounded-lg px-2 text-sm font-medium text-accent-fg transition-colors hover:bg-primary-soft hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent" className="min-h-11 rounded-lg px-2 text-sm font-medium text-accent-fg transition-colors hover:bg-primary-soft hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
> >
Editar {t('notes.edit')}
</button> </button>
) : null ) : null
} }
@@ -60,7 +62,7 @@ export function AttendeeNotesSection() {
) : ( ) : (
<div className="px-3 pb-1"> <div className="px-3 pb-1">
<p className="whitespace-pre-line text-sm leading-relaxed text-primary"> <p className="whitespace-pre-line text-sm leading-relaxed text-primary">
{attendee.notes || 'Sin notas todavía.'} {attendee.notes || t('notes.empty')}
</p> </p>
<p className="mt-1.5 text-xs text-secondary">{formatNotesUpdatedAt(attendee.updatedAt)}</p> <p className="mt-1.5 text-xs text-secondary">{formatNotesUpdatedAt(attendee.updatedAt)}</p>
</div> </div>

View File

@@ -2,21 +2,23 @@ import { Badge, useToast } from '../../components/ui'
import { paymentPresentation } from './detail' import { paymentPresentation } from './detail'
import { Section } from './Section' import { Section } from './Section'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useTranslation } from 'react-i18next'
export function AttendeePaymentsSection() { export function AttendeePaymentsSection() {
const { attendee } = useAttendeeDetail() const { attendee } = useAttendeeDetail()
const toast = useToast() const toast = useToast()
const { t } = useTranslation(['attendeeDetail', 'common'])
if (!attendee) return null if (!attendee) return null
const payment = paymentPresentation(attendee.payment) const payment = paymentPresentation(attendee.payment)
const registerPayment = () => { const registerPayment = () => {
// TODO(cobros): conectar esta acción cuando se confirme el flujo y el endpoint de pagos. // TODO(cobros): conectar esta acción cuando se confirme el flujo y el endpoint de pagos.
toast.info('Registrar pagos estará disponible cuando se defina el flujo de cobros.') toast.info(t('payments.registerPending'))
} }
return ( return (
<Section title="Cobros"> <Section title={t('payments.title')}>
<div className="flex min-h-14 items-center justify-between gap-3 px-3 py-1"> <div className="flex min-h-14 items-center justify-between gap-3 px-3 py-1">
<div className="min-w-0"> <div className="min-w-0">
<p className="truncate text-sm font-medium text-primary"> <p className="truncate text-sm font-medium text-primary">
@@ -31,7 +33,7 @@ export function AttendeePaymentsSection() {
onClick={registerPayment} onClick={registerPayment}
className="min-h-11 shrink-0 rounded-lg px-2 text-sm font-medium text-accent-fg transition-colors hover:bg-primary-soft hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent" className="min-h-11 shrink-0 rounded-lg px-2 text-sm font-medium text-accent-fg transition-colors hover:bg-primary-soft hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
> >
Registrar pago {t('payments.register')}
</button> </button>
</div> </div>
</Section> </Section>

View File

@@ -2,6 +2,7 @@ import { Check } from 'lucide-react'
import { formatPhoneDisplay } from '../../lib/format' import { formatPhoneDisplay } from '../../lib/format'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { useCopyToClipboard } from './useCopyToClipboard' import { useCopyToClipboard } from './useCopyToClipboard'
import { useTranslation } from 'react-i18next'
/** The phone as the subtitle's second line. /** The phone as the subtitle's second line.
* *
@@ -12,6 +13,7 @@ import { useCopyToClipboard } from './useCopyToClipboard'
export function AttendeePhoneLine() { export function AttendeePhoneLine() {
const { attendee } = useAttendeeDetail() const { attendee } = useAttendeeDetail()
const { copied, copy } = useCopyToClipboard() const { copied, copy } = useCopyToClipboard()
const { t } = useTranslation(['attendeeDetail', 'common'])
const phone = attendee?.phone const phone = attendee?.phone
const label = formatPhoneDisplay(phone) const label = formatPhoneDisplay(phone)
@@ -33,12 +35,12 @@ export function AttendeePhoneLine() {
className="flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg" className="flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg"
> >
<Check className="size-3.5" /> <Check className="size-3.5" />
Número copiado {t('phone.copied')}
</span> </span>
) : null} ) : null}
</button> </button>
<span aria-live="polite" className="sr-only"> <span aria-live="polite" className="sr-only">
{copied ? 'Número copiado al portapapeles' : ''} {copied ? t('phone.copiedLive') : ''}
</span> </span>
</> </>
) )

View File

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

View File

@@ -4,6 +4,7 @@ import type { LucideIcon } from 'lucide-react'
import { History, Link2, Loader2, Trash2, UserPlus, Users } from 'lucide-react' import { History, Link2, Loader2, Trash2, UserPlus, Users } from 'lucide-react'
import { Button, Modal } from '../../components/ui' import { Button, Modal } from '../../components/ui'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { Trans, useTranslation } from 'react-i18next'
type Consequence = { key: string; icon: LucideIcon; text: string } type Consequence = { key: string; icon: LucideIcon; text: string }
@@ -26,6 +27,7 @@ export function ConfirmRemoveAttendeeDialog({
} = useAttendeeDetail() } = useAttendeeDetail()
const wasOpen = useRef(false) const wasOpen = useRef(false)
const { t } = useTranslation(['attendeeDetail', 'common'])
const contentRef = useRef<HTMLDivElement>(null) const contentRef = useRef<HTMLDivElement>(null)
useEffect(() => { useEffect(() => {
@@ -52,27 +54,23 @@ export function ConfirmRemoveAttendeeDialog({
{ {
key: 'historial', key: 'historial',
icon: History, icon: History,
text: 'Se borra su historial: las clases registradas y las ausencias que avisó dejan de existir.', text: t('remove.history'),
}, },
] ]
if (attendee.notifyToken) { if (attendee.notifyToken) {
consequences.push({ key: 'link', icon: Link2, text: 'El link de ausencias deja de funcionar.' }) consequences.push({ key: 'link', icon: Link2, text: t('remove.link') })
} }
consequences.push({ consequences.push({
key: 'lugar', key: 'lugar',
icon: Users, icon: Users,
text: waiting text: waiting ? t('remove.spotWaiting', { count: waitlistTotal }) : t('remove.spot'),
? `Se libera 1 lugar. Hay ${waitlistTotal} ${
waitlistTotal === 1 ? 'persona' : 'personas'
} en lista de espera.`
: 'Se libera 1 lugar en el grupo.',
}) })
return ( return (
<Modal <Modal
isOpen={isRemoveDialogOpen} isOpen={isRemoveDialogOpen}
onClose={closeRemoveDialog} onClose={closeRemoveDialog}
title="Quitar del grupo" title={t('remove.title')}
description={`${attendee.fullName}${groupName ? ` · ${groupName}` : ''}`} description={`${attendee.fullName}${groupName ? ` · ${groupName}` : ''}`}
maxWidth="sm" maxWidth="sm"
> >
@@ -87,15 +85,18 @@ export function ConfirmRemoveAttendeeDialog({
</ul> </ul>
<p className="text-xs text-foreground"> <p className="text-xs text-foreground">
Si tiene cobros registrados no se va a poder quitar: primero hay que gestionarlos. {t('remove.paymentsNote')}
</p> </p>
{canPromote && firstWaitlistEntry ? ( {canPromote && firstWaitlistEntry ? (
<div className="rounded-xl bg-accent-soft p-3.5"> <div className="rounded-xl bg-accent-soft p-3.5">
<p className="text-sm text-foreground"> <p className="text-sm text-foreground">
Si lo quitás, podés darle el lugar a{' '} <Trans
<strong className="text-primary">{firstWaitlistEntry.fullName}</strong>, el primero t={t}
de la lista de espera. i18nKey="remove.promote"
values={{ name: firstWaitlistEntry.fullName }}
components={{ strong: <strong className="text-primary" /> }}
/>
</p> </p>
<Button <Button
variant="primary" variant="primary"
@@ -108,14 +109,14 @@ export function ConfirmRemoveAttendeeDialog({
) : ( ) : (
<UserPlus className="size-4" /> <UserPlus className="size-4" />
)} )}
<span>Pasar a {firstWaitlistEntry.fullName} al grupo</span> <span>{t('remove.promoteAction', { name: firstWaitlistEntry.fullName })}</span>
</Button> </Button>
</div> </div>
) : null} ) : null}
<div className="flex flex-col-reverse gap-2.5 border-t border-border pt-3 sm:flex-row sm:justify-end"> <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={closeRemoveDialog} autoFocus> <Button variant="ghost" onClick={closeRemoveDialog} autoFocus>
Cancelar {t('common:actions.cancel')}
</Button> </Button>
{/* Label in black on the `danger` fill: it is the only way to reach AA {/* Label in black on the `danger` fill: it is the only way to reach AA
with the same red in both themes (4.9:1 light, 6.7:1 dark); in white with the same red in both themes (4.9:1 light, 6.7:1 dark); in white
@@ -130,7 +131,7 @@ export function ConfirmRemoveAttendeeDialog({
) : ( ) : (
<Trash2 className="size-4" /> <Trash2 className="size-4" />
)} )}
<span>Quitar del grupo</span> <span>{t('remove.confirm')}</span>
</Button> </Button>
</div> </div>
</div> </div>

View File

@@ -7,6 +7,7 @@ import { inviteStudent } from '../../lib/api'
import { cn } from '../../lib/utils' import { cn } from '../../lib/utils'
import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton' import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
import { invitationMessage } from './studentAccess' import { invitationMessage } from './studentAccess'
import { useTranslation } from 'react-i18next'
type InviteToAppSheetProps = { type InviteToAppSheetProps = {
isOpen: boolean isOpen: boolean
@@ -34,6 +35,7 @@ export function InviteToAppSheet({
reinvite, reinvite,
}: InviteToAppSheetProps) { }: InviteToAppSheetProps) {
const queryClient = useQueryClient() const queryClient = useQueryClient()
const { t } = useTranslation(['attendeeDetail', 'common'])
const [invitation, setInvitation] = useState<StudentInvitationDto | null>(null) const [invitation, setInvitation] = useState<StudentInvitationDto | null>(null)
const [copied, setCopied] = useState(false) const [copied, setCopied] = useState(false)
const firstName = fullName.split(' ')[0] ?? fullName const firstName = fullName.split(' ')[0] ?? fullName
@@ -89,32 +91,32 @@ export function InviteToAppSheet({
} }
} }
const preview = invitationMessage(firstName, groupName, invitation?.url ?? '🔗 link personal') const preview = invitationMessage(firstName, groupName, invitation?.url ?? t('inviteSheet.linkPlaceholder'))
return ( return (
<Sheet <Sheet
isOpen={isOpen} isOpen={isOpen}
onClose={handleClose} onClose={handleClose}
title={reinvite ? 'Reinvitar a la app' : 'Invitar a la app'} title={reinvite ? t('inviteSheet.titleReinvite') : t('inviteSheet.title')}
description={ description={
reinvite reinvite
? `Mandale un link nuevo a ${firstName}. El acceso anterior deja de funcionar.` ? t('inviteSheet.descriptionReinvite', { name: firstName })
: `${firstName} va a poder avisar faltas, informar pagos y ver sus próximas clases. Sin contraseñas ni datos nuevos.` : t('inviteSheet.description', { name: firstName })
} }
> >
<div className="space-y-4"> <div className="space-y-4">
<div className="rounded-2xl rounded-tl-sm bg-success-soft px-4 py-3 text-sm text-primary break-words" aria-label="Vista previa del mensaje"> <div className="rounded-2xl rounded-tl-sm bg-success-soft px-4 py-3 text-sm text-primary break-words" aria-label={t('inviteSheet.preview')}>
{preview} {preview}
</div> </div>
<p className="flex gap-2 rounded-xl bg-primary-soft px-3 py-2.5 text-xs leading-relaxed text-secondary"> <p className="flex gap-2 rounded-xl bg-primary-soft px-3 py-2.5 text-xs leading-relaxed text-secondary">
<Lock className="mt-0.5 size-4 shrink-0 text-primary" aria-hidden="true" /> <Lock className="mt-0.5 size-4 shrink-0 text-primary" aria-hidden="true" />
El link es personal, sirve una sola vez y vence en 72 horas. Queda conectado el primer teléfono que lo abra. {t('inviteSheet.security')}
</p> </p>
{mutation.isError ? ( {mutation.isError ? (
<p role="alert" className="text-sm text-danger-fg"> <p role="alert" className="text-sm text-danger-fg">
No pudimos generar el link. Probá de nuevo. {t('inviteSheet.error')}
</p> </p>
) : null} ) : null}
@@ -122,7 +124,7 @@ export function InviteToAppSheet({
{hasPhone ? ( {hasPhone ? (
<button type="button" onClick={() => void sendWhatsapp()} disabled={mutation.isPending} className={PRIMARY_ACTION_CLASS}> <button type="button" onClick={() => void sendWhatsapp()} disabled={mutation.isPending} className={PRIMARY_ACTION_CLASS}>
{mutation.isPending ? <Loader2 className="size-4 animate-spin" aria-hidden="true" /> : <MessageCircle className="size-4" aria-hidden="true" />} {mutation.isPending ? <Loader2 className="size-4 animate-spin" aria-hidden="true" /> : <MessageCircle className="size-4" aria-hidden="true" />}
Enviar por WhatsApp {t('inviteSheet.sendWhatsapp')}
</button> </button>
) : null} ) : null}
<button <button
@@ -132,7 +134,7 @@ export function InviteToAppSheet({
className={cn(hasPhone ? ACTION_BUTTON_CLASS : PRIMARY_ACTION_CLASS, 'w-full')} className={cn(hasPhone ? ACTION_BUTTON_CLASS : PRIMARY_ACTION_CLASS, 'w-full')}
> >
{copied ? <Check className="size-4" aria-hidden="true" /> : <Copy className="size-4" aria-hidden="true" />} {copied ? <Check className="size-4" aria-hidden="true" /> : <Copy className="size-4" aria-hidden="true" />}
<span aria-live="polite">{copied ? 'Link copiado' : 'Copiar link'}</span> <span aria-live="polite">{copied ? t('inviteSheet.copied') : t('inviteSheet.copy')}</span>
</button> </button>
</div> </div>
</div> </div>

View File

@@ -4,23 +4,25 @@ import type { PersonMembership } from '@gruperly/shared'
import { Badge, type BadgeVariant } from '../../components/ui' import { Badge, type BadgeVariant } from '../../components/ui'
import { useAttendeeDetail } from './AttendeeDetailProvider' import { useAttendeeDetail } from './AttendeeDetailProvider'
import { Section } from './Section' import { Section } from './Section'
import { useTranslation } from 'react-i18next'
type StatusBadge = { label: string; variant: BadgeVariant } type StatusBadge = { label: 'otherGroups.PAUSED' | 'otherGroups.DROPPED'; variant: BadgeVariant }
const STATUS_BADGE: Record<PersonMembership['status'], StatusBadge | null> = { const STATUS_BADGE: Record<PersonMembership['status'], StatusBadge | null> = {
ACTIVE: null, ACTIVE: null,
PAUSED: { label: 'En pausa', variant: 'warning' }, PAUSED: { label: 'otherGroups.PAUSED', variant: 'warning' },
DROPPED: { label: 'Dado de baja', variant: 'neutral' }, DROPPED: { label: 'otherGroups.DROPPED', variant: 'neutral' },
} }
/* La misma persona en otros grupos del profe: cada fila abre su ficha en ese /* La misma persona en otros grupos del profe: cada fila abre su ficha en ese
grupo (asistencia y cuotas son de cada grupo; el contacto es compartido). */ grupo (asistencia y cuotas son de cada grupo; el contacto es compartido). */
export function OtherGroupsSection() { export function OtherGroupsSection() {
const { attendee } = useAttendeeDetail() const { attendee } = useAttendeeDetail()
const { t } = useTranslation(['attendeeDetail', 'common'])
if (!attendee || attendee.otherGroups.length === 0) return null if (!attendee || attendee.otherGroups.length === 0) return null
return ( return (
<Section title="También está en"> <Section title={t('otherGroups.title')}>
<ul className="divide-y divide-border/60"> <ul className="divide-y divide-border/60">
{attendee.otherGroups.map((membership) => { {attendee.otherGroups.map((membership) => {
const badge = STATUS_BADGE[membership.status] const badge = STATUS_BADGE[membership.status]
@@ -35,7 +37,7 @@ export function OtherGroupsSection() {
<span className="min-w-0 flex-1 truncate text-sm text-primary">{membership.groupName}</span> <span className="min-w-0 flex-1 truncate text-sm text-primary">{membership.groupName}</span>
{badge ? ( {badge ? (
<Badge variant={badge.variant} className="text-[11px]"> <Badge variant={badge.variant} className="text-[11px]">
{badge.label} {t(badge.label)}
</Badge> </Badge>
) : null} ) : null}
<ChevronRight className="size-4 shrink-0 text-secondary" aria-hidden="true" /> <ChevronRight className="size-4 shrink-0 text-secondary" aria-hidden="true" />

View File

@@ -8,12 +8,14 @@ import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
import { InviteToAppSheet } from './InviteToAppSheet' import { InviteToAppSheet } from './InviteToAppSheet'
import { Section } from './Section' import { Section } from './Section'
import { accessBadge, formatAgo, formatSince } from './studentAccess' import { accessBadge, formatAgo, formatSince } from './studentAccess'
import { useTranslation } from 'react-i18next'
/* "Acceso a la app": passive state, nothing to manage. The only action is /* "Acceso a la app": passive state, nothing to manage. The only action is
inviting (or reinviting, which closes the previous access). */ inviting (or reinviting, which closes the previous access). */
export function StudentAccessSection() { export function StudentAccessSection() {
const { groupId, groupName, attendee } = useAttendeeDetail() const { groupId, groupName, attendee } = useAttendeeDetail()
const [sheetOpen, setSheetOpen] = useState(false) const [sheetOpen, setSheetOpen] = useState(false)
const { t } = useTranslation(['attendeeDetail', 'common'])
const accessQuery = useQuery({ const accessQuery = useQuery({
queryKey: ['student-access', groupId, attendee?.id], queryKey: ['student-access', groupId, attendee?.id],
@@ -28,7 +30,7 @@ export function StudentAccessSection() {
const hasPhone = Boolean(attendee.phone || attendee.guardianPhone) const hasPhone = Boolean(attendee.phone || attendee.guardianPhone)
return ( return (
<Section title="Acceso a la app" trailing={badge ? <Badge variant={badge.variant}>{badge.label}</Badge> : null}> <Section title={t('access.title')} trailing={badge ? <Badge variant={badge.variant}>{badge.label}</Badge> : null}>
<div className="space-y-3 px-3"> <div className="space-y-3 px-3">
{access?.status === 'active' {access?.status === 'active'
? access.devices.map((device) => ( ? access.devices.map((device) => (
@@ -37,8 +39,8 @@ export function StudentAccessSection() {
<div className="min-w-0"> <div className="min-w-0">
<p className="truncate text-sm font-medium text-primary">{device.device}</p> <p className="truncate text-sm font-medium text-primary">{device.device}</p>
<p className="text-xs text-secondary"> <p className="text-xs text-secondary">
Desde el {formatSince(device.createdAt)} · último uso {formatAgo(device.lastUsedAt)} {t('access.device', { since: formatSince(device.createdAt), ago: formatAgo(device.lastUsedAt) })}
{access.hasPasskey ? ' · Face ID' : ''} {access.hasPasskey ? t('access.faceId') : ''}
</p> </p>
</div> </div>
</div> </div>
@@ -46,12 +48,12 @@ export function StudentAccessSection() {
: null} : null}
{access?.status === 'not_invited' ? ( {access?.status === 'not_invited' ? (
<p className="text-sm text-secondary">Para que avise faltas e informe pagos desde su teléfono.</p> <p className="text-sm text-secondary">{t('access.pitch')}</p>
) : null} ) : null}
{invited ? ( {invited ? (
<p className="text-xs text-secondary"> <p className="text-xs text-secondary">
¿Te dice que no puede entrar? Mandale un link nuevo: cierra el acceso anterior. {t('access.reinviteHint')}
</p> </p>
) : null} ) : null}
@@ -62,7 +64,7 @@ export function StudentAccessSection() {
className={invited ? `${ACTION_BUTTON_CLASS} w-full` : PRIMARY_ACTION_CLASS} className={invited ? `${ACTION_BUTTON_CLASS} w-full` : PRIMARY_ACTION_CLASS}
> >
{invited ? <MessageCircle className="size-4" aria-hidden="true" /> : <UserPlus className="size-4" aria-hidden="true" />} {invited ? <MessageCircle className="size-4" aria-hidden="true" /> : <UserPlus className="size-4" aria-hidden="true" />}
{invited ? (hasPhone ? 'Reinvitar por WhatsApp' : 'Reinvitar') : 'Invitar a la app'} {invited ? (hasPhone ? t('access.reinviteWhatsapp') : t('access.reinvite')) : t('access.invite')}
</button> </button>
) : null} ) : null}
</div> </div>
@@ -71,7 +73,7 @@ export function StudentAccessSection() {
isOpen={sheetOpen} isOpen={sheetOpen}
onClose={() => setSheetOpen(false)} onClose={() => setSheetOpen(false)}
groupId={groupId} groupId={groupId}
groupName={groupName ?? 'tu grupo'} groupName={groupName ?? t('access.yourGroup')}
attendeeId={attendee.id} attendeeId={attendee.id}
fullName={attendee.fullName} fullName={attendee.fullName}
hasPhone={hasPhone} hasPhone={hasPhone}

View File

@@ -1,4 +1,5 @@
import type { AttendanceHistoryItem } from '@gruperly/shared' import type { AttendanceHistoryItem } from '@gruperly/shared'
import { i18n } from '../../i18n/instance'
/* The history endpoint cuts off at 20 sessions (HISTORY_SESSIONS_LIMIT on the /* The history endpoint cuts off at 20 sessions (HISTORY_SESSIONS_LIMIT on the
backend). It is the real ceiling on what this screen can show, so "Ver todas" backend). It is the real ceiling on what this screen can show, so "Ver todas"
@@ -10,22 +11,20 @@ export type AttendanceSession = AttendanceHistoryItem
export function formatSessionShortDate(iso: string): string { export function formatSessionShortDate(iso: string): string {
const date = new Date(iso) const date = new Date(iso)
const weekday = date.toLocaleDateString('es-MX', { weekday: 'short' }) const weekday = date.toLocaleDateString(i18n.language, { weekday: 'short' })
const day = date.toLocaleDateString('es-MX', { day: 'numeric' }) const day = date.toLocaleDateString(i18n.language, { day: 'numeric' })
const month = date.toLocaleDateString('es-MX', { month: 'short' }) const month = date.toLocaleDateString(i18n.language, { month: 'short' })
return `${weekday} ${day} ${month}` return `${weekday} ${day} ${month}`
} }
export function attendanceStatusLabel(status: AttendanceSession['status']): string { export function attendanceStatusLabel(status: AttendanceSession['status']): string {
switch (status) { switch (status) {
case 'PRESENT': case 'PRESENT':
return 'Asistió'
case 'ABSENT': case 'ABSENT':
return 'Faltó'
case 'EXCUSED': case 'EXCUSED':
return 'Faltó (avisó)' return i18n.t(`attendeeDetail:attendance.${status}`)
default: default:
return 'Sin registrar' return i18n.t('attendeeDetail:attendance.NONE')
} }
} }
@@ -47,7 +46,7 @@ export function attendanceStatusClass(status: AttendanceSession['status']): stri
/** "28 sep 2026". It is the usual short date: it fits on one line on mobile. */ /** "28 sep 2026". It is the usual short date: it fits on one line on mobile. */
export function formatMemberSince(iso: string): string { export function formatMemberSince(iso: string): string {
return new Date(iso).toLocaleDateString('es-MX', { return new Date(iso).toLocaleDateString(i18n.language, {
day: 'numeric', day: 'numeric',
month: 'short', month: 'short',
year: 'numeric', year: 'numeric',
@@ -56,7 +55,7 @@ export function formatMemberSince(iso: string): string {
/** "1 clase" / "2 clases". */ /** "1 clase" / "2 clases". */
export function classCountLabel(count: number): string { export function classCountLabel(count: number): string {
return count === 1 ? '1 clase' : `${count} clases` return i18n.t('attendeeDetail:attendance.classes', { count })
} }
/** What is displayed: from the most recent to the oldest, with the last /** What is displayed: from the most recent to the oldest, with the last
@@ -78,8 +77,8 @@ export type AttendanceSummary = {
/** Summary of the rows being shown. The denominator deliberately includes /** Summary of the rows being shown. The denominator deliberately includes
* unmarked sessions so the counter always matches the visible list. */ * unmarked sessions so the counter always matches the visible list. */
export function attendanceSummary(sessions: AttendanceSession[]): AttendanceSummary { export function attendanceSummary(sessions: AttendanceSession[]): AttendanceSummary {
if (sessions.length === 0) return { label: 'Sin clases registradas' } if (sessions.length === 0) return { label: i18n.t('attendeeDetail:attendance.noClasses') }
const present = sessions.filter((session) => session.status === 'PRESENT').length const present = sessions.filter((session) => session.status === 'PRESENT').length
return { label: `${present} de ${classCountLabel(sessions.length)}` } return { label: i18n.t('attendeeDetail:attendance.summary', { present, classes: classCountLabel(sessions.length) }) }
} }

View File

@@ -1,6 +1,7 @@
import type { AttendeePaymentSummary } from '@gruperly/shared' import type { AttendeePaymentSummary } from '@gruperly/shared'
import { UpdateAttendeeSchema } from '@gruperly/shared' import { UpdateAttendeeSchema } from '@gruperly/shared'
import { validationMessage } from '../../i18n/validation' import { validationMessage } from '../../i18n/validation'
import { i18n } from '../../i18n/instance'
export function contactEmailError(email: string): string | null { export function contactEmailError(email: string): string | null {
const result = UpdateAttendeeSchema.safeParse({ email }) const result = UpdateAttendeeSchema.safeParse({ email })
@@ -21,47 +22,50 @@ export function paymentPresentation(
): PaymentPresentation { ): PaymentPresentation {
const periodLabel = capitalize(formatMonthAndYear(today)) const periodLabel = capitalize(formatMonthAndYear(today))
if (!payment) { if (!payment) {
return { periodLabel, statusLabel: 'Sin cobro registrado', chipLabel: 'Al día', isDue: false } return {
periodLabel,
statusLabel: i18n.t('attendeeDetail:payments.noCharge'),
chipLabel: i18n.t('attendeeDetail:payments.upToDate'),
isDue: false,
}
} }
const isDue = payment.status === 'PENDING' || payment.status === 'OVERDUE' const isDue = payment.status === 'PENDING' || payment.status === 'OVERDUE'
return { return {
periodLabel, periodLabel,
statusLabel: paymentStatusLabel(payment.status), statusLabel: paymentStatusLabel(payment.status),
chipLabel: isDue ? `Debe ${formatMonth(new Date(payment.dueDate))}` : 'Al día', chipLabel: isDue
? i18n.t('attendeeDetail:payments.owes', { month: formatMonth(new Date(payment.dueDate)) })
: i18n.t('attendeeDetail:payments.upToDate'),
isDue, isDue,
} }
} }
export function formatNotesUpdatedAt(updatedAt: string, today = new Date()): string { export function formatNotesUpdatedAt(updatedAt: string, today = new Date()): string {
const date = new Date(updatedAt) const date = new Date(updatedAt)
if (sameCalendarDate(date, today)) return 'Editado hoy' if (sameCalendarDate(date, today)) return i18n.t('attendeeDetail:notes.editedToday')
return `Editado ${date.toLocaleDateString('es-MX', { return i18n.t('attendeeDetail:notes.edited', {
day: 'numeric', date: date.toLocaleDateString(i18n.language, { day: 'numeric', month: 'short', year: 'numeric' }),
month: 'short', })
year: 'numeric',
})}`
} }
function paymentStatusLabel(status: AttendeePaymentSummary['status']): string { function paymentStatusLabel(status: AttendeePaymentSummary['status']): string {
switch (status) { switch (status) {
case 'PAID': case 'PAID':
return 'Pagado'
case 'OVERDUE': case 'OVERDUE':
return 'Vencido'
case 'CANCELLED': case 'CANCELLED':
return 'Cancelado' return i18n.t(`common:paymentStatus.${status}`)
default: default:
return 'Pendiente' return i18n.t('common:paymentStatus.PENDING')
} }
} }
function formatMonth(date: Date): string { function formatMonth(date: Date): string {
return date.toLocaleDateString('es-MX', { month: 'long' }) return date.toLocaleDateString(i18n.language, { month: 'long' })
} }
function formatMonthAndYear(date: Date): string { function formatMonthAndYear(date: Date): string {
const parts = new Intl.DateTimeFormat('es-MX', { month: 'long', year: 'numeric' }).formatToParts(date) const parts = new Intl.DateTimeFormat(i18n.language, { month: 'long', year: 'numeric' }).formatToParts(date)
const month = parts.find((part) => part.type === 'month')?.value ?? '' const month = parts.find((part) => part.type === 'month')?.value ?? ''
const year = parts.find((part) => part.type === 'year')?.value ?? '' const year = parts.find((part) => part.type === 'year')?.value ?? ''
return `${month} ${year}`.trim() return `${month} ${year}`.trim()

View File

@@ -1,5 +1,6 @@
import type { StudentAccessDto } from '@gruperly/shared' import type { StudentAccessDto } from '@gruperly/shared'
import type { BadgeVariant } from '../../components/ui' import type { BadgeVariant } from '../../components/ui'
import { i18n } from '../../i18n/instance'
const HOUR_MS = 3_600_000 const HOUR_MS = 3_600_000
const DAY_MS = 24 * HOUR_MS const DAY_MS = 24 * HOUR_MS
@@ -7,33 +8,36 @@ const DAY_MS = 24 * HOUR_MS
export function accessBadge(access: StudentAccessDto, now: Date = new Date()): { label: string; variant: BadgeVariant } { export function accessBadge(access: StudentAccessDto, now: Date = new Date()): { label: string; variant: BadgeVariant } {
switch (access.status) { switch (access.status) {
case 'active': case 'active':
return { label: 'Activo', variant: 'success' } return { label: i18n.t('attendeeDetail:access.active'), variant: 'success' }
case 'invited': { case 'invited': {
const hours = access.invitationExpiresAt const hours = access.invitationExpiresAt
? Math.max(1, Math.ceil((Date.parse(access.invitationExpiresAt) - now.getTime()) / HOUR_MS)) ? Math.max(1, Math.ceil((Date.parse(access.invitationExpiresAt) - now.getTime()) / HOUR_MS))
: null : null
return { label: hours ? `Invitado · vence en ${hours} h` : 'Invitado', variant: 'info' } return {
label: hours ? i18n.t('attendeeDetail:access.invitedExpires', { hours }) : i18n.t('attendeeDetail:access.invited'),
variant: 'info',
}
} }
case 'expired': case 'expired':
return { label: 'Vencido', variant: 'warning' } return { label: i18n.t('attendeeDetail:access.expired'), variant: 'warning' }
default: default:
return { label: 'Sin invitar', variant: 'neutral' } return { label: i18n.t('attendeeDetail:access.notInvited'), variant: 'neutral' }
} }
} }
/** "hace 5 min", "hace 3 h", "ayer", "hace 4 días". */ /** "hace 5 min", "hace 3 h", "ayer", "hace 4 días". */
export function formatAgo(iso: string, now: Date = new Date()): string { export function formatAgo(iso: string, now: Date = new Date()): string {
const diff = Math.max(0, now.getTime() - Date.parse(iso)) const diff = Math.max(0, now.getTime() - Date.parse(iso))
if (diff < HOUR_MS) return `hace ${Math.max(1, Math.round(diff / 60_000))} min` if (diff < HOUR_MS) return i18n.t('attendeeDetail:access.agoMinutes', { count: Math.max(1, Math.round(diff / 60_000)) })
if (diff < DAY_MS) return `hace ${Math.round(diff / HOUR_MS)} h` if (diff < DAY_MS) return i18n.t('attendeeDetail:access.agoHours', { count: Math.round(diff / HOUR_MS) })
const days = Math.round(diff / DAY_MS) const days = Math.round(diff / DAY_MS)
return days === 1 ? 'ayer' : `hace ${days} días` return days === 1 ? i18n.t('attendeeDetail:access.yesterday') : i18n.t('attendeeDetail:access.agoDays', { count: days })
} }
export function formatSince(iso: string): string { export function formatSince(iso: string): string {
return new Date(iso).toLocaleDateString('es-AR', { day: 'numeric', month: 'long' }) return new Date(iso).toLocaleDateString(i18n.language, { day: 'numeric', month: 'long' })
} }
export function invitationMessage(firstName: string, groupName: string, url: string): string { export function invitationMessage(firstName: string, groupName: string, url: string): string {
return `¡Hola ${firstName}! Te invito a gruperly para avisar faltas e informar pagos de ${groupName}. ${url}` return i18n.t('attendeeDetail:inviteSheet.message', { name: firstName, group: groupName, url })
} }

View File

@@ -11,6 +11,7 @@ import type groupDetail from './locales/es-AR/groupDetail.json'
import type groupAdd from './locales/es-AR/groupAdd.json' import type groupAdd from './locales/es-AR/groupAdd.json'
import type analytics from './locales/es-AR/analytics.json' import type analytics from './locales/es-AR/analytics.json'
import type attention from './locales/es-AR/attention.json' import type attention from './locales/es-AR/attention.json'
import type attendeeDetail from './locales/es-AR/attendeeDetail.json'
import type validation from './locales/es-AR/validation.json' import type validation from './locales/es-AR/validation.json'
// es-AR es la fuente: una clave que no exista ahí rompe el typecheck. // es-AR es la fuente: una clave que no exista ahí rompe el typecheck.
@@ -25,6 +26,7 @@ declare module 'i18next' {
pwa: typeof pwa pwa: typeof pwa
settings: typeof settings settings: typeof settings
validation: typeof validation validation: typeof validation
'attendeeDetail': typeof attendeeDetail
'attention': typeof attention 'attention': typeof attention
'analytics': typeof analytics 'analytics': typeof analytics
'groupAdd': typeof groupAdd 'groupAdd': typeof groupAdd

View File

@@ -0,0 +1,162 @@
{
"fallbackName": "Member",
"backToGroup": "Back to group",
"since": "Since {{date}}",
"notFound": {
"title": "Member not found",
"description": "We couldn't load this member's information."
},
"actions": {
"whatsappLabel": "Open WhatsApp with {{name}}",
"callLabel": "Call {{name}}",
"call": "Call",
"missingPhone": "Add a phone number to use these actions",
"theMember": "the member"
},
"phone": {
"copied": "Number copied",
"copiedLive": "Number copied to clipboard"
},
"contact": {
"title": "Contact",
"edit": "Edit",
"phone": "Phone",
"email": "Email",
"addPhone": "Add phone",
"addEmail": "Add email",
"shared": "The change applies to all their groups.",
"phoneTaken": "That phone already belongs to someone else you've registered.",
"saveError": "We couldn't save the changes. Check your connection and try again."
},
"otherGroups": {
"title": "Also in",
"PAUSED": "Paused",
"DROPPED": "Removed"
},
"access": {
"title": "App access",
"active": "Active",
"invited": "Invited",
"invitedExpires": "Invited · expires in {{hours}} h",
"expired": "Expired",
"notInvited": "Not invited",
"device": "Since {{since}} · last used {{ago}}",
"faceId": " · Face ID",
"pitch": "So they can report absences and payments from their phone.",
"reinviteHint": "Can't get in? Send them a new link: it closes the previous access.",
"reinviteWhatsapp": "Re-invite on WhatsApp",
"reinvite": "Re-invite",
"invite": "Invite to the app",
"yourGroup": "your group",
"agoMinutes": "{{count}} min ago",
"agoHours": "{{count}} h ago",
"yesterday": "yesterday",
"agoDays": "{{count}} days ago"
},
"inviteSheet": {
"titleReinvite": "Re-invite to the app",
"title": "Invite to the app",
"descriptionReinvite": "Send {{name}} a new link. The previous access stops working.",
"description": "{{name}} will be able to report absences, report payments and see their upcoming classes. No passwords or new details.",
"preview": "Message preview",
"linkPlaceholder": "🔗 personal link",
"security": "The link is personal, works only once and expires in 72 hours. The first phone that opens it stays connected.",
"error": "We couldn't create the link. Please try again.",
"sendWhatsapp": "Send on WhatsApp",
"copied": "Link copied",
"copy": "Copy link",
"message": "Hi {{name}}! I'm inviting you to gruperly to report absences and payments for {{group}}. {{url}}"
},
"payments": {
"title": "Payments",
"register": "Record payment",
"registerPending": "Recording payments will be available once the payment flow is defined.",
"noCharge": "No charge on record",
"upToDate": "Up to date",
"owes": "Owes {{month}}"
},
"attendance": {
"title": "Attendance",
"loadError": "We couldn't load this member's attendance.",
"empty": "No classes recorded yet.",
"capped": "The history keeps the last {{count}} classes.",
"showLess": "Show less",
"showAll": "Show all ({{count}})",
"noClasses": "No classes recorded",
"summary": "{{present}} of {{classes}}",
"classes_one": "{{count}} class",
"classes_other": "{{count}} classes",
"PRESENT": "Attended",
"ABSENT": "Absent",
"EXCUSED": "Absent (gave notice)",
"NONE": "Not recorded"
},
"notes": {
"title": "Notes",
"edit": "Edit",
"empty": "No notes yet.",
"label": "Member notes",
"saveError": "We couldn't save the note. Check your connection and try again.",
"editedToday": "Edited today",
"edited": "Edited {{date}}"
},
"absenceLink": {
"title": "Absence link",
"description": "So they can tell you when they can't come",
"copy": "Copy link",
"sendLabel": "Send the link to {{name}} on WhatsApp",
"send": "Send on WhatsApp",
"copied": "Link copied",
"message": "Hi {{name}}, you can report your absences using this link: {{url}}"
},
"menu": {
"more": "More actions",
"label": "Member actions",
"changeGroup": "Change group",
"addToGroup": "Add to another group",
"editContact": "Edit contact",
"pause": "Pause membership",
"pausePending": "Pausing memberships will be available once the business rules are confirmed.",
"remove": "Remove from group"
},
"remove": {
"title": "Remove from group",
"history": "Their history is deleted: recorded classes and absence notices no longer exist.",
"link": "The absence link stops working.",
"spotWaiting_one": "1 spot opens up. {{count}} person is on the waitlist.",
"spotWaiting_other": "1 spot opens up. {{count}} people are on the waitlist.",
"spot": "1 spot opens up in the group.",
"paymentsNote": "If they have payments on record they can't be removed: manage those first.",
"promote": "If you remove them, you can give the spot to <strong>{{name}}</strong>, first on the waitlist.",
"promoteAction": "Move {{name}} into the group",
"confirm": "Remove from group"
},
"changeGroup": {
"titleAdd": "Add to another group",
"title": "Change group",
"loadingGroups": "Loading groups",
"allGroups": "They're already a member of all your other groups.",
"noGroupsAdd": "You don't have other groups. Create one to add this member.",
"noGroupsMove": "You don't have other groups. Create one to move this member.",
"addTo": "Add to",
"moveTo": "Move to",
"pick": "Choose a group",
"full": "{{name}} (full)",
"currentGroup": "the current group",
"addStays": "Stays in {{group}}: they'll be in both groups.",
"addShares": "Shares contact details, notes and access to the student app.",
"addSeparate": "Attendance and fees are tracked separately in each group.",
"moveKeeps": "Keeps their history, fees and access to the student app.",
"moveFees": "Pending fees from {{group}} still apply.",
"moveNotices": "Absence notices for upcoming {{group}} classes are cancelled.",
"add": "Add",
"move": "Change group",
"moved": "{{name}} moved to {{group}}.",
"added": "{{name}} is now also in {{group}}.",
"otherGroup": "another group",
"targetFull": "That group is full. Choose another or free up a spot first.",
"alreadyMember": "This person is already a member of that group.",
"moveError": "We couldn't change the group.",
"addError": "We couldn't add them to the group."
}
}

View File

@@ -0,0 +1,162 @@
{
"fallbackName": "Miembro",
"backToGroup": "Volver al grupo",
"since": "Desde {{date}}",
"notFound": {
"title": "Miembro no encontrado",
"description": "No se pudo cargar la información de este miembro."
},
"actions": {
"whatsappLabel": "Abrir WhatsApp con {{name}}",
"callLabel": "Llamar a {{name}}",
"call": "Llamar",
"missingPhone": "Agrega un teléfono para usar estas acciones",
"theMember": "el miembro"
},
"phone": {
"copied": "Número copiado",
"copiedLive": "Número copiado al portapapeles"
},
"contact": {
"title": "Contacto",
"edit": "Editar",
"phone": "Teléfono",
"email": "Email",
"addPhone": "Agregar teléfono",
"addEmail": "Agregar email",
"shared": "El cambio se aplica en todos sus grupos.",
"phoneTaken": "Ese teléfono ya es de otra persona que tienes registrada.",
"saveError": "No pudimos guardar los cambios. Revisa tu conexión e inténtalo de nuevo."
},
"otherGroups": {
"title": "También está en",
"PAUSED": "En pausa",
"DROPPED": "Dado de baja"
},
"access": {
"title": "Acceso a la app",
"active": "Activo",
"invited": "Invitado",
"invitedExpires": "Invitado · vence en {{hours}} h",
"expired": "Vencido",
"notInvited": "Sin invitar",
"device": "Desde el {{since}} · último uso {{ago}}",
"faceId": " · Face ID",
"pitch": "Para que avise faltas e informe pagos desde su teléfono.",
"reinviteHint": "¿Te dice que no puede entrar? Envíale un link nuevo: cierra el acceso anterior.",
"reinviteWhatsapp": "Reinvitar por WhatsApp",
"reinvite": "Reinvitar",
"invite": "Invitar a la app",
"yourGroup": "tu grupo",
"agoMinutes": "hace {{count}} min",
"agoHours": "hace {{count}} h",
"yesterday": "ayer",
"agoDays": "hace {{count}} días"
},
"inviteSheet": {
"titleReinvite": "Reinvitar a la app",
"title": "Invitar a la app",
"descriptionReinvite": "Envíale un link nuevo a {{name}}. El acceso anterior deja de funcionar.",
"description": "{{name}} podrá avisar faltas, informar pagos y ver sus próximas clases. Sin contraseñas ni datos nuevos.",
"preview": "Vista previa del mensaje",
"linkPlaceholder": "🔗 link personal",
"security": "El link es personal, sirve una sola vez y vence en 72 horas. Queda conectado el primer teléfono que lo abra.",
"error": "No pudimos generar el link. Inténtalo de nuevo.",
"sendWhatsapp": "Enviar por WhatsApp",
"copied": "Link copiado",
"copy": "Copiar link",
"message": "¡Hola {{name}}! Te invito a gruperly para avisar faltas e informar pagos de {{group}}. {{url}}"
},
"payments": {
"title": "Cobros",
"register": "Registrar pago",
"registerPending": "Registrar pagos estará disponible cuando se defina el flujo de cobros.",
"noCharge": "Sin cobro registrado",
"upToDate": "Al día",
"owes": "Debe {{month}}"
},
"attendance": {
"title": "Asistencia",
"loadError": "No pudimos cargar la asistencia de este miembro.",
"empty": "Todavía no hay clases registradas.",
"capped": "El historial guarda las últimas {{count}} clases.",
"showLess": "Ver menos",
"showAll": "Ver todas ({{count}})",
"noClasses": "Sin clases registradas",
"summary": "{{present}} de {{classes}}",
"classes_one": "{{count}} clase",
"classes_other": "{{count}} clases",
"PRESENT": "Asistió",
"ABSENT": "Faltó",
"EXCUSED": "Faltó (avisó)",
"NONE": "Sin registrar"
},
"notes": {
"title": "Notas",
"edit": "Editar",
"empty": "Sin notas todavía.",
"label": "Notas del miembro",
"saveError": "No pudimos guardar la nota. Revisa tu conexión e inténtalo de nuevo.",
"editedToday": "Editado hoy",
"edited": "Editado {{date}}"
},
"absenceLink": {
"title": "Link de ausencias",
"description": "Para que avise si no puede venir",
"copy": "Copiar link",
"sendLabel": "Enviar el link por WhatsApp a {{name}}",
"send": "Enviar por WhatsApp",
"copied": "Link copiado",
"message": "Hola {{name}}, desde este link puedes avisar tus ausencias en {{url}}"
},
"menu": {
"more": "Más acciones",
"label": "Acciones del miembro",
"changeGroup": "Cambiar de grupo",
"addToGroup": "Agregar a otro grupo",
"editContact": "Editar contacto",
"pause": "Pausar membresía",
"pausePending": "Pausar la membresía estará disponible cuando se confirme su lógica de negocio.",
"remove": "Quitar del grupo"
},
"remove": {
"title": "Quitar del grupo",
"history": "Se borra su historial: las clases registradas y las ausencias que avisó dejan de existir.",
"link": "El link de ausencias deja de funcionar.",
"spotWaiting_one": "Se libera 1 lugar. Hay {{count}} persona en lista de espera.",
"spotWaiting_other": "Se libera 1 lugar. Hay {{count}} personas en lista de espera.",
"spot": "Se libera 1 lugar en el grupo.",
"paymentsNote": "Si tiene cobros registrados no se podrá quitar: primero hay que gestionarlos.",
"promote": "Si lo quitas, puedes darle el lugar a <strong>{{name}}</strong>, el primero de la lista de espera.",
"promoteAction": "Pasar a {{name}} al grupo",
"confirm": "Quitar del grupo"
},
"changeGroup": {
"titleAdd": "Agregar a otro grupo",
"title": "Cambiar de grupo",
"loadingGroups": "Cargando grupos",
"allGroups": "Ya es miembro de todos tus otros grupos.",
"noGroupsAdd": "No tienes otros grupos. Crea uno para poder agregar a este miembro.",
"noGroupsMove": "No tienes otros grupos. Crea uno para poder mover a este miembro.",
"addTo": "Agregar a",
"moveTo": "Mover a",
"pick": "Elige un grupo",
"full": "{{name}} (sin cupo)",
"currentGroup": "el grupo actual",
"addStays": "Sigue en {{group}}: estará en los dos grupos.",
"addShares": "Comparte el contacto, las notas y el acceso a la app de alumnos.",
"addSeparate": "La asistencia y las cuotas se llevan por separado en cada grupo.",
"moveKeeps": "Conserva su historial, sus cuotas y su acceso a la app de alumnos.",
"moveFees": "Las cuotas pendientes de {{group}} siguen vigentes.",
"moveNotices": "Se cancelan las faltas avisadas para clases futuras de {{group}}.",
"add": "Agregar",
"move": "Cambiar de grupo",
"moved": "{{name}} pasó a {{group}}.",
"added": "{{name}} ahora también está en {{group}}.",
"otherGroup": "otro grupo",
"targetFull": "Ese grupo alcanzó su cupo. Elige otro o libera un lugar primero.",
"alreadyMember": "Esta persona ya es miembro de ese grupo.",
"moveError": "No se pudo cambiar de grupo.",
"addError": "No se pudo agregar al grupo."
}
}

View File

@@ -0,0 +1,162 @@
{
"fallbackName": "Miembro",
"backToGroup": "Volver al grupo",
"since": "Desde {{date}}",
"notFound": {
"title": "Miembro no encontrado",
"description": "No se pudo cargar la información de este miembro."
},
"actions": {
"whatsappLabel": "Abrir WhatsApp con {{name}}",
"callLabel": "Llamar a {{name}}",
"call": "Llamar",
"missingPhone": "Agregá un teléfono para usar estas acciones",
"theMember": "el miembro"
},
"phone": {
"copied": "Número copiado",
"copiedLive": "Número copiado al portapapeles"
},
"contact": {
"title": "Contacto",
"edit": "Editar",
"phone": "Teléfono",
"email": "Email",
"addPhone": "Agregar teléfono",
"addEmail": "Agregar email",
"shared": "El cambio se aplica en todos sus grupos.",
"phoneTaken": "Ese teléfono ya es de otra persona que tenés registrada.",
"saveError": "No pudimos guardar los cambios. Revisá tu conexión e intentá de nuevo."
},
"otherGroups": {
"title": "También está en",
"PAUSED": "En pausa",
"DROPPED": "Dado de baja"
},
"access": {
"title": "Acceso a la app",
"active": "Activo",
"invited": "Invitado",
"invitedExpires": "Invitado · vence en {{hours}} h",
"expired": "Vencido",
"notInvited": "Sin invitar",
"device": "Desde el {{since}} · último uso {{ago}}",
"faceId": " · Face ID",
"pitch": "Para que avise faltas e informe pagos desde su teléfono.",
"reinviteHint": "¿Te dice que no puede entrar? Mandale un link nuevo: cierra el acceso anterior.",
"reinviteWhatsapp": "Reinvitar por WhatsApp",
"reinvite": "Reinvitar",
"invite": "Invitar a la app",
"yourGroup": "tu grupo",
"agoMinutes": "hace {{count}} min",
"agoHours": "hace {{count}} h",
"yesterday": "ayer",
"agoDays": "hace {{count}} días"
},
"inviteSheet": {
"titleReinvite": "Reinvitar a la app",
"title": "Invitar a la app",
"descriptionReinvite": "Mandale un link nuevo a {{name}}. El acceso anterior deja de funcionar.",
"description": "{{name}} va a poder avisar faltas, informar pagos y ver sus próximas clases. Sin contraseñas ni datos nuevos.",
"preview": "Vista previa del mensaje",
"linkPlaceholder": "🔗 link personal",
"security": "El link es personal, sirve una sola vez y vence en 72 horas. Queda conectado el primer teléfono que lo abra.",
"error": "No pudimos generar el link. Probá de nuevo.",
"sendWhatsapp": "Enviar por WhatsApp",
"copied": "Link copiado",
"copy": "Copiar link",
"message": "¡Hola {{name}}! Te invito a gruperly para avisar faltas e informar pagos de {{group}}. {{url}}"
},
"payments": {
"title": "Cobros",
"register": "Registrar pago",
"registerPending": "Registrar pagos estará disponible cuando se defina el flujo de cobros.",
"noCharge": "Sin cobro registrado",
"upToDate": "Al día",
"owes": "Debe {{month}}"
},
"attendance": {
"title": "Asistencia",
"loadError": "No pudimos cargar la asistencia de este miembro.",
"empty": "Todavía no hay clases registradas.",
"capped": "El historial guarda las últimas {{count}} clases.",
"showLess": "Ver menos",
"showAll": "Ver todas ({{count}})",
"noClasses": "Sin clases registradas",
"summary": "{{present}} de {{classes}}",
"classes_one": "{{count}} clase",
"classes_other": "{{count}} clases",
"PRESENT": "Asistió",
"ABSENT": "Faltó",
"EXCUSED": "Faltó (avisó)",
"NONE": "Sin registrar"
},
"notes": {
"title": "Notas",
"edit": "Editar",
"empty": "Sin notas todavía.",
"label": "Notas del miembro",
"saveError": "No pudimos guardar la nota. Revisá tu conexión e intentá de nuevo.",
"editedToday": "Editado hoy",
"edited": "Editado {{date}}"
},
"absenceLink": {
"title": "Link de ausencias",
"description": "Para que avise si no puede venir",
"copy": "Copiar link",
"sendLabel": "Enviar el link por WhatsApp a {{name}}",
"send": "Enviar por WhatsApp",
"copied": "Link copiado",
"message": "Hola {{name}}, desde este link podés avisar tus ausencias en {{url}}"
},
"menu": {
"more": "Más acciones",
"label": "Acciones del miembro",
"changeGroup": "Cambiar de grupo",
"addToGroup": "Agregar a otro grupo",
"editContact": "Editar contacto",
"pause": "Pausar membresía",
"pausePending": "Pausar la membresía estará disponible cuando se confirme su lógica de negocio.",
"remove": "Quitar del grupo"
},
"remove": {
"title": "Quitar del grupo",
"history": "Se borra su historial: las clases registradas y las ausencias que avisó dejan de existir.",
"link": "El link de ausencias deja de funcionar.",
"spotWaiting_one": "Se libera 1 lugar. Hay {{count}} persona en lista de espera.",
"spotWaiting_other": "Se libera 1 lugar. Hay {{count}} personas en lista de espera.",
"spot": "Se libera 1 lugar en el grupo.",
"paymentsNote": "Si tiene cobros registrados no se va a poder quitar: primero hay que gestionarlos.",
"promote": "Si lo quitás, podés darle el lugar a <strong>{{name}}</strong>, el primero de la lista de espera.",
"promoteAction": "Pasar a {{name}} al grupo",
"confirm": "Quitar del grupo"
},
"changeGroup": {
"titleAdd": "Agregar a otro grupo",
"title": "Cambiar de grupo",
"loadingGroups": "Cargando grupos",
"allGroups": "Ya es miembro de todos tus otros grupos.",
"noGroupsAdd": "No tenés otros grupos. Creá uno para poder agregar a este miembro.",
"noGroupsMove": "No tenés otros grupos. Creá uno para poder mover a este miembro.",
"addTo": "Agregar a",
"moveTo": "Mover a",
"pick": "Elegí un grupo",
"full": "{{name}} (sin cupo)",
"currentGroup": "el grupo actual",
"addStays": "Sigue en {{group}}: va a estar en los dos grupos.",
"addShares": "Comparte el contacto, las notas y el acceso a la app de alumnos.",
"addSeparate": "La asistencia y las cuotas se llevan por separado en cada grupo.",
"moveKeeps": "Conserva su historial, sus cuotas y su acceso a la app de alumnos.",
"moveFees": "Las cuotas pendientes de {{group}} siguen vigentes.",
"moveNotices": "Se cancelan las faltas avisadas para clases futuras de {{group}}.",
"add": "Agregar",
"move": "Cambiar de grupo",
"moved": "{{name}} pasó a {{group}}.",
"added": "{{name}} ahora también está en {{group}}.",
"otherGroup": "otro grupo",
"targetFull": "Ese grupo alcanzó su cupo. Elegí otro o liberá un lugar primero.",
"alreadyMember": "Esta persona ya es miembro de ese grupo.",
"moveError": "No se pudo cambiar de grupo.",
"addError": "No se pudo agregar al grupo."
}
}

View File

@@ -0,0 +1,162 @@
{
"fallbackName": "Membro",
"backToGroup": "Voltar ao grupo",
"since": "Desde {{date}}",
"notFound": {
"title": "Membro não encontrado",
"description": "Não foi possível carregar as informações deste membro."
},
"actions": {
"whatsappLabel": "Abrir WhatsApp com {{name}}",
"callLabel": "Ligar para {{name}}",
"call": "Ligar",
"missingPhone": "Adicione um telefone para usar estas ações",
"theMember": "o membro"
},
"phone": {
"copied": "Número copiado",
"copiedLive": "Número copiado para a área de transferência"
},
"contact": {
"title": "Contato",
"edit": "Editar",
"phone": "Telefone",
"email": "E-mail",
"addPhone": "Adicionar telefone",
"addEmail": "Adicionar e-mail",
"shared": "A alteração vale para todos os grupos dele.",
"phoneTaken": "Esse telefone já é de outra pessoa cadastrada.",
"saveError": "Não conseguimos salvar as alterações. Verifique sua conexão e tente novamente."
},
"otherGroups": {
"title": "Também está em",
"PAUSED": "Pausado",
"DROPPED": "Desligado"
},
"access": {
"title": "Acesso ao app",
"active": "Ativo",
"invited": "Convidado",
"invitedExpires": "Convidado · vence em {{hours}} h",
"expired": "Vencido",
"notInvited": "Não convidado",
"device": "Desde {{since}} · último uso {{ago}}",
"faceId": " · Face ID",
"pitch": "Para avisar faltas e informar pagamentos pelo celular.",
"reinviteHint": "Diz que não consegue entrar? Envie um novo link: ele encerra o acesso anterior.",
"reinviteWhatsapp": "Convidar de novo pelo WhatsApp",
"reinvite": "Convidar de novo",
"invite": "Convidar para o app",
"yourGroup": "seu grupo",
"agoMinutes": "há {{count}} min",
"agoHours": "há {{count}} h",
"yesterday": "ontem",
"agoDays": "há {{count}} dias"
},
"inviteSheet": {
"titleReinvite": "Convidar de novo para o app",
"title": "Convidar para o app",
"descriptionReinvite": "Envie um novo link para {{name}}. O acesso anterior deixa de funcionar.",
"description": "{{name}} vai poder avisar faltas, informar pagamentos e ver as próximas aulas. Sem senhas nem dados novos.",
"preview": "Prévia da mensagem",
"linkPlaceholder": "🔗 link pessoal",
"security": "O link é pessoal, vale uma única vez e vence em 72 horas. Fica conectado o primeiro celular que abrir.",
"error": "Não conseguimos gerar o link. Tente novamente.",
"sendWhatsapp": "Enviar pelo WhatsApp",
"copied": "Link copiado",
"copy": "Copiar link",
"message": "Olá, {{name}}! Te convido para o gruperly para avisar faltas e informar pagamentos de {{group}}. {{url}}"
},
"payments": {
"title": "Cobranças",
"register": "Registrar pagamento",
"registerPending": "Registrar pagamentos estará disponível quando o fluxo de cobranças for definido.",
"noCharge": "Nenhuma cobrança registrada",
"upToDate": "Em dia",
"owes": "Deve {{month}}"
},
"attendance": {
"title": "Presença",
"loadError": "Não conseguimos carregar a presença deste membro.",
"empty": "Ainda não há aulas registradas.",
"capped": "O histórico guarda as últimas {{count}} aulas.",
"showLess": "Ver menos",
"showAll": "Ver todas ({{count}})",
"noClasses": "Nenhuma aula registrada",
"summary": "{{present}} de {{classes}}",
"classes_one": "{{count}} aula",
"classes_other": "{{count}} aulas",
"PRESENT": "Presente",
"ABSENT": "Faltou",
"EXCUSED": "Faltou (avisou)",
"NONE": "Sem registro"
},
"notes": {
"title": "Observações",
"edit": "Editar",
"empty": "Nenhuma observação ainda.",
"label": "Observações do membro",
"saveError": "Não conseguimos salvar a observação. Verifique sua conexão e tente novamente.",
"editedToday": "Editado hoje",
"edited": "Editado em {{date}}"
},
"absenceLink": {
"title": "Link de faltas",
"description": "Para avisar se não puder vir",
"copy": "Copiar link",
"sendLabel": "Enviar o link pelo WhatsApp para {{name}}",
"send": "Enviar pelo WhatsApp",
"copied": "Link copiado",
"message": "Olá, {{name}}! Por este link você pode avisar suas faltas: {{url}}"
},
"menu": {
"more": "Mais ações",
"label": "Ações do membro",
"changeGroup": "Mudar de grupo",
"addToGroup": "Adicionar a outro grupo",
"editContact": "Editar contato",
"pause": "Pausar matrícula",
"pausePending": "Pausar a matrícula estará disponível quando a regra de negócio for confirmada.",
"remove": "Remover do grupo"
},
"remove": {
"title": "Remover do grupo",
"history": "O histórico é apagado: as aulas registradas e as faltas avisadas deixam de existir.",
"link": "O link de faltas deixa de funcionar.",
"spotWaiting_one": "Libera 1 vaga. Há {{count}} pessoa na lista de espera.",
"spotWaiting_other": "Libera 1 vaga. Há {{count}} pessoas na lista de espera.",
"spot": "Libera 1 vaga no grupo.",
"paymentsNote": "Se tiver cobranças registradas, não poderá ser removido: primeiro é preciso gerenciá-las.",
"promote": "Se remover, você pode dar a vaga para <strong>{{name}}</strong>, o primeiro da lista de espera.",
"promoteAction": "Passar {{name}} para o grupo",
"confirm": "Remover do grupo"
},
"changeGroup": {
"titleAdd": "Adicionar a outro grupo",
"title": "Mudar de grupo",
"loadingGroups": "Carregando grupos",
"allGroups": "Já é membro de todos os seus outros grupos.",
"noGroupsAdd": "Você não tem outros grupos. Crie um para poder adicionar este membro.",
"noGroupsMove": "Você não tem outros grupos. Crie um para poder mover este membro.",
"addTo": "Adicionar a",
"moveTo": "Mover para",
"pick": "Escolha um grupo",
"full": "{{name}} (sem vagas)",
"currentGroup": "o grupo atual",
"addStays": "Continua em {{group}}: vai estar nos dois grupos.",
"addShares": "Compartilha o contato, as observações e o acesso ao app de alunos.",
"addSeparate": "A presença e as mensalidades são controladas separadamente em cada grupo.",
"moveKeeps": "Mantém o histórico, as mensalidades e o acesso ao app de alunos.",
"moveFees": "As mensalidades pendentes de {{group}} continuam valendo.",
"moveNotices": "As faltas avisadas para aulas futuras de {{group}} são canceladas.",
"add": "Adicionar",
"move": "Mudar de grupo",
"moved": "{{name}} passou para {{group}}.",
"added": "{{name}} agora também está em {{group}}.",
"otherGroup": "outro grupo",
"targetFull": "Esse grupo atingiu o limite de vagas. Escolha outro ou libere uma vaga primeiro.",
"alreadyMember": "Esta pessoa já é membro desse grupo.",
"moveError": "Não foi possível mudar de grupo.",
"addError": "Não foi possível adicionar ao grupo."
}
}

View File

@@ -112,12 +112,12 @@ describe('visibleSessions', () => {
describe('formatSessionShortDate', () => { describe('formatSessionShortDate', () => {
test('fecha corta con día de la semana', () => { test('fecha corta con día de la semana', () => {
expect(formatSessionShortDate(fecha(28))).toBe('lun 28 sep') expect(formatSessionShortDate(fecha(28))).toBe('lun 28 sept')
}) })
}) })
describe('formatMemberSince', () => { describe('formatMemberSince', () => {
test('fecha abreviada con año, en una sola línea', () => { test('fecha abreviada con año, en una sola línea', () => {
expect(formatMemberSince(fecha(18))).toBe('18 sep 2026') expect(formatMemberSince(fecha(18))).toBe('18 de sept de 2026')
}) })
}) })

View File

@@ -69,7 +69,7 @@ describe('formatNotesUpdatedAt', () => {
test('usa una fecha corta para ediciones anteriores', () => { test('usa una fecha corta para ediciones anteriores', () => {
expect( expect(
formatNotesUpdatedAt('2026-09-29T08:00:00.000Z', new Date('2026-10-01T18:00:00.000Z')), formatNotesUpdatedAt('2026-09-29T08:00:00.000Z', new Date('2026-10-01T18:00:00.000Z')),
).toBe('Editado 29 sep 2026') ).toBe('Editado 29 de sept de 2026')
}) })
}) })