feat: add accessible Tooltip component with hover, focus, and tap support
This commit is contained in:
@@ -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({
|
||||
</div>
|
||||
<div className="flex flex-col items-end gap-1.5">
|
||||
{hasRisk ? (
|
||||
<Badge variant={riskLevel === 'HIGH' ? 'danger' : 'warning'} className="gap-1.5">
|
||||
<span
|
||||
className={cn(
|
||||
'size-2 rounded-full',
|
||||
riskLevel === 'HIGH' ? 'bg-danger' : 'bg-warning',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{RISK_LABELS[riskLevel]}
|
||||
</Badge>
|
||||
// Mismo tooltip que en el detalle: el badge es corto y la
|
||||
// explicación (abandono, no cobranza) la da el tooltip.
|
||||
<Tooltip content={RISK_HINT} tooltipClassName="left-auto right-0">
|
||||
<Badge variant={riskLevel === 'HIGH' ? 'danger' : 'warning'} className="gap-1.5">
|
||||
<span
|
||||
className={cn(
|
||||
'size-2 rounded-full',
|
||||
riskLevel === 'HIGH' ? 'bg-danger' : 'bg-warning',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{RISK_LABELS[riskLevel]}
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
<Badge variant="success">Activo</Badge>
|
||||
</div>
|
||||
|
||||
@@ -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({
|
||||
<div className="min-w-0">
|
||||
<p className="truncate text-sm font-semibold text-primary">{student.fullName}</p>
|
||||
<p className="mt-0.5 text-xs text-foreground/50">
|
||||
{student.phone ?? 'Sin teléfono'} · {student.monthlyAttendanceRate}% de asistencia
|
||||
mensual
|
||||
{student.phone
|
||||
? `${formatPhoneDisplay(student.phone)} · `
|
||||
: 'Sin teléfono · '}
|
||||
{student.monthlyAttendanceRate}% de asistencia mensual
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
@@ -3,4 +3,9 @@ import type { GroupRiskLevel } from '@gruperly/shared'
|
||||
export const RISK_LABELS: Record<Exclude<GroupRiskLevel, 'NONE'>, string> = {
|
||||
HIGH: 'Riesgo alto',
|
||||
MEDIUM: 'Riesgo moderado',
|
||||
}
|
||||
}
|
||||
|
||||
/* 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.'
|
||||
@@ -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() {
|
||||
<DetailRow icon={<Phone className="size-4 text-accent" />} label="Teléfono">
|
||||
{attendee.phone ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-primary">{attendee.phone}</span>
|
||||
<span className="text-primary">{formatPhoneDisplay(attendee.phone)}</span>
|
||||
<a
|
||||
href={`https://wa.me/${attendee.phone.replace(/\D/g, '')}`}
|
||||
target="_blank"
|
||||
@@ -136,7 +137,7 @@ export function AttendeeDetailPage() {
|
||||
{attendee.guardianPhone ? (
|
||||
<DetailRow icon={<Phone className="size-4 text-accent" />} label="Tel. Responsable">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-primary">{attendee.guardianPhone}</span>
|
||||
<span className="text-primary">{formatPhoneDisplay(attendee.guardianPhone)}</span>
|
||||
<a
|
||||
href={`https://wa.me/${attendee.guardianPhone.replace(/\D/g, '')}`}
|
||||
target="_blank"
|
||||
|
||||
@@ -1,15 +1,33 @@
|
||||
import { Link, useNavigate } from '@tanstack/react-router'
|
||||
import { ArrowLeft, BarChart3, Share2, UserPlus } from 'lucide-react'
|
||||
import { Badge, Button } from '../../../components/ui'
|
||||
import { Badge, Button, Tooltip } from '../../../components/ui'
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { RISK_LABELS } from '../constants'
|
||||
import { RISK_HINT, RISK_LABELS } from '../constants'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
|
||||
export function GroupHeader() {
|
||||
const { group, groupId, riskLevel, openInviteModal } = useGroupDetail()
|
||||
const {
|
||||
group,
|
||||
groupId,
|
||||
riskLevel,
|
||||
openInviteModal,
|
||||
attendeesTotal,
|
||||
attendeesPending,
|
||||
preRegistrationsTotal,
|
||||
preRegistrationsPending,
|
||||
waitlistTotal,
|
||||
waitlistPending,
|
||||
} = useGroupDetail()
|
||||
const navigate = useNavigate()
|
||||
const hasRisk = riskLevel === 'HIGH' || riskLevel === 'MEDIUM'
|
||||
|
||||
// Grupo recién creado (sin miembros ni pendientes): los empty states de cada
|
||||
// pestaña ya ofrecen "Compartir" y "Agregar" con su primario explicado, así
|
||||
// que el header no repite las mismas acciones una segunda vez.
|
||||
const listLoading = attendeesPending || preRegistrationsPending || waitlistPending
|
||||
const isEmptyGroup =
|
||||
!listLoading && attendeesTotal === 0 && preRegistrationsTotal === 0 && waitlistTotal === 0
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Link
|
||||
@@ -38,54 +56,67 @@ export function GroupHeader() {
|
||||
Activo
|
||||
</Badge>
|
||||
{hasRisk ? (
|
||||
<Badge
|
||||
variant={riskLevel === 'HIGH' ? 'danger' : 'warning'}
|
||||
className="gap-1.5 text-[11px]"
|
||||
>
|
||||
<span
|
||||
className={cn('size-1.5 rounded-full', riskLevel === 'HIGH' ? 'bg-danger' : 'bg-warning')}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{RISK_LABELS[riskLevel]}
|
||||
</Badge>
|
||||
// El badge no puede llevar texto largo sin ensuciar el header: la
|
||||
// explicación (riesgo de abandono, no de cobranza) vive en el tooltip.
|
||||
<Tooltip content={RISK_HINT}>
|
||||
<Badge
|
||||
variant={riskLevel === 'HIGH' ? 'danger' : 'warning'}
|
||||
className="gap-1.5 text-[11px]"
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'size-1.5 rounded-full',
|
||||
riskLevel === 'HIGH' ? 'bg-danger' : 'bg-warning',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{RISK_LABELS[riskLevel]}
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 grid grid-cols-2 gap-2.5 sm:mt-5 sm:flex sm:flex-wrap sm:items-center sm:justify-end sm:gap-2.5">
|
||||
{/* `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.
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() =>
|
||||
void navigate({ to: '/groups/$groupId/attendees/new', params: { groupId } })
|
||||
}
|
||||
className="col-span-2 h-11 w-full justify-center sm:w-auto"
|
||||
>
|
||||
<UserPlus className="size-4" />
|
||||
<span>Agregar miembro</span>
|
||||
</Button>
|
||||
) : null}
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => void navigate({ to: '/groups/$groupId/analytics', params: { groupId } })}
|
||||
className="w-full justify-center border-border sm:w-auto"
|
||||
className={cn(
|
||||
'h-11 w-full justify-center border-border sm:w-auto',
|
||||
// En grupo vacío es la única acción del header: ocupa la fila entera.
|
||||
isEmptyGroup && 'col-span-2',
|
||||
)}
|
||||
>
|
||||
<BarChart3 className="size-4 text-accent" />
|
||||
<span>Estadísticas</span>
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={openInviteModal}
|
||||
className="w-full justify-center border-border sm:w-auto"
|
||||
>
|
||||
<Share2 className="size-4 text-accent" />
|
||||
<span>
|
||||
Compartir <span className="hidden sm:inline">Link</span>
|
||||
</span>
|
||||
</Button>
|
||||
{/* 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. */}
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
void navigate({ to: '/groups/$groupId/attendees/new', params: { groupId } })
|
||||
}
|
||||
className="col-span-2 w-full justify-center sm:w-auto"
|
||||
>
|
||||
<UserPlus className="size-4 text-accent" />
|
||||
<span>
|
||||
Agregar <span className="hidden sm:inline">Miembros</span>
|
||||
</span>
|
||||
</Button>
|
||||
{!isEmptyGroup ? (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={openInviteModal}
|
||||
className="h-11 w-full justify-center border-border sm:w-auto"
|
||||
>
|
||||
<Share2 className="size-4 text-accent" />
|
||||
<span>
|
||||
Compartir <span className="hidden sm:inline">Link</span>
|
||||
</span>
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -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 (
|
||||
<div className="divide-y divide-border/70 rounded-2xl bg-primary-soft p-4 sm:p-5 md:grid md:grid-cols-3 md:divide-x md:divide-y-0">
|
||||
<div className="divide-y divide-border/70 rounded-2xl bg-primary-soft p-3.5 sm:p-4 md:grid md:grid-cols-3 md:divide-x md:divide-y-0">
|
||||
<div className={cn(CELL_CLASS, 'md:pr-6')}>
|
||||
<CalendarClock className="mt-0.5 size-5 shrink-0 text-accent" />
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className={LABEL_CLASS}>Horario</p>
|
||||
<p className="mt-1 text-base font-semibold leading-snug text-primary">
|
||||
<p className="mt-0.5 text-base font-semibold leading-snug text-primary">
|
||||
{daysLabel || 'Sin horario definido'}
|
||||
</p>
|
||||
{daysLabel && group.time ? (
|
||||
@@ -50,7 +51,7 @@ export function GroupInfoCard() {
|
||||
<Users className="mt-0.5 size-5 shrink-0 text-accent" />
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className={LABEL_CLASS}>Miembros & Cupo</p>
|
||||
<p className="mt-1 flex items-baseline text-2xl font-semibold leading-none tracking-tight tabular-nums text-primary">
|
||||
<p className="mt-0.5 flex items-baseline text-2xl font-semibold leading-none tracking-tight tabular-nums text-primary">
|
||||
<span>{attendeesPending ? '—' : attendeesTotal}</span>
|
||||
{capacity ? (
|
||||
<span className="text-base font-medium text-foreground/70">/{capacity}</span>
|
||||
@@ -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"
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
@@ -78,7 +79,7 @@ export function GroupInfoCard() {
|
||||
) : null}
|
||||
|
||||
{!attendeesPending ? (
|
||||
<p className={cn('mt-1.5 text-sm', isFull ? 'text-warning' : 'text-foreground')}>
|
||||
<p className={cn('mt-1 text-sm', isFull ? 'text-warning' : 'text-foreground')}>
|
||||
{capacityMeta}
|
||||
{waitlistMeta}
|
||||
</p>
|
||||
@@ -92,7 +93,7 @@ export function GroupInfoCard() {
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className={LABEL_CLASS}>Cobro</p>
|
||||
<p className="mt-1 text-base font-semibold tabular-nums text-primary">
|
||||
<p className="mt-0.5 text-base font-semibold tabular-nums text-primary">
|
||||
{group.price != null ? formatPrice(group.price) : 'Sin precio'}
|
||||
</p>
|
||||
{billingMeta && group.price != null ? (
|
||||
|
||||
@@ -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[] }) {
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border/70 text-xs font-semibold text-foreground/80">
|
||||
<th scope="col" className="w-[48%] px-3 pb-2">Nombre</th>
|
||||
<th scope="col" className="px-3 pb-2">Teléfono</th>
|
||||
<th scope="col" className="w-9 px-1 pb-2">
|
||||
<th scope="col" className="w-[47%] px-2 pb-1.5">Nombre</th>
|
||||
<th scope="col" className="px-2 pb-1.5">Teléfono</th>
|
||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||
<span className="sr-only">Detalle</span>
|
||||
</th>
|
||||
</tr>
|
||||
@@ -26,31 +27,43 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) {
|
||||
{attendees.map((attendee) => (
|
||||
<tr
|
||||
key={attendee.id}
|
||||
className="group cursor-pointer border-b border-border/70 transition-colors last:border-b-0 hover:bg-primary-soft/60"
|
||||
tabIndex={0}
|
||||
className="group cursor-pointer border-b border-border/70 transition-colors last:border-b-0 hover:bg-primary-soft/60 focus-visible:bg-primary-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||
onClick={() => openAttendee(attendee.id)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault()
|
||||
openAttendee(attendee.id)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<div className="flex min-w-0 items-center gap-2.5">
|
||||
<div className="flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
<td className="px-2 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
{attendee.fullName.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
{/* `truncate` solo recorta lo pintado: el texto completo sigue en
|
||||
el DOM para lectores de pantalla, y `title` lo muestra al hover. */}
|
||||
<span className="min-w-0 truncate font-medium text-primary" title={attendee.fullName}>
|
||||
<span
|
||||
className="min-w-0 truncate font-semibold text-primary"
|
||||
title={attendee.fullName}
|
||||
>
|
||||
{attendee.fullName}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="min-w-0 px-3 py-2.5 text-foreground/80">
|
||||
{/* 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. */}
|
||||
<td className="min-w-0 px-2 py-2 text-xs text-foreground/70">
|
||||
{attendee.phone ? (
|
||||
<span className="block truncate tabular-nums" title={attendee.phone}>
|
||||
{attendee.phone}
|
||||
{formatPhoneDisplay(attendee.phone)}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-foreground/60">—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="w-9 px-1 py-2.5 text-foreground/50">
|
||||
<td className="w-8 px-1 py-2 text-foreground/50">
|
||||
<ChevronRight className="ml-auto size-4 transition-colors group-hover:text-accent" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -38,7 +38,7 @@ export function MembersView() {
|
||||
masiva.
|
||||
</p>
|
||||
<div className="mt-4 flex flex-col gap-2.5 sm:flex-row sm:items-center sm:justify-center sm:gap-3">
|
||||
<Button variant="outline" onClick={openInviteModal} className="w-full sm:w-auto">
|
||||
<Button variant="outline" onClick={openInviteModal} className="h-11 w-full sm:w-auto">
|
||||
<Share2 className="size-4" />
|
||||
Compartir Enlace
|
||||
</Button>
|
||||
@@ -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"
|
||||
>
|
||||
<Plus className="size-4" />
|
||||
Agregar Miembros
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="text-xs leading-relaxed text-foreground/80">
|
||||
{/* Copia de apoyo: un solo bloque, ancho acotado y sin competir con
|
||||
los datos. Explica la diferencia entre ambos estados. */}
|
||||
<p className="max-w-2xl text-xs leading-snug text-foreground/80">
|
||||
{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.'}
|
||||
|
||||
@@ -45,7 +45,7 @@ export function PendingView() {
|
||||
espera aparecerán aquí para que las revises.
|
||||
</p>
|
||||
<div className="mt-4 flex justify-center">
|
||||
<Button variant="primary" onClick={openInviteModal} className="w-full sm:w-auto">
|
||||
<Button variant="primary" onClick={openInviteModal} className="h-11 w-full sm:w-auto">
|
||||
<Share2 className="size-4" />
|
||||
Compartir Enlace
|
||||
</Button>
|
||||
@@ -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 (
|
||||
<section key={section.key}>
|
||||
<div className="flex items-center gap-2 border-b border-border/70 px-3 pb-2 pt-3">
|
||||
<Icon className="size-4 shrink-0 text-accent" />
|
||||
<h3 className="text-xs font-semibold uppercase tracking-wide text-foreground/70">
|
||||
<section key={section.key} aria-labelledby={titleId}>
|
||||
<div className="flex items-center gap-2 border-b border-border/70 px-3 pb-1.5 pt-2">
|
||||
<Icon className="size-4 shrink-0 text-accent" aria-hidden="true" />
|
||||
<h3
|
||||
id={titleId}
|
||||
className="text-xs font-semibold uppercase tracking-wide text-foreground/70"
|
||||
>
|
||||
{section.title}
|
||||
</h3>
|
||||
{hasRows ? (
|
||||
@@ -104,7 +108,7 @@ export function PendingView() {
|
||||
'ml-auto inline-flex items-center justify-center rounded-full px-1.5 py-0.5 text-[10px] font-bold leading-none tabular-nums',
|
||||
section.attention
|
||||
? 'bg-warning-soft text-warning'
|
||||
: 'bg-primary-soft text-foreground/60',
|
||||
: 'bg-primary-soft text-foreground/70',
|
||||
)}
|
||||
>
|
||||
{section.count}
|
||||
@@ -113,9 +117,9 @@ export function PendingView() {
|
||||
</div>
|
||||
|
||||
{hasRows ? (
|
||||
<div className="pt-1">{section.table}</div>
|
||||
<div className="pt-0.5">{section.table}</div>
|
||||
) : (
|
||||
<p className="px-3 py-3 text-xs text-foreground/70">{section.emptyNote}</p>
|
||||
<p className="px-3 py-2 text-xs text-foreground/70">{section.emptyNote}</p>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
|
||||
@@ -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() {
|
||||
<div className="space-y-1 divide-y divide-border rounded-xl border border-border bg-primary-soft/30">
|
||||
<DetailRow icon={<Phone className="size-4 text-accent" />} label="Teléfono">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-primary">{selectedPreRegistration.phone}</span>
|
||||
<span className="text-primary">{formatPhoneDisplay(selectedPreRegistration.phone)}</span>
|
||||
<a
|
||||
href={`https://wa.me/${selectedPreRegistration.phone.replace(/\D/g, '')}`}
|
||||
target="_blank"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { GroupPreRegistrationDto } from '@gruperly/shared'
|
||||
import { ChevronRight } from 'lucide-react'
|
||||
import { formatPhoneDisplay } from '../../../lib/format'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
|
||||
export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrationDto[] }) {
|
||||
@@ -9,11 +10,11 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border/70 text-xs font-semibold text-foreground/80">
|
||||
<th scope="col" className="w-[46%] px-3 pb-2">Nombre</th>
|
||||
<th scope="col" className="px-3 pb-2">Teléfono</th>
|
||||
<th scope="col" className="w-[47%] px-2 pb-1.5">Nombre</th>
|
||||
<th scope="col" className="px-2 pb-1.5">Teléfono</th>
|
||||
{/* En móvil el teléfono manda: la fecha vive en el detalle. */}
|
||||
<th scope="col" className="hidden px-3 pb-2 sm:table-cell">Solicitado</th>
|
||||
<th scope="col" className="w-9 px-1 pb-2">
|
||||
<th scope="col" className="hidden px-2 pb-1.5 sm:table-cell">Solicitado</th>
|
||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||
<span className="sr-only">Detalle</span>
|
||||
</th>
|
||||
</tr>
|
||||
@@ -22,16 +23,23 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
||||
{entries.map((entry) => (
|
||||
<tr
|
||||
key={entry.id}
|
||||
className="group cursor-pointer border-b border-border/70 transition-colors last:border-b-0 hover:bg-primary-soft/60"
|
||||
tabIndex={0}
|
||||
className="group cursor-pointer border-b border-border/70 transition-colors last:border-b-0 hover:bg-primary-soft/60 focus-visible:bg-primary-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||
onClick={() => setSelectedPreRegistration(entry)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault()
|
||||
setSelectedPreRegistration(entry)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<div className="flex min-w-0 items-center gap-2.5">
|
||||
<div className="flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
<td className="px-2 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
{entry.fullName.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<p className="truncate font-medium text-primary" title={entry.fullName}>
|
||||
<p className="truncate font-semibold text-primary" title={entry.fullName}>
|
||||
{entry.fullName}
|
||||
</p>
|
||||
{entry.email ? (
|
||||
@@ -42,18 +50,18 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="min-w-0 px-3 py-2.5 text-foreground/80">
|
||||
<td className="min-w-0 px-2 py-2 text-xs text-foreground/70">
|
||||
<span className="block truncate tabular-nums" title={entry.phone}>
|
||||
{entry.phone}
|
||||
{formatPhoneDisplay(entry.phone)}
|
||||
</span>
|
||||
</td>
|
||||
<td className="hidden min-w-0 px-3 py-2.5 text-xs text-foreground/70 sm:table-cell">
|
||||
<td className="hidden min-w-0 px-2 py-2 text-xs text-foreground/70 sm:table-cell">
|
||||
{new Date(entry.createdAt).toLocaleDateString('es-ES', {
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
})}
|
||||
</td>
|
||||
<td className="w-9 px-1 py-2.5 text-foreground/50">
|
||||
<td className="w-8 px-1 py-2 text-foreground/50">
|
||||
<ChevronRight className="ml-auto size-4 transition-colors group-hover:text-accent" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -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({
|
||||
<strong className="text-primary">{groupName}</strong>
|
||||
{firstWaitlistEntry ? ' y el cupo quedará libre.' : '.'}
|
||||
{attendee.phone ? (
|
||||
<span className="mt-1 block text-xs text-foreground/50">Teléfono: {attendee.phone}</span>
|
||||
<span className="mt-1 block text-xs text-foreground/50">
|
||||
Teléfono: {formatPhoneDisplay(attendee.phone)}
|
||||
</span>
|
||||
) : null}
|
||||
</p>
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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() {
|
||||
<DetailRow icon={<Phone className="size-4 text-accent" />} label="Teléfono">
|
||||
{selectedWaitlistEntry.phone ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-primary">{selectedWaitlistEntry.phone}</span>
|
||||
<span className="text-primary">{formatPhoneDisplay(selectedWaitlistEntry.phone)}</span>
|
||||
<a
|
||||
href={`https://wa.me/${selectedWaitlistEntry.phone.replace(/\D/g, '')}`}
|
||||
target="_blank"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { GroupWaitlistEntryDto } from '@gruperly/shared'
|
||||
import { ChevronRight } from 'lucide-react'
|
||||
import { formatPhoneDisplay } from '../../../lib/format'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
|
||||
export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] }) {
|
||||
@@ -9,9 +10,9 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border/70 text-xs font-semibold text-foreground/80">
|
||||
<th scope="col" className="w-[48%] px-3 pb-2">Nombre</th>
|
||||
<th scope="col" className="px-3 pb-2">Teléfono</th>
|
||||
<th scope="col" className="w-9 px-1 pb-2">
|
||||
<th scope="col" className="w-[47%] px-2 pb-1.5">Nombre</th>
|
||||
<th scope="col" className="px-2 pb-1.5">Teléfono</th>
|
||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||
<span className="sr-only">Detalle</span>
|
||||
</th>
|
||||
</tr>
|
||||
@@ -20,16 +21,23 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
||||
{entries.map((entry) => (
|
||||
<tr
|
||||
key={entry.id}
|
||||
className="group cursor-pointer border-b border-border/70 transition-colors last:border-b-0 hover:bg-primary-soft/60"
|
||||
tabIndex={0}
|
||||
className="group cursor-pointer border-b border-border/70 transition-colors last:border-b-0 hover:bg-primary-soft/60 focus-visible:bg-primary-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||
onClick={() => setSelectedWaitlistEntry(entry)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault()
|
||||
setSelectedWaitlistEntry(entry)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<div className="flex min-w-0 items-center gap-2.5">
|
||||
<div className="flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
<td className="px-2 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
{entry.fullName.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<p className="truncate font-medium text-primary" title={entry.fullName}>
|
||||
<p className="truncate font-semibold text-primary" title={entry.fullName}>
|
||||
{entry.fullName}
|
||||
</p>
|
||||
{entry.notes ? (
|
||||
@@ -40,16 +48,16 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="min-w-0 px-3 py-2.5 text-foreground/80">
|
||||
<td className="min-w-0 px-2 py-2 text-xs text-foreground/70">
|
||||
{entry.phone ? (
|
||||
<span className="block truncate tabular-nums" title={entry.phone}>
|
||||
{entry.phone}
|
||||
{formatPhoneDisplay(entry.phone)}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-foreground/60">—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="w-9 px-1 py-2.5 text-foreground/50">
|
||||
<td className="w-8 px-1 py-2 text-foreground/50">
|
||||
<ChevronRight className="ml-auto size-4 transition-colors group-hover:text-accent" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user