feat(api): add timezone support for group fetching and increase page size
feat(attendance): refactor attendance summary logic and update tests feat(analytics): extend GroupRiskSummary schema with absence and attendance counts feat(groups): enhance group schema with attendee and waitlist counts chore(skills): add frontend design skill with guidelines and license feat(attendee-detail): implement AttendeePhoneLine component for phone display feat(groups): create AttendanceBadge and CapacityIndicator components for group cards feat(groups): add card utility functions for attendance alerts and capacity summaries test(groups): implement tests for attendance alert and capacity summary logic
This commit is contained in:
@@ -1,64 +1,37 @@
|
||||
import { Check, Copy, Mail } from 'lucide-react'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { formatPhoneDisplay } from '../../lib/format'
|
||||
import { Mail } from 'lucide-react'
|
||||
import { useAttendeeDetail } from './AttendeeDetailProvider'
|
||||
import { Section } from './Section'
|
||||
import { useCopyToClipboard } from './useCopyToClipboard'
|
||||
|
||||
const ROW_CLASS =
|
||||
'flex w-full min-h-11 items-center justify-between gap-3 rounded-lg py-2.5 transition-colors hover:bg-primary-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent'
|
||||
|
||||
/** Email y notas del miembro. El teléfono no va acá: ya está en el subtítulo y
|
||||
* detrás de los botones de WhatsApp y Llamar, y repetirlo llenaba la pantalla
|
||||
* de un dato que ya estaba a la vista.
|
||||
*
|
||||
* Sin datos no se dibuja la sección: no hay filas con "Sin email"/"Sin notas".
|
||||
* Aparece sola en cuanto el miembro tenga alguno (hoy el email puede llegar al
|
||||
* aprobar una preinscripción; las notas, cuando exista la edición). */
|
||||
export function AttendeeContactSection() {
|
||||
const { attendee } = useAttendeeDetail()
|
||||
const { copied, copy } = useCopyToClipboard()
|
||||
|
||||
if (!attendee) return null
|
||||
|
||||
const phone = attendee.phone
|
||||
const phoneLabel = formatPhoneDisplay(phone)
|
||||
const { email, notes } = attendee
|
||||
// Sin datos no hay sección: no se dibujan filas con "Sin email"/"Sin notas".
|
||||
if (!phoneLabel && !email && !notes) return null
|
||||
if (!email && !notes) return null
|
||||
|
||||
return (
|
||||
<Section title="Contacto">
|
||||
<div className="divide-y divide-border/60">
|
||||
{phone && phoneLabel ? (
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => copy(phone)}
|
||||
className={cn(ROW_CLASS, 'min-w-0 flex-1 text-left')}
|
||||
>
|
||||
<span className="truncate text-base text-primary">{phoneLabel}</span>
|
||||
<span className="flex shrink-0 items-center gap-1.5 text-xs font-medium text-foreground">
|
||||
{copied ? (
|
||||
<Check className="size-4 text-success" aria-hidden="true" />
|
||||
) : (
|
||||
<Copy className="size-4" aria-hidden="true" />
|
||||
)}
|
||||
{copied ? 'Copiado' : 'Copiar'}
|
||||
</span>
|
||||
</button>
|
||||
{/* La confirmación visible no se anuncia sola: va en una región viva
|
||||
aparte para no ensuciar el nombre accesible del botón. */}
|
||||
<span aria-live="polite" className="sr-only">
|
||||
{copied ? 'Teléfono copiado al portapapeles' : ''}
|
||||
</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{email ? (
|
||||
<a href={`mailto:${email}`} className={ROW_CLASS}>
|
||||
<span className="truncate text-base text-primary">{email}</span>
|
||||
<span className="truncate text-sm text-primary">{email}</span>
|
||||
<Mail className="size-4 shrink-0 text-foreground" aria-hidden="true" />
|
||||
</a>
|
||||
) : null}
|
||||
|
||||
{notes ? (
|
||||
<p className="whitespace-pre-line py-2.5 text-sm leading-relaxed text-primary">
|
||||
{notes}
|
||||
</p>
|
||||
<p className="whitespace-pre-line py-2 text-sm leading-relaxed text-primary">{notes}</p>
|
||||
) : null}
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
Reference in New Issue
Block a user