diff --git a/.interface-design/group-detail-redesign.html b/.interface-design/group-detail-redesign.html new file mode 100644 index 0000000..96e49b5 --- /dev/null +++ b/.interface-design/group-detail-redesign.html @@ -0,0 +1,954 @@ + + + + + + Gruperly — Rediseño detalle de grupo (2 estados) + + + + + + + + + +
+
+

+ Gruperly · /groups/$groupId +

+

Rediseño del detalle de grupo

+

+ Dos pestañas (Miembros · + Pendientes), tarjeta de info con lectura + Horario → Cupo → Cobro, un solo foco primario por estado y objetivos táctiles de 44px. + Tema oscuro, tokens reales de apps/web/src/index.css. +

+
+ +
+ +
+

+ 1 · Con miembros + pre-inscripciones — pestaña “Miembros” +

+
+
+ +
+
+
+

Tai Chi Martes

+

+ Tai chi para principiantes. Trae ropa cómoda. +

+
+
+ + Activo + + + Riesgo moderado + +
+
+ + +
+ + + +
+
+ + +
+
+ +
+

Horario

+

Martes

+

18:00 - 19:30

+
+
+
+ +
+

Miembros & Cupo

+

+ 3/4 +

+
+
+
+

1 lugar libre · 1 en espera

+
+
+
+
+ $ +
+
+

Cobro

+

$450.00

+

Vence el día 10 de cada mes

+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+
+

+ Listado de todos los miembros incorporados al grupo. +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
NombreTeléfonoDetalle
+
+
A
+ Ana López +
+
+ 55 1234 5678 + + +
+
+
C
+ Carlos Mendoza +
+
+ 55 2345 6789 + + +
+
+
L
+ Lucía Hernández +
+
+ 55 3456 7890 + + +
+
+
+
+
+

+ Un solo tono activo: el chip “Miembros”. “Agregar Miembros” es + ghost — disponible, no dominante. Cupo + escaneable como 3/4 + barra. +

+
+ + +
+

+ 1 · Con miembros + pre-inscripciones — pestaña “Pendientes” +

+
+
+
+
+
+

Tai Chi Martes

+

+ Tai chi para principiantes. Trae ropa cómoda. +

+
+
+ + Activo + + + Riesgo moderado + +
+
+
+ + + +
+
+ +
+
+ +
+

Horario

+

Martes

+

18:00 - 19:30

+
+
+
+ +
+

Miembros & Cupo

+

+ 3/4 +

+
+
+
+

1 lugar libre · 1 en espera

+
+
+
+
+ $ +
+
+

Cobro

+

$450.00

+

Vence el día 10 de cada mes

+
+
+
+ +
+
+
+
+ + +
+
+ + +
+
+

+ Pre-inscripciones que esperan tu aprobación y personas en lista de espera por + un cupo libre. +

+
+ +
+ +
+
+ +

+ Pre-inscripciones +

+ 2 +
+
+ + + + + + + + + + + + + + + + + + + + +
NombreTeléfono
+
+
J
+
+

Jorge Ramírez

+

+ jorge.r@correo.mx +

+
+
+
+ 55 4567 8901 + + +
+
+
S
+
+

Sofía Torres

+

+ sofia.t@correo.mx +

+
+
+
+ 55 5678 9012 + + +
+
+
+ + +
+
+ +

+ Lista de espera +

+ 1 +
+
+ + + + + + + + + + + + + + + +
NombreTeléfonoDetalle
+
+
D
+
+

Diego Peña

+

+ Prefiere horario de 19:00 +

+
+
+
+ 55 6789 0123 + + +
+
+
+
+
+
+
+

+ “Pendientes” agrupa Pre-inscripciones (pill ámbar = requiere decisión) y Lista de + espera como secciones apiladas — sin una tercera pestaña. +

+
+ + +
+

+ 2 · Estado vacío — pestaña “Miembros” (sin miembros ni pre-inscripciones) +

+
+
+
+
+
+

Tai Chi Martes

+

+ Tai chi para principiantes. Trae ropa cómoda. +

