feat: soporte multi idioma en la web (infraestructura)
i18next + react-i18next con es-AR (fuente), es-419, pt-BR y en; el idioma sale del dispositivo (fallback a inglés) y se puede cambiar en Ajustes. La elección se guarda en localStorage y, para el profe, en users.locale. Las validaciones de shared pasan a claves y los errores de la API se traducen por code (con params para límites de plan y cupo). Migrados: layout, Ajustes, auth, PWA y lib/format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import { CreateFirstGroupSchema, DEFAULT_COUNTRY } from '@gruperly/shared'
|
||||
import { ArrowLeft, Check, Loader2 } from 'lucide-react'
|
||||
import { sortWeekDays } from '../../lib/format'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { Button, Input, Label } from '../../components/ui'
|
||||
import { Button, FieldError, Input, Label } from '../../components/ui'
|
||||
import { BILLING_TYPES, WEEK_DAY_CHIPS } from '../onboarding/constants'
|
||||
|
||||
type GroupFormProps = {
|
||||
@@ -84,7 +84,7 @@ export function GroupForm({
|
||||
invalid={!!errors.name}
|
||||
{...register('name')}
|
||||
/>
|
||||
{errors.name ? <p className="mt-1 text-sm text-danger">{errors.name.message}</p> : null}
|
||||
<FieldError message={errors.name?.message} />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -110,7 +110,7 @@ export function GroupForm({
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
{errors.days ? <p className="mt-1 text-sm text-danger">{errors.days.message}</p> : null}
|
||||
<FieldError message={errors.days?.message} />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -121,7 +121,7 @@ export function GroupForm({
|
||||
invalid={!!errors.time}
|
||||
{...register('time')}
|
||||
/>
|
||||
{errors.time ? <p className="mt-1 text-sm text-danger">{errors.time.message}</p> : null}
|
||||
<FieldError message={errors.time?.message} />
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
@@ -136,9 +136,7 @@ export function GroupForm({
|
||||
invalid={!!errors.capacity}
|
||||
{...register('capacity', { valueAsNumber: true })}
|
||||
/>
|
||||
{errors.capacity ? (
|
||||
<p className="mt-1 text-sm text-danger">{errors.capacity.message}</p>
|
||||
) : null}
|
||||
<FieldError message={errors.capacity?.message} />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -159,9 +157,7 @@ export function GroupForm({
|
||||
{...register('price', { valueAsNumber: true })}
|
||||
/>
|
||||
</div>
|
||||
{errors.price ? (
|
||||
<p className="mt-1 text-sm text-danger">{errors.price.message}</p>
|
||||
) : null}
|
||||
<FieldError message={errors.price?.message} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -213,9 +209,7 @@ export function GroupForm({
|
||||
<p className="mt-1 text-xs text-foreground/50">
|
||||
Los cobros vencerán el día {isFinite(dueDay) && dueDay ? dueDay : '1'} de cada mes.
|
||||
</p>
|
||||
{errors.dueDay ? (
|
||||
<p className="mt-1 text-sm text-danger">{errors.dueDay.message}</p>
|
||||
) : null}
|
||||
<FieldError message={errors.dueDay?.message} />
|
||||
</div>
|
||||
|
||||
{errorMessage ? (
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CalendarClock, CircleDollarSign, Users } from 'lucide-react'
|
||||
import {
|
||||
formatBillingMeta,
|
||||
formatPrice,
|
||||
WEEK_DAY_FULL_LABELS,
|
||||
weekDayLabel,
|
||||
sortWeekDays,
|
||||
} from '../../../lib/format'
|
||||
import { cn } from '../../../lib/utils'
|
||||
@@ -19,7 +19,7 @@ export function GroupInfoCard() {
|
||||
const { group, attendeesTotal, attendeesPending, waitlistTotal } = useGroupDetail()
|
||||
if (!group) return null
|
||||
|
||||
const daysLabel = sortWeekDays(group.days ?? []).map((day) => WEEK_DAY_FULL_LABELS[day]).join(', ')
|
||||
const daysLabel = sortWeekDays(group.days ?? []).map(weekDayLabel).join(', ')
|
||||
const capacity = group.capacity
|
||||
const isFull = capacity != null && attendeesTotal >= capacity
|
||||
const freeSpots = capacity != null ? Math.max(capacity - attendeesTotal, 0) : null
|
||||
|
||||
Reference in New Issue
Block a user