Compare commits
2 Commits
e9b44caf54
...
27bff32e76
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27bff32e76 | ||
|
|
13c1446977 |
@@ -29,6 +29,8 @@ export type ListSection = 'members' | 'pending'
|
|||||||
type GroupDetailContextValue = {
|
type GroupDetailContextValue = {
|
||||||
groupId: string
|
groupId: string
|
||||||
group: GroupDto | undefined
|
group: GroupDto | undefined
|
||||||
|
/** Nombre para el título grande: dato real, caché o "Grupo" mientras carga. */
|
||||||
|
groupTitle: string
|
||||||
groupQueryPending: boolean
|
groupQueryPending: boolean
|
||||||
riskLevel: GroupRiskLevel
|
riskLevel: GroupRiskLevel
|
||||||
attendees: AttendeeDto[]
|
attendees: AttendeeDto[]
|
||||||
@@ -283,9 +285,16 @@ export function GroupDetailProvider({ groupId, children }: { groupId: string; ch
|
|||||||
window.open(whatsappShareUrl, '_blank', 'noopener,noreferrer')
|
window.open(whatsappShareUrl, '_blank', 'noopener,noreferrer')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// El título grande va siempre, incluso cargando: es lo que da altura a la
|
||||||
|
// barra immersive y evita que el layout salte. Al llegar desde la ficha del
|
||||||
|
// grupo el nombre ya está en caché; en la primera carga cae a "Grupo".
|
||||||
|
const cachedGroupName = queryClient.getQueryData<GroupDto>(['group', groupId])?.name
|
||||||
|
const groupTitle = group?.name ?? cachedGroupName ?? 'Grupo'
|
||||||
|
|
||||||
const value: GroupDetailContextValue = {
|
const value: GroupDetailContextValue = {
|
||||||
groupId,
|
groupId,
|
||||||
group,
|
group,
|
||||||
|
groupTitle,
|
||||||
groupQueryPending: groupQuery.isPending,
|
groupQueryPending: groupQuery.isPending,
|
||||||
riskLevel: riskOverviewQuery.data?.items.find((item) => item.groupId === groupId)?.riskLevel ?? 'NONE',
|
riskLevel: riskOverviewQuery.data?.items.find((item) => item.groupId === groupId)?.riskLevel ?? 'NONE',
|
||||||
attendees,
|
attendees,
|
||||||
|
|||||||
@@ -23,31 +23,34 @@ export function GroupDetailView() {
|
|||||||
} = useGroupDetail()
|
} = useGroupDetail()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
if (groupQueryPending) {
|
|
||||||
return (
|
return (
|
||||||
|
<section className="animate-fade-in space-y-5 sm:space-y-6">
|
||||||
|
{/* El título grande va siempre, incluso cargando: es lo que da altura a
|
||||||
|
la barra immersive y evita que el layout salte cuando llegan los datos. */}
|
||||||
|
<GroupHeader />
|
||||||
|
|
||||||
|
{groupQueryPending ? (
|
||||||
<div className="flex items-center justify-center py-20">
|
<div className="flex items-center justify-center py-20">
|
||||||
<Loader2 className="size-8 animate-spin text-accent" />
|
<Loader2 className="size-8 animate-spin text-accent" />
|
||||||
</div>
|
</div>
|
||||||
)
|
) : !group ? (
|
||||||
}
|
|
||||||
|
|
||||||
if (!group) {
|
|
||||||
return (
|
|
||||||
<div className="rounded-xl border border-danger/20 bg-danger-soft p-6 text-danger">
|
<div className="rounded-xl border border-danger/20 bg-danger-soft p-6 text-danger">
|
||||||
<h2 className="text-lg font-semibold">Grupo no encontrado</h2>
|
<h2 className="text-lg font-semibold">Grupo no encontrado</h2>
|
||||||
<p className="mt-2 text-sm">No se pudo cargar la información de este grupo.</p>
|
<p className="mt-2 text-sm">No se pudo cargar la información de este grupo.</p>
|
||||||
<Button variant="outline" className="mt-4" onClick={() => void navigate({ to: '/groups' })}>
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
className="mt-4"
|
||||||
|
onClick={() => void navigate({ to: '/groups' })}
|
||||||
|
>
|
||||||
Volver a Grupos
|
Volver a Grupos
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)
|
) : (
|
||||||
}
|
<>
|
||||||
|
|
||||||
return (
|
|
||||||
<section className="animate-fade-in space-y-5 sm:space-y-6">
|
|
||||||
<GroupHeader />
|
|
||||||
<GroupInfoCard />
|
<GroupInfoCard />
|
||||||
<MembersWaitlistSection />
|
<MembersWaitlistSection />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<InviteLinkModal />
|
<InviteLinkModal />
|
||||||
<RemoveAttendeeModal
|
<RemoveAttendeeModal
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useGroupDetail } from './GroupDetailProvider'
|
|||||||
export function GroupHeader() {
|
export function GroupHeader() {
|
||||||
const {
|
const {
|
||||||
group,
|
group,
|
||||||
|
groupTitle,
|
||||||
groupId,
|
groupId,
|
||||||
riskLevel,
|
riskLevel,
|
||||||
openInviteModal,
|
openInviteModal,
|
||||||
@@ -29,10 +30,14 @@ export function GroupHeader() {
|
|||||||
const isEmptyGroup =
|
const isEmptyGroup =
|
||||||
!listLoading && attendeesTotal === 0 && preRegistrationsTotal === 0 && waitlistTotal === 0
|
!listLoading && attendeesTotal === 0 && preRegistrationsTotal === 0 && waitlistTotal === 0
|
||||||
|
|
||||||
|
// Sin grupo todavía solo se pinta el título: los badges, la descripción y las
|
||||||
|
// acciones necesitan datos, y mostrarlos a medias daría un header parpadeante.
|
||||||
|
const hasGroup = Boolean(group)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<LargeTitle
|
<LargeTitle
|
||||||
title={group?.name ?? ''}
|
title={groupTitle}
|
||||||
leading={
|
leading={
|
||||||
<Link
|
<Link
|
||||||
to="/groups"
|
to="/groups"
|
||||||
@@ -45,6 +50,7 @@ export function GroupHeader() {
|
|||||||
>
|
>
|
||||||
{/* Los estados cuelgan del título y no de la barra: en la barra
|
{/* Los estados cuelgan del título y no de la barra: en la barra
|
||||||
colapsada solo va el nombre, que es lo que se usa para orientarse. */}
|
colapsada solo va el nombre, que es lo que se usa para orientarse. */}
|
||||||
|
{hasGroup ? (
|
||||||
<div className="mt-3 flex flex-wrap items-center gap-2">
|
<div className="mt-3 flex flex-wrap items-center gap-2">
|
||||||
<Badge variant="success" className="gap-1.5 text-[11px]">
|
<Badge variant="success" className="gap-1.5 text-[11px]">
|
||||||
<span className="size-1.5 rounded-full bg-success" aria-hidden="true" />
|
<span className="size-1.5 rounded-full bg-success" aria-hidden="true" />
|
||||||
@@ -70,6 +76,7 @@ export function GroupHeader() {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{group?.description ? (
|
{group?.description ? (
|
||||||
<p className="mt-2 text-pretty text-sm leading-relaxed text-foreground/80">
|
<p className="mt-2 text-pretty text-sm leading-relaxed text-foreground/80">
|
||||||
@@ -78,17 +85,20 @@ export function GroupHeader() {
|
|||||||
) : null}
|
) : null}
|
||||||
</LargeTitle>
|
</LargeTitle>
|
||||||
|
|
||||||
<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">
|
{hasGroup ? (
|
||||||
{/* `h-11` (44px) para todos: objetivo táctil mínimo. */}
|
// Una sola fila en mobile: el primario toma el ancho que sobra y las dos
|
||||||
|
// acciones de apoyo se pliegan a iconos de 44px. En sm+ recuperan el
|
||||||
|
// texto porque hay ancho de sobra y el rótulo hace más claro el destino.
|
||||||
|
<div className="mt-4 flex items-center gap-2.5 sm:mt-5 sm:justify-end">
|
||||||
{!isEmptyGroup ? (
|
{!isEmptyGroup ? (
|
||||||
// Un solo primario por pantalla: "Agregar" encabeza la jerarquía y
|
// Un solo primario por pantalla: "Agregar" encabeza la jerarquía y
|
||||||
// las acciones de apoyo quedan debajo en outline.
|
// las acciones de apoyo quedan al lado, en outline.
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
void navigate({ to: '/groups/$groupId/attendees/new', params: { groupId } })
|
void navigate({ to: '/groups/$groupId/attendees/new', params: { groupId } })
|
||||||
}
|
}
|
||||||
className="col-span-2 h-11 w-full justify-center sm:w-auto"
|
className="h-11 flex-1 justify-center sm:flex-none sm:w-auto"
|
||||||
>
|
>
|
||||||
<UserPlus className="size-4" />
|
<UserPlus className="size-4" />
|
||||||
<span>Agregar miembro</span>
|
<span>Agregar miembro</span>
|
||||||
@@ -97,28 +107,30 @@ export function GroupHeader() {
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => void navigate({ to: '/groups/$groupId/analytics', params: { groupId } })}
|
onClick={() => void navigate({ to: '/groups/$groupId/analytics', params: { groupId } })}
|
||||||
|
aria-label="Estadísticas"
|
||||||
className={cn(
|
className={cn(
|
||||||
'h-11 w-full justify-center border-border sm:w-auto',
|
'h-11 shrink-0 justify-center border-border',
|
||||||
// En grupo vacío es la única acción del header: ocupa la fila entera.
|
// En grupo vacío es la única acción del header: ocupa la fila entera.
|
||||||
isEmptyGroup && 'col-span-2',
|
isEmptyGroup && 'w-full sm:w-auto',
|
||||||
|
!isEmptyGroup && 'w-11 sm:w-auto sm:px-4',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<BarChart3 className="size-4 text-accent" />
|
<BarChart3 className="size-4 text-accent" />
|
||||||
<span>Estadísticas</span>
|
<span className="hidden sm:inline">Estadísticas</span>
|
||||||
</Button>
|
</Button>
|
||||||
{!isEmptyGroup ? (
|
{!isEmptyGroup ? (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={openInviteModal}
|
onClick={openInviteModal}
|
||||||
className="h-11 w-full justify-center border-border sm:w-auto"
|
aria-label="Compartir enlace"
|
||||||
|
className="h-11 w-11 shrink-0 justify-center border-border sm:w-auto sm:px-4"
|
||||||
>
|
>
|
||||||
<Share2 className="size-4 text-accent" />
|
<Share2 className="size-4 text-accent" />
|
||||||
<span>
|
<span className="hidden sm:inline">Compartir</span>
|
||||||
Compartir <span className="hidden sm:inline">Link</span>
|
|
||||||
</span>
|
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CalendarClock, Users } from 'lucide-react'
|
import { CalendarClock, CircleDollarSign, Users } from 'lucide-react'
|
||||||
import {
|
import {
|
||||||
formatBillingMeta,
|
formatBillingMeta,
|
||||||
formatPrice,
|
formatPrice,
|
||||||
@@ -88,9 +88,7 @@ export function GroupInfoCard() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={cn(CELL_CLASS, 'md:pl-6')}>
|
<div className={cn(CELL_CLASS, 'md:pl-6')}>
|
||||||
<div className="mt-0.5 flex size-5 shrink-0 items-center justify-center text-sm font-bold leading-none text-accent">
|
<CircleDollarSign className="mt-0.5 size-5 shrink-0 text-accent" />
|
||||||
$
|
|
||||||
</div>
|
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className={LABEL_CLASS}>Cobro</p>
|
<p className={LABEL_CLASS}>Cobro</p>
|
||||||
<p className="mt-0.5 text-base font-semibold tabular-nums text-primary">
|
<p className="mt-0.5 text-base font-semibold tabular-nums text-primary">
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) {
|
|||||||
return (
|
return (
|
||||||
<table className="w-full table-fixed text-left text-sm">
|
<table className="w-full table-fixed text-left text-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b border-border/70 text-xs font-semibold text-foreground/80">
|
{/* `border-foreground/10` y no `border`: en dark `--border` es igual a
|
||||||
<th scope="col" className="w-[47%] px-2 pb-1.5">Nombre</th>
|
`primary-soft`, el fondo de la fila, y el separador desaparecería. */}
|
||||||
<th scope="col" className="px-2 pb-1.5">Teléfono</th>
|
<tr className="border-b border-foreground/10 text-xs font-semibold text-foreground/80">
|
||||||
|
<th scope="col" className="w-[47%] px-3 pb-1.5">Nombre</th>
|
||||||
|
<th scope="col" className="px-3 pb-1.5">Teléfono</th>
|
||||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||||
<span className="sr-only">Detalle</span>
|
<span className="sr-only">Detalle</span>
|
||||||
</th>
|
</th>
|
||||||
@@ -28,7 +30,8 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) {
|
|||||||
<tr
|
<tr
|
||||||
key={attendee.id}
|
key={attendee.id}
|
||||||
tabIndex={0}
|
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"
|
// El hover va a `surface` porque la fila ya vive sobre `primary-soft`.
|
||||||
|
className="group cursor-pointer border-b border-foreground/10 transition-colors last:border-b-0 hover:bg-surface/60 focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||||
onClick={() => openAttendee(attendee.id)}
|
onClick={() => openAttendee(attendee.id)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
@@ -37,7 +40,9 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<td className="px-2 py-2">
|
{/* `px-3` alinea el texto con el chips y el search de arriba: es el
|
||||||
|
mismo eje izquierdo de 12px en toda la sección. */}
|
||||||
|
<td className="px-3 py-2">
|
||||||
<div className="flex min-w-0 items-center gap-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">
|
<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()}
|
{attendee.fullName.charAt(0).toUpperCase()}
|
||||||
@@ -54,7 +59,7 @@ export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) {
|
|||||||
</td>
|
</td>
|
||||||
{/* El nombre manda; el teléfono es un dato secundario: un nivel
|
{/* 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. */}
|
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">
|
<td className="min-w-0 px-3 py-2 text-xs text-foreground/70">
|
||||||
{attendee.phone ? (
|
{attendee.phone ? (
|
||||||
<span className="block truncate tabular-nums" title={attendee.phone}>
|
<span className="block truncate tabular-nums" title={attendee.phone}>
|
||||||
{formatPhoneDisplay(attendee.phone)}
|
{formatPhoneDisplay(attendee.phone)}
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ export function MembersView() {
|
|||||||
|
|
||||||
if (attendees.length === 0) {
|
if (attendees.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="rounded-lg bg-primary-soft/50 px-4 py-10 text-center">
|
// Full-bleed y sin radio propio: el `overflow-hidden` del panel lo recorta
|
||||||
|
// contra la silueta redondeada. `surface` sobre `primary-soft` hunde el
|
||||||
|
// bloque; con el lavado anterior se camuflaba.
|
||||||
|
<div className="bg-surface px-4 py-10 text-center">
|
||||||
<Users className="mx-auto mb-2 size-10 text-foreground/40" />
|
<Users className="mx-auto mb-2 size-10 text-foreground/40" />
|
||||||
<p className="text-sm font-semibold text-primary">
|
<p className="text-sm font-semibold text-primary">
|
||||||
Todavía no hay miembros en este grupo
|
Todavía no hay miembros en este grupo
|
||||||
@@ -40,7 +43,7 @@ export function MembersView() {
|
|||||||
<div className="mt-4 flex flex-col gap-2.5 sm:flex-row sm:items-center sm:justify-center sm:gap-3">
|
<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="h-11 w-full sm:w-auto">
|
<Button variant="outline" onClick={openInviteModal} className="h-11 w-full sm:w-auto">
|
||||||
<Share2 className="size-4" />
|
<Share2 className="size-4" />
|
||||||
Compartir Enlace
|
Compartir enlace
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
@@ -50,7 +53,7 @@ export function MembersView() {
|
|||||||
className="h-11 w-full sm:w-auto"
|
className="h-11 w-full sm:w-auto"
|
||||||
>
|
>
|
||||||
<Plus className="size-4" />
|
<Plus className="size-4" />
|
||||||
Agregar Miembros
|
Agregar miembros
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,11 +9,15 @@ export function MembersWaitlistSection() {
|
|||||||
const { listSection, searchFilter, setSearchFilter } = useGroupDetail()
|
const { listSection, searchFilter, setSearchFilter } = useGroupDetail()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// Radios concéntricos: `rounded-2xl` (16px) con `p-2` (8px) deja a las
|
// Una sola superficie: la lista va directo sobre el lavado, como la info
|
||||||
// superficies interiores un radio de 16 - 8 = 8px, o sea `rounded-lg`.
|
// card de arriba, en vez de anidarse en una caja más clara. La separación
|
||||||
// Sin bordes: el lavado `bg-primary-soft` separa la sección del fondo.
|
// entre controles y datos la dan los propios divisores de fila, el tono
|
||||||
<div className="rounded-2xl bg-primary-soft p-2">
|
// propio del input y el borde de los chips; una caja intermedia solo
|
||||||
<div className="space-y-2 p-2 sm:p-3">
|
// sumaba un nivel de contención y padding horizontal.
|
||||||
|
// `overflow-hidden` recorta el hover de las filas y el borde inferior
|
||||||
|
// contra el radio del panel: las filas son full-bleed.
|
||||||
|
<div className="overflow-hidden rounded-2xl bg-primary-soft">
|
||||||
|
<div className="space-y-2 p-3">
|
||||||
<div className="flex flex-col gap-2.5 lg:flex-row lg:items-center lg:justify-between">
|
<div className="flex flex-col gap-2.5 lg:flex-row lg:items-center lg:justify-between">
|
||||||
<SectionChips />
|
<SectionChips />
|
||||||
|
|
||||||
@@ -24,23 +28,23 @@ export function MembersWaitlistSection() {
|
|||||||
value={searchFilter}
|
value={searchFilter}
|
||||||
onChange={(e) => setSearchFilter(e.target.value)}
|
onChange={(e) => setSearchFilter(e.target.value)}
|
||||||
aria-label="Buscar en el listado"
|
aria-label="Buscar en el listado"
|
||||||
className="h-11 rounded-lg border-transparent pl-9 shadow-xs placeholder:text-foreground/80"
|
className="h-11 rounded-lg border-transparent pl-9 shadow-xs"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Copia de apoyo: un solo bloque, ancho acotado y sin competir con
|
{/* Solo Pendientes lleva copia de apoyo: explica la diferencia entre
|
||||||
los datos. Explica la diferencia entre ambos estados. */}
|
pre-inscripción y lista de espera, que no se deduce de los nombres.
|
||||||
|
En Miembros los rótulos de columna ya dicen todo. */}
|
||||||
|
{listSection === 'pending' ? (
|
||||||
<p className="max-w-2xl text-xs leading-snug text-foreground/80">
|
<p className="max-w-2xl text-xs leading-snug text-foreground/80">
|
||||||
{listSection === 'members'
|
Pre-inscripciones que esperan tu aprobación y personas en lista de espera por un cupo
|
||||||
? 'Listado de todos los miembros incorporados al grupo.'
|
libre.
|
||||||
: 'Pre-inscripciones que esperan tu aprobación y personas en lista de espera por un cupo libre.'}
|
|
||||||
</p>
|
</p>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded-lg bg-surface p-1 shadow-xs sm:p-2">
|
|
||||||
{listSection === 'members' ? <MembersView /> : <PendingView />}
|
{listSection === 'members' ? <MembersView /> : <PendingView />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ export function PendingView() {
|
|||||||
|
|
||||||
if (!hasAnyEntry && !query) {
|
if (!hasAnyEntry && !query) {
|
||||||
return (
|
return (
|
||||||
<div className="rounded-lg bg-primary-soft/50 px-4 py-10 text-center">
|
// Full-bleed y sin radio propio: el `overflow-hidden` del panel lo recorta
|
||||||
|
// contra la silueta redondeada. `surface` sobre `primary-soft` hunde el
|
||||||
|
// bloque; con el lavado anterior se camuflaba.
|
||||||
|
<div className="bg-surface px-4 py-10 text-center">
|
||||||
<Inbox className="mx-auto mb-2 size-10 text-foreground/40" />
|
<Inbox className="mx-auto mb-2 size-10 text-foreground/40" />
|
||||||
<p className="text-sm font-semibold text-primary">No hay pendientes</p>
|
<p className="text-sm font-semibold text-primary">No hay pendientes</p>
|
||||||
<p className="mx-auto mt-1 max-w-sm text-sm text-foreground/80">
|
<p className="mx-auto mt-1 max-w-sm text-sm text-foreground/80">
|
||||||
@@ -47,7 +50,7 @@ export function PendingView() {
|
|||||||
<div className="mt-4 flex justify-center">
|
<div className="mt-4 flex justify-center">
|
||||||
<Button variant="primary" onClick={openInviteModal} className="h-11 w-full sm:w-auto">
|
<Button variant="primary" onClick={openInviteModal} className="h-11 w-full sm:w-auto">
|
||||||
<Share2 className="size-4" />
|
<Share2 className="size-4" />
|
||||||
Compartir Enlace
|
Compartir enlace
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -94,7 +97,7 @@ export function PendingView() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section key={section.key} aria-labelledby={titleId}>
|
<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">
|
<div className="flex items-center gap-2 border-b border-foreground/10 px-3 pb-1.5 pt-2">
|
||||||
<Icon className="size-4 shrink-0 text-accent" aria-hidden="true" />
|
<Icon className="size-4 shrink-0 text-accent" aria-hidden="true" />
|
||||||
<h3
|
<h3
|
||||||
id={titleId}
|
id={titleId}
|
||||||
@@ -108,7 +111,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',
|
'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
|
section.attention
|
||||||
? 'bg-warning-soft text-warning'
|
? 'bg-warning-soft text-warning'
|
||||||
: 'bg-primary-soft text-foreground/70',
|
: 'bg-surface text-foreground/70',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{section.count}
|
{section.count}
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
|||||||
return (
|
return (
|
||||||
<table className="w-full table-fixed text-left text-sm">
|
<table className="w-full table-fixed text-left text-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b border-border/70 text-xs font-semibold text-foreground/80">
|
{/* `border-foreground/10` y no `border`: en dark `--border` es igual a
|
||||||
<th scope="col" className="w-[47%] px-2 pb-1.5">Nombre</th>
|
`primary-soft`, el fondo de la fila, y el separador desaparecería. */}
|
||||||
<th scope="col" className="px-2 pb-1.5">Teléfono</th>
|
<tr className="border-b border-foreground/10 text-xs font-semibold text-foreground/80">
|
||||||
|
<th scope="col" className="w-[47%] px-3 pb-1.5">Nombre</th>
|
||||||
|
<th scope="col" className="px-3 pb-1.5">Teléfono</th>
|
||||||
{/* En móvil el teléfono manda: la fecha vive en el detalle. */}
|
{/* En móvil el teléfono manda: la fecha vive en el detalle. */}
|
||||||
<th scope="col" className="hidden px-2 pb-1.5 sm:table-cell">Solicitado</th>
|
<th scope="col" className="hidden px-3 pb-1.5 sm:table-cell">Solicitado</th>
|
||||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||||
<span className="sr-only">Detalle</span>
|
<span className="sr-only">Detalle</span>
|
||||||
</th>
|
</th>
|
||||||
@@ -24,7 +26,8 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
|||||||
<tr
|
<tr
|
||||||
key={entry.id}
|
key={entry.id}
|
||||||
tabIndex={0}
|
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"
|
// El hover va a `surface` porque la fila ya vive sobre `primary-soft`.
|
||||||
|
className="group cursor-pointer border-b border-foreground/10 transition-colors last:border-b-0 hover:bg-surface/60 focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||||
onClick={() => setSelectedPreRegistration(entry)}
|
onClick={() => setSelectedPreRegistration(entry)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
@@ -33,7 +36,9 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<td className="px-2 py-2">
|
{/* `px-3` alinea el texto con el chips y el search de arriba: es el
|
||||||
|
mismo eje izquierdo de 12px en toda la sección. */}
|
||||||
|
<td className="px-3 py-2">
|
||||||
<div className="flex min-w-0 items-center gap-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">
|
<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()}
|
{entry.fullName.charAt(0).toUpperCase()}
|
||||||
@@ -50,12 +55,12 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="min-w-0 px-2 py-2 text-xs text-foreground/70">
|
<td className="min-w-0 px-3 py-2 text-xs text-foreground/70">
|
||||||
<span className="block truncate tabular-nums" title={entry.phone}>
|
<span className="block truncate tabular-nums" title={entry.phone}>
|
||||||
{formatPhoneDisplay(entry.phone)}
|
{formatPhoneDisplay(entry.phone)}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="hidden min-w-0 px-2 py-2 text-xs text-foreground/70 sm:table-cell">
|
<td className="hidden min-w-0 px-3 py-2 text-xs text-foreground/70 sm:table-cell">
|
||||||
{new Date(entry.createdAt).toLocaleDateString('es-ES', {
|
{new Date(entry.createdAt).toLocaleDateString('es-ES', {
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
|||||||
return (
|
return (
|
||||||
<table className="w-full table-fixed text-left text-sm">
|
<table className="w-full table-fixed text-left text-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b border-border/70 text-xs font-semibold text-foreground/80">
|
{/* `border-foreground/10` y no `border`: en dark `--border` es igual a
|
||||||
<th scope="col" className="w-[47%] px-2 pb-1.5">Nombre</th>
|
`primary-soft`, el fondo de la fila, y el separador desaparecería. */}
|
||||||
<th scope="col" className="px-2 pb-1.5">Teléfono</th>
|
<tr className="border-b border-foreground/10 text-xs font-semibold text-foreground/80">
|
||||||
|
<th scope="col" className="w-[47%] px-3 pb-1.5">Nombre</th>
|
||||||
|
<th scope="col" className="px-3 pb-1.5">Teléfono</th>
|
||||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||||
<span className="sr-only">Detalle</span>
|
<span className="sr-only">Detalle</span>
|
||||||
</th>
|
</th>
|
||||||
@@ -22,7 +24,8 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
|||||||
<tr
|
<tr
|
||||||
key={entry.id}
|
key={entry.id}
|
||||||
tabIndex={0}
|
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"
|
// El hover va a `surface` porque la fila ya vive sobre `primary-soft`.
|
||||||
|
className="group cursor-pointer border-b border-foreground/10 transition-colors last:border-b-0 hover:bg-surface/60 focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||||
onClick={() => setSelectedWaitlistEntry(entry)}
|
onClick={() => setSelectedWaitlistEntry(entry)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
@@ -31,7 +34,9 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<td className="px-2 py-2">
|
{/* `px-3` alinea el texto con el chips y el search de arriba: es el
|
||||||
|
mismo eje izquierdo de 12px en toda la sección. */}
|
||||||
|
<td className="px-3 py-2">
|
||||||
<div className="flex min-w-0 items-center gap-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">
|
<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()}
|
{entry.fullName.charAt(0).toUpperCase()}
|
||||||
@@ -48,7 +53,7 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="min-w-0 px-2 py-2 text-xs text-foreground/70">
|
<td className="min-w-0 px-3 py-2 text-xs text-foreground/70">
|
||||||
{entry.phone ? (
|
{entry.phone ? (
|
||||||
<span className="block truncate tabular-nums" title={entry.phone}>
|
<span className="block truncate tabular-nums" title={entry.phone}>
|
||||||
{formatPhoneDisplay(entry.phone)}
|
{formatPhoneDisplay(entry.phone)}
|
||||||
|
|||||||
@@ -148,9 +148,26 @@ export function formatPhoneDisplay(
|
|||||||
|
|
||||||
const withCallingCode = formatWithCallingCode(digits)
|
const withCallingCode = formatWithCallingCode(digits)
|
||||||
if (withCallingCode) return withCallingCode
|
if (withCallingCode) return withCallingCode
|
||||||
if (hasPlus || hasDoubleZero) return `+${digits}`
|
// Número de una región que no agrupamos: al menos se separa en bloques de a
|
||||||
|
// 3 para que no se lea como un muro de dígitos. El `+` se conserva si lo había.
|
||||||
|
if (hasPlus || hasDoubleZero) return `+${groupByThrees(digits)}`
|
||||||
|
|
||||||
return formatNational(digits, appRegion(countryOf(locale ?? browserLocale())), false) ?? raw
|
return (
|
||||||
|
formatNational(digits, appRegion(countryOf(locale ?? browserLocale())), false) ??
|
||||||
|
groupByThrees(digits)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bloques de a 3 desde la derecha: el sobrante de 1-2 dígitos queda a la izquierda. */
|
||||||
|
function groupByThrees(digits: string): string {
|
||||||
|
const groups: string[] = []
|
||||||
|
let rest = digits
|
||||||
|
while (rest.length > 3) {
|
||||||
|
groups.unshift(rest.slice(-3))
|
||||||
|
rest = rest.slice(0, -3)
|
||||||
|
}
|
||||||
|
if (rest) groups.unshift(rest)
|
||||||
|
return groups.join(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Prueba el prefijo de país solo si lo que sigue encaja en sus reglas. */
|
/** Prueba el prefijo de país solo si lo que sigue encaja en sus reglas. */
|
||||||
|
|||||||
@@ -258,8 +258,9 @@ describe('formatPhoneDisplay — región del número y país del browser', () =>
|
|||||||
expect(formatPhoneDisplay('2983649550', 'es-AR')).toBe('2983 64-9550')
|
expect(formatPhoneDisplay('2983649550', 'es-AR')).toBe('2983 64-9550')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('número irreconocible se devuelve tal cual', () => {
|
test('número irreconocible se agrupa en bloques de a 3', () => {
|
||||||
expect(formatPhoneDisplay('3209872223344', 'es-AR')).toBe('3209872223344')
|
expect(formatPhoneDisplay('3209872223344', 'es-AR')).toBe('3 209 872 223 344')
|
||||||
|
expect(formatPhoneDisplay('320987223344', 'es-AR')).toBe('320 987 223 344')
|
||||||
expect(formatPhoneDisplay('12345', 'es-AR')).toBe('12345')
|
expect(formatPhoneDisplay('12345', 'es-AR')).toBe('12345')
|
||||||
expect(formatPhoneDisplay(null)).toBeNull()
|
expect(formatPhoneDisplay(null)).toBeNull()
|
||||||
expect(formatPhoneDisplay('')).toBeNull()
|
expect(formatPhoneDisplay('')).toBeNull()
|
||||||
@@ -287,9 +288,9 @@ describe('formatPhoneDisplay — región del número y país del browser', () =>
|
|||||||
expect(formatPhoneDisplay('+5492954667788', 'en-US')).toBe('+54 9 2954 66-7788')
|
expect(formatPhoneDisplay('+5492954667788', 'en-US')).toBe('+54 9 2954 66-7788')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('región sin reglas propias cae a E.164', () => {
|
test('región sin reglas propias conserva el prefijo y agrupa el resto', () => {
|
||||||
expect(formatPhoneDisplay('+331234567890', 'es-AR')).toBe('+331234567890')
|
expect(formatPhoneDisplay('+331234567890', 'es-AR')).toBe('+331 234 567 890')
|
||||||
expect(formatPhoneDisplay('00331234567890', 'es-AR')).toBe('+331234567890')
|
expect(formatPhoneDisplay('00331234567890', 'es-AR')).toBe('+331 234 567 890')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('por defecto usa el país del browser', () => {
|
test('por defecto usa el país del browser', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user