+
+
+ + Activo + + + Riesgo moderado + +
+
+ +
+ +
+
+ + +
+
+ +
+

Horario

+

Martes

+

18:00 - 19:30

+
+
+
+ +
+

Miembros & Cupo

+

+ 0/4 +

+
+
+
+

4 lugares libres

+
+
+
+
+ $ +
+
+

Cobro

+

$450.00

+

Vence el día 10 de cada mes

+
+
+
+ +
+
+
+
+ + +
+
+ + +
+
+

+ Listado de todos los miembros incorporados al grupo. +

+
+ +
+
+ +

+ Todavía no hay miembros en este grupo +

+

+ Puedes compartir el enlace de invitación único o agregar miembros de forma + manual o masiva. +

+
+ + +
+
+
+
+
+
+

+ Exactamente un primario: “Agregar Miembros” en el + empty state. El header no repite Compartir/Agregar —solo queda Estadísticas—, así que + no compiten dos CTA idénticos. +

+
+ + +
+

+ 2 · Estado vacío — pestaña “Pendientes” +

+
+
+
+
+
+

Tai Chi Martes

+

+ Tai chi para principiantes. Trae ropa cómoda. +

+
+
+ + Activo + + + Riesgo moderado + +
+
+ +
+ +
+
+ +
+
+ +
+

Horario

+

Martes

+

18:00 - 19:30

+
+
+
+ +
+

Miembros & Cupo

+

+ 0/4 +

+
+
+
+

4 lugares libres

+
+
+
+
+ $ +
+
+

Cobro

+

$450.00

+

Vence el día 10 de cada mes

+
+
+
+ +
+
+
+
+ + +
+
+ + +
+
+

+ Pre-inscripciones que esperan tu aprobación y personas en lista de espera por + un cupo libre. +

+
+ +
+
+ +

No hay pendientes

+

+ Las pre-inscripciones que lleguen por el enlace compartido y las personas en + lista de espera aparecerán aquí para que las revises. +

+
+ +
+
+
+
+
+
+

+ Cada pestaña vacía explica qué aparecerá ahí y ofrece + una acción primaria concreta. +

+
+
+ + +
+ + + + diff --git a/.interface-design/group-detail-redesign.png b/.interface-design/group-detail-redesign.png new file mode 100644 index 0000000..8a515ba Binary files /dev/null and b/.interface-design/group-detail-redesign.png differ diff --git a/.interface-design/system.md b/.interface-design/system.md index 4e1fe9b..fc5545f 100644 --- a/.interface-design/system.md +++ b/.interface-design/system.md @@ -36,14 +36,21 @@ accent azul; copy en español, verbos en infinitivo. ## Patrón focal **Un punto focal por bloque y por estado.** La tarjeta de info manda con el cupo; el header -de grupo no tiene ningún `primary` (las tres acciones son `outline`) y el `primary` vive en +de grupo no tiene ningún `primary` (Estadísticas y Compartir son `outline` y **Agregar es +`ghost`**: con miembros en el grupo deja de competir con el listado) y el `primary` vive en el empty state de la vista que lo explica. Así nunca hay dos elementos azules compitiendo. +**Objetivos táctiles ≥ 44px** en esta pantalla: chips (`min-h-11`), botones del header y del +empty state (`h-11`), buscador (`h-11`). Filas de tabla ~56px. + +Preview visual de los dos estados (con miembros + vacío): +`group-detail-redesign.html` / `.png` (mismo directorio). + ## Componentes (valores exactos) ### Chip de sección — `detail/SectionChips.tsx` - Contenedor: `flex w-full flex-wrap items-center gap-2` + `role="group"` (no tablist). -- Chip: `min-h-10 rounded-full border px-3 text-xs font-semibold gap-1.5`, +- Chip: `min-h-11 rounded-full border px-3.5 text-xs font-semibold gap-1.5`, activo `border-transparent bg-accent text-on-accent shadow-xs`, inactivo `border-border bg-surface text-foreground/80 hover:border-accent/40 hover:bg-primary-soft hover:text-primary`, focus `ring-2 ring-accent ring-offset-2 ring-offset-primary-soft`. @@ -53,7 +60,10 @@ el empty state de la vista que lo explica. Así nunca hay dos elementos azules c - `aria-pressed` en cada chip. Envuelve en 1–3 filas según ancho: nunca recorta. ### Acciones de cabecera — `detail/GroupHeader.tsx` -- `variant="outline"` con icono `text-accent`; `md` (`h-10 px-4`). `primary` solo en empty states. +- Estadísticas y Compartir: `variant="outline"` con icono `text-accent`; **Agregar Miembros: + `variant="ghost"`** (disponible, no dominante). Todas `h-11` (44px). +- **Grupo vacío** (0 miembros + 0 pendientes): el header muestra **solo Estadísticas** — + Compartir y Agregar los ofrecen los empty states, que ya llevan su primario explicado. - Móvil: `grid grid-cols-2 gap-2.5` (tercera acción `col-span-2`); `sm+`: `flex justify-end`. - Badges de estado: `rounded-full px-2.5 py-0.5 text-[11px]` + punto `size-1.5`. @@ -76,7 +86,7 @@ el empty state de la vista que lo explica. Así nunca hay dos elementos azules c ### Empty state `rounded-lg bg-primary-soft/50 px-4 py-10 text-center` · icono `size-10 text-foreground/40` · título `text-sm font-semibold text-primary` · cuerpo `max-w-sm text-sm text-foreground/80` · -acciones: **una** `primary` + el resto `outline`. +acciones: **una** `primary` + el resto `outline`, todas `h-11`. ### Tablas — `detail/*Table.tsx` `table-fixed text-sm` · nombre `w-[48%]` · chevron `w-9` · filas `px-3 py-2.5` diff --git a/apps/web/src/components/ui/index.ts b/apps/web/src/components/ui/index.ts index 7123adf..1ff1def 100644 --- a/apps/web/src/components/ui/index.ts +++ b/apps/web/src/components/ui/index.ts @@ -1,8 +1,9 @@ export { Avatar, type AvatarProps } from './avatar' -export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from './button' export { Badge, type BadgeProps, type BadgeVariant } from './badge' +export { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from './button' export { Input, type InputProps } from './input' export { Label, type LabelProps } from './label' export { Modal, type ModalProps } from './modal' -export { ToastProvider, useToast, type ToastType, type Toast } from './toast' +export { type Toast, ToastProvider, type ToastType, useToast } from './toast' +export { Tooltip, type TooltipProps } from './tooltip' diff --git a/apps/web/src/components/ui/tooltip.tsx b/apps/web/src/components/ui/tooltip.tsx new file mode 100644 index 0000000..e87ff64 --- /dev/null +++ b/apps/web/src/components/ui/tooltip.tsx @@ -0,0 +1,67 @@ +import { type ReactNode, useId, useState } from 'react' +import { cn } from '../../lib/utils' + +export type TooltipProps = { + /** Texto explicativo que se muestra al hacer hover, foco de teclado o tap. */ + content: ReactNode + /** Contenido del disparador. Queda dentro de un + + {open ? ( + + {content} + + ) : null} + + ) +} diff --git a/apps/web/src/features/groups/GroupCard.tsx b/apps/web/src/features/groups/GroupCard.tsx index 145cecd..fa96934 100644 --- a/apps/web/src/features/groups/GroupCard.tsx +++ b/apps/web/src/features/groups/GroupCard.tsx @@ -1,10 +1,10 @@ -import { useNavigate } from '@tanstack/react-router' import type { GroupDto, GroupRiskLevel } from '@gruperly/shared' +import { useNavigate } from '@tanstack/react-router' import { CalendarClock, Users } from 'lucide-react' -import { Badge, Button } from '../../components/ui' +import { Badge, Button, Tooltip } from '../../components/ui' import { BILLING_LABELS, formatPrice, formatSchedule } from '../../lib/format' import { cn } from '../../lib/utils' -import { RISK_LABELS } from './constants' +import { RISK_HINT, RISK_LABELS } from './constants' export function GroupCard({ group, @@ -28,16 +28,20 @@ export function GroupCard({
{hasRisk ? ( - - + // Mismo tooltip que en el detalle: el badge es corto y la + // explicación (abandono, no cobranza) la da el tooltip. + + + + ) : null} Activo
diff --git a/apps/web/src/features/groups/analytics/AtRiskStudentCard.tsx b/apps/web/src/features/groups/analytics/AtRiskStudentCard.tsx index e848394..fae4948 100644 --- a/apps/web/src/features/groups/analytics/AtRiskStudentCard.tsx +++ b/apps/web/src/features/groups/analytics/AtRiskStudentCard.tsx @@ -1,7 +1,7 @@ import type { StudentAtRiskDto } from '@gruperly/shared' import { MessageCircle, MoreVertical, Pause, UserMinus } from 'lucide-react' import { Avatar, Badge, Button } from '../../../components/ui' -import { cn } from '../../../lib/utils' +import { formatPhoneDisplay } from '../../../lib/format' export type StatusAction = { student: StudentAtRiskDto; status: 'PAUSED' | 'DROPPED' } | null @@ -32,8 +32,10 @@ export function AtRiskStudentCard({

{student.fullName}

- {student.phone ?? 'Sin teléfono'} · {student.monthlyAttendanceRate}% de asistencia - mensual + {student.phone + ? `${formatPhoneDisplay(student.phone)} · ` + : 'Sin teléfono · '} + {student.monthlyAttendanceRate}% de asistencia mensual

diff --git a/apps/web/src/features/groups/constants.ts b/apps/web/src/features/groups/constants.ts index 2363240..8b5a273 100644 --- a/apps/web/src/features/groups/constants.ts +++ b/apps/web/src/features/groups/constants.ts @@ -3,4 +3,9 @@ import type { GroupRiskLevel } from '@gruperly/shared' export const RISK_LABELS: Record, string> = { HIGH: 'Riesgo alto', MEDIUM: 'Riesgo moderado', -} \ No newline at end of file +} + +/* El badge solo dice "Riesgo moderado"; esta frase explica de qué habla + (abandono de un miembro, no fraude ni cobranza) y vive en el tooltip. */ +export const RISK_HINT = + 'Riesgo de abandono: probabilidad estimada de que algún miembro abandone el grupo.' \ No newline at end of file diff --git a/apps/web/src/features/groups/detail/AttendeeDetailPage.tsx b/apps/web/src/features/groups/detail/AttendeeDetailPage.tsx index 4624cbd..6fe07c9 100644 --- a/apps/web/src/features/groups/detail/AttendeeDetailPage.tsx +++ b/apps/web/src/features/groups/detail/AttendeeDetailPage.tsx @@ -11,6 +11,7 @@ import { UserMinus, } from 'lucide-react' import { Button } from '../../../components/ui' +import { formatPhoneDisplay } from '../../../lib/format' import { AttendeeAttendanceStats } from './AttendeeAttendanceStats' import { useAttendeeDetail } from './AttendeeDetailProvider' import { DetailRow } from './DetailRow' @@ -97,7 +98,7 @@ export function AttendeeDetailPage() { } label="Teléfono"> {attendee.phone ? (
- {attendee.phone} + {formatPhoneDisplay(attendee.phone)} } label="Tel. Responsable">
- {attendee.guardianPhone} + {formatPhoneDisplay(attendee.guardianPhone)} {hasRisk ? ( - - + // El badge no puede llevar texto largo sin ensuciar el header: la + // explicación (riesgo de abandono, no de cobranza) vive en el tooltip. + + + + ) : null}
+ {/* `h-11` (44px) para todos: objetivo táctil mínimo. */} + {!isEmptyGroup ? ( + // Un solo primario por pantalla: "Agregar" encabeza la jerarquía y + // las acciones de apoyo quedan debajo en outline. + + ) : null} - - {/* Acciones de nivel secundario: con miembros en el grupo el foco es el - listado, no el botón. El `primary` de "Agregar" vive en el empty - state, que es donde la acción necesita explicarse. */} - + {!isEmptyGroup ? ( + + ) : null}
) diff --git a/apps/web/src/features/groups/detail/GroupInfoCard.tsx b/apps/web/src/features/groups/detail/GroupInfoCard.tsx index 81f05d3..440aa09 100644 --- a/apps/web/src/features/groups/detail/GroupInfoCard.tsx +++ b/apps/web/src/features/groups/detail/GroupInfoCard.tsx @@ -9,9 +9,10 @@ import { useGroupDetail } from './GroupDetailProvider' /* Escala de la tarjeta: label 11 (etiqueta) · valor 16 (dato) · hero 24 (cupo). El cupo es lo único que se escanea de un vistazo, por eso es el - único que sube de nivel; el resto se lee en línea. */ + único que sube de nivel; el resto se lee en línea. El ritmo vertical está + apretado a propósito (~24px menos que antes) sin bajar la legibilidad. */ const LABEL_CLASS = 'text-[11px] font-semibold uppercase tracking-wide text-foreground/70' -const CELL_CLASS = 'flex items-start gap-3 py-3 first:pt-0 last:pb-0 md:py-0' +const CELL_CLASS = 'flex items-start gap-3 py-2.5 first:pt-0 last:pb-0 md:py-0' export function GroupInfoCard() { const { group, attendeesTotal, attendeesPending, waitlistTotal } = useGroupDetail() @@ -32,12 +33,12 @@ export function GroupInfoCard() { const waitlistMeta = waitlistTotal > 0 ? ` · ${waitlistTotal} en espera` : '' return ( -
+

Horario

-

+

{daysLabel || 'Sin horario definido'}

{daysLabel && group.time ? ( @@ -50,7 +51,7 @@ export function GroupInfoCard() {

Miembros & Cupo

-

+

{attendeesPending ? '—' : attendeesTotal} {capacity ? ( /{capacity} @@ -65,7 +66,7 @@ export function GroupInfoCard() { aria-valuemax={capacity} aria-valuenow={attendeesPending ? 0 : attendeesTotal} aria-valuetext={`${attendeesTotal} de ${capacity}`} - className="mt-2 h-1.5 w-full max-w-[9rem] overflow-hidden rounded-full bg-accent/15" + className="mt-1.5 h-1.5 w-full max-w-[9rem] overflow-hidden rounded-full bg-accent/15" >

+

{capacityMeta} {waitlistMeta}

@@ -92,7 +93,7 @@ export function GroupInfoCard() {

Cobro

-

+

{group.price != null ? formatPrice(group.price) : 'Sin precio'}

{billingMeta && group.price != null ? ( diff --git a/apps/web/src/features/groups/detail/MembersTable.tsx b/apps/web/src/features/groups/detail/MembersTable.tsx index 80fc581..7bbef5c 100644 --- a/apps/web/src/features/groups/detail/MembersTable.tsx +++ b/apps/web/src/features/groups/detail/MembersTable.tsx @@ -1,6 +1,7 @@ import type { AttendeeDto } from '@gruperly/shared' import { useNavigate } from '@tanstack/react-router' import { ChevronRight } from 'lucide-react' +import { formatPhoneDisplay } from '../../../lib/format' import { useGroupDetail } from './GroupDetailProvider' export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) { @@ -15,9 +16,9 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) { - - - + + @@ -26,31 +27,43 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) { {attendees.map((attendee) => ( openAttendee(attendee.id)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + openAttendee(attendee.id) + } + }} > - - - diff --git a/apps/web/src/features/groups/detail/MembersView.tsx b/apps/web/src/features/groups/detail/MembersView.tsx index 2fc54f9..4aafdfc 100644 --- a/apps/web/src/features/groups/detail/MembersView.tsx +++ b/apps/web/src/features/groups/detail/MembersView.tsx @@ -38,7 +38,7 @@ export function MembersView() { masiva.

- @@ -47,7 +47,7 @@ export function MembersView() { onClick={() => void navigate({ to: '/groups/$groupId/attendees/new', params: { groupId } }) } - className="w-full sm:w-auto" + className="h-11 w-full sm:w-auto" > Agregar Miembros diff --git a/apps/web/src/features/groups/detail/MembersWaitlistSection.tsx b/apps/web/src/features/groups/detail/MembersWaitlistSection.tsx index a94556e..b2ec9a8 100644 --- a/apps/web/src/features/groups/detail/MembersWaitlistSection.tsx +++ b/apps/web/src/features/groups/detail/MembersWaitlistSection.tsx @@ -24,12 +24,14 @@ export function MembersWaitlistSection() { value={searchFilter} onChange={(e) => setSearchFilter(e.target.value)} aria-label="Buscar en el listado" - className="h-10 rounded-lg border-transparent pl-9 shadow-xs placeholder:text-foreground/80" + className="h-11 rounded-lg border-transparent pl-9 shadow-xs placeholder:text-foreground/80" />
-

+ {/* Copia de apoyo: un solo bloque, ancho acotado y sin competir con + los datos. Explica la diferencia entre ambos estados. */} +

{listSection === 'members' ? 'Listado de todos los miembros incorporados al grupo.' : 'Pre-inscripciones que esperan tu aprobación y personas en lista de espera por un cupo libre.'} diff --git a/apps/web/src/features/groups/detail/PendingView.tsx b/apps/web/src/features/groups/detail/PendingView.tsx index e6c123c..adbb80b 100644 --- a/apps/web/src/features/groups/detail/PendingView.tsx +++ b/apps/web/src/features/groups/detail/PendingView.tsx @@ -45,7 +45,7 @@ export function PendingView() { espera aparecerán aquí para que las revises.

- @@ -88,14 +88,18 @@ export function PendingView() { {sections.map((section) => { const Icon = section.icon const hasRows = section.count > 0 + const titleId = `pending-${section.title.replace(/\s+/g, '-').toLowerCase()}` // Con búsqueda activa, las secciones sin coincidencias se ocultan. if (!hasRows && query) return null return ( -
-
- -

+
+
+
{hasRows ? ( -
{section.table}
+
{section.table}
) : ( -

{section.emptyNote}

+

{section.emptyNote}

)}
) diff --git a/apps/web/src/features/groups/detail/PreRegistrationDetailModal.tsx b/apps/web/src/features/groups/detail/PreRegistrationDetailModal.tsx index 7118723..b6b44be 100644 --- a/apps/web/src/features/groups/detail/PreRegistrationDetailModal.tsx +++ b/apps/web/src/features/groups/detail/PreRegistrationDetailModal.tsx @@ -1,5 +1,6 @@ import { Ban, Loader2, Mail, MessageCircle, Phone, UserCheck } from 'lucide-react' import { Button, Modal } from '../../../components/ui' +import { formatPhoneDisplay } from '../../../lib/format' import { DetailRow } from './DetailRow' import { useGroupDetail } from './GroupDetailProvider' @@ -45,7 +46,7 @@ export function PreRegistrationDetailModal() {
} label="Teléfono">
- {selectedPreRegistration.phone} + {formatPhoneDisplay(selectedPreRegistration.phone)}

- - + + {/* En móvil el teléfono manda: la fecha vive en el detalle. */} - - + @@ -22,16 +23,23 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati {entries.map((entry) => ( setSelectedPreRegistration(entry)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + setSelectedPreRegistration(entry) + } + }} > - - - - diff --git a/apps/web/src/features/groups/detail/RemoveAttendeeModal.tsx b/apps/web/src/features/groups/detail/RemoveAttendeeModal.tsx index a196937..2905193 100644 --- a/apps/web/src/features/groups/detail/RemoveAttendeeModal.tsx +++ b/apps/web/src/features/groups/detail/RemoveAttendeeModal.tsx @@ -1,6 +1,7 @@ import type { AttendeeDto, GroupWaitlistEntryDto } from '@gruperly/shared' import { Clock, Loader2, Trash2, UserCheck, UserMinus } from 'lucide-react' import { Button, Modal } from '../../../components/ui' +import { formatPhoneDisplay } from '../../../lib/format' type RemoveAttendeeModalProps = { attendee: AttendeeDto | null @@ -37,7 +38,9 @@ export function RemoveAttendeeModal({ {groupName} {firstWaitlistEntry ? ' y el cupo quedará libre.' : '.'} {attendee.phone ? ( - Teléfono: {attendee.phone} + + Teléfono: {formatPhoneDisplay(attendee.phone)} + ) : null}

diff --git a/apps/web/src/features/groups/detail/SectionChips.tsx b/apps/web/src/features/groups/detail/SectionChips.tsx index 69d56f9..cf9c23d 100644 --- a/apps/web/src/features/groups/detail/SectionChips.tsx +++ b/apps/web/src/features/groups/detail/SectionChips.tsx @@ -45,7 +45,8 @@ export function SectionChips() { aria-pressed={isActive} onClick={() => setListSection(section.id)} className={cn( - 'inline-flex min-h-10 items-center gap-1.5 rounded-full border px-3 text-xs font-semibold', + // min-h-11 (44px): objetivo táctil mínimo de iOS/Android. + 'inline-flex min-h-11 items-center gap-1.5 rounded-full border px-3.5 text-xs font-semibold', 'transition-[background-color,color,border-color,box-shadow] duration-150', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-primary-soft', isActive @@ -63,7 +64,7 @@ export function SectionChips() { ? 'bg-on-accent/25 text-on-accent' : isAttention ? 'bg-warning-soft text-warning' - : 'bg-primary-soft text-foreground/60', + : 'bg-primary-soft text-foreground/70', )} > {count} diff --git a/apps/web/src/features/groups/detail/WaitlistEntryDetailModal.tsx b/apps/web/src/features/groups/detail/WaitlistEntryDetailModal.tsx index 2c651f1..a5ef400 100644 --- a/apps/web/src/features/groups/detail/WaitlistEntryDetailModal.tsx +++ b/apps/web/src/features/groups/detail/WaitlistEntryDetailModal.tsx @@ -1,5 +1,6 @@ import { Loader2, Mail, MessageCircle, Phone, StickyNote, Trash2, UserCheck } from 'lucide-react' import { Button, Modal } from '../../../components/ui' +import { formatPhoneDisplay } from '../../../lib/format' import { DetailRow } from './DetailRow' import { useGroupDetail } from './GroupDetailProvider' @@ -44,7 +45,7 @@ export function WaitlistEntryDetailModal() { } label="Teléfono"> {selectedWaitlistEntry.phone ? (
- - - + + @@ -20,16 +21,23 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] }) {entries.map((entry) => ( setSelectedWaitlistEntry(entry)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + setSelectedWaitlistEntry(entry) + } + }} > - - - diff --git a/apps/web/src/lib/format.ts b/apps/web/src/lib/format.ts index ef264bc..7a903db 100644 --- a/apps/web/src/lib/format.ts +++ b/apps/web/src/lib/format.ts @@ -49,9 +49,83 @@ export function formatSchedule(days: readonly WeekDay[], time: string | null): s return time ? `${dayNames.join(', ')} · ${time}` : dayNames.join(', ') } -export function formatPrice(price: number | null): string { +/* Moneda por defecto de la app (Argentina). Solo define cómo se pinta: el + valor persistido no cambia. La firma acepta la moneda para que el paso a + multi-moneda no obligue a tocar los call sites. */ +export const DEFAULT_CURRENCY = 'ARS' + +export function formatPrice(price: number | null, currency: string = DEFAULT_CURRENCY): string { if (price == null) return '—' - return price.toLocaleString('es-MX', { style: 'currency', currency: 'MXN' }) + // Importes enteros sin decimales ($50.000); con centavos se respetan. + const hasCents = !Number.isInteger(price) + return new Intl.NumberFormat('es-AR', { + style: 'currency', + currency, + minimumFractionDigits: hasCents ? 2 : 0, + maximumFractionDigits: 2, + }) + .format(price) + // es-AR separa el símbolo con un espacio duro (U+00A0): preferimos "$50.000". + .replace(/\u00A0/g, '') +} + +/* Presentación de teléfonos (Argentina). Nunca altera el valor persistido: + es maquillaje de salida, y los links wa.me siguen usando los dígitos crudos. + + Estrategia: se normalizan los prefijos conocidos (0054 / 54 / 0 nacional y + el 9 de móvil argentino). Si el resultado no parece un número plausible + (6 a 10 dígitos nacionales) se devuelve el valor original tal cual: es + preferible un número sin maquillar a uno inventado. */ +export function formatPhoneDisplay(value: string | null | undefined): string | null { + if (value == null) return null + const raw = value.trim() + if (!raw) return null + + let digits = raw.replace(/\D/g, '') + if (digits.length < 6) return raw + + let isAr = false + let isMobile = false + + if (digits.startsWith('0054')) { + digits = digits.slice(4) + isAr = true + } else if (digits.startsWith('54') && digits.length >= 12) { + digits = digits.slice(2) + isAr = true + } + + // Móvil argentino: 9 + 10 dígitos nacionales. + if (digits.length === 11 && digits.startsWith('9')) { + digits = digits.slice(1) + isMobile = true + isAr = true + } + + // 0 de trunk nacional (0 + 10 dígitos; o 0 + 9 tras el 9 de móvil). + if (digits.startsWith('0') && digits.length >= 9) { + digits = digits.slice(1) + isAr = true + } + + if (digits.length < 6 || digits.length > 10) return raw + + const local = groupArNational(digits) + if (!isAr) return local + return isMobile ? `+54 9 ${local}` : `+54 ${local}` +} + +function groupArNational(digits: string): string { + if (digits.length === 10) { + // 11 es el único área de 2 dígitos (Gran Buenos Aires); el resto se + // agrupa 4-2-4, que es el patrón de las áreas de 4 dígitos. + return digits.startsWith('11') + ? `${digits.slice(0, 2)} ${digits.slice(2, 6)}-${digits.slice(6)}` + : `${digits.slice(0, 4)} ${digits.slice(4, 6)}-${digits.slice(6)}` + } + if (digits.length === 9) return `${digits.slice(0, 3)} ${digits.slice(3, 5)}-${digits.slice(5)}` + if (digits.length <= 8) return `${digits.slice(0, 4)} ${digits.slice(4)}` + return digits } // El vencimiento se cuenta como frase ("Vence el día 10 de cada mes") en vez
NombreTeléfono + NombreTeléfono Detalle
-
-
+
+
+
{attendee.fullName.charAt(0).toUpperCase()}
{/* `truncate` solo recorta lo pintado: el texto completo sigue en el DOM para lectores de pantalla, y `title` lo muestra al hover. */} - + {attendee.fullName}
+ {/* El nombre manda; el teléfono es un dato secundario: un nivel + más abajo en la escala de color, en un tamaño menor. */} + {attendee.phone ? ( - {attendee.phone} + {formatPhoneDisplay(attendee.phone)} ) : ( — )} +
NombreTeléfonoNombreTeléfonoSolicitado + Solicitado Detalle
-
-
+
+
+
{entry.fullName.charAt(0).toUpperCase()}
-

+

{entry.fullName}

{entry.email ? ( @@ -42,18 +50,18 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
+ - {entry.phone} + {formatPhoneDisplay(entry.phone)} + {new Date(entry.createdAt).toLocaleDateString('es-ES', { day: 'numeric', month: 'short', })} +
NombreTeléfono + NombreTeléfono Detalle
-
-
+
+
+
{entry.fullName.charAt(0).toUpperCase()}
-

+

{entry.fullName}

{entry.notes ? ( @@ -40,16 +48,16 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
+ {entry.phone ? ( - {entry.phone} + {formatPhoneDisplay(entry.phone)} ) : ( — )} +