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
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
import { Check } from 'lucide-react'
|
|
import { formatPhoneDisplay } from '../../lib/format'
|
|
import { useAttendeeDetail } from './AttendeeDetailProvider'
|
|
import { useCopyToClipboard } from './useCopyToClipboard'
|
|
|
|
/** Teléfono como segunda línea del subtítulo.
|
|
*
|
|
* Vivía en una sección "Contacto" con una sola fila que repetía el número que
|
|
* ya está a la vista detrás de los botones de WhatsApp y Llamar. Acá acompaña
|
|
* al "Miembro desde…", se copia con un toque y tiene 44px de alto aunque el
|
|
* texto sea de 14px: es un control, no un dato decorativo. */
|
|
export function AttendeePhoneLine() {
|
|
const { attendee } = useAttendeeDetail()
|
|
const { copied, copy } = useCopyToClipboard()
|
|
|
|
const phone = attendee?.phone
|
|
const label = formatPhoneDisplay(phone)
|
|
if (!phone || !label) return null
|
|
|
|
return (
|
|
<>
|
|
<button
|
|
type="button"
|
|
onClick={() => copy(phone)}
|
|
className="flex min-h-11 max-w-fit items-center gap-2 rounded-lg text-left transition-colors hover:bg-primary-soft active:scale-[0.98] motion-reduce:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
|
|
>
|
|
<span className="truncate text-sm text-foreground">{label}</span>
|
|
{/* `aria-hidden`: la confirmación se anuncia desde la región viva de
|
|
abajo, así no se cuela en el nombre del botón. */}
|
|
{copied ? (
|
|
<span
|
|
aria-hidden="true"
|
|
className="flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg"
|
|
>
|
|
<Check className="size-3.5" />
|
|
Número copiado
|
|
</span>
|
|
) : null}
|
|
</button>
|
|
<span aria-live="polite" className="sr-only">
|
|
{copied ? 'Número copiado al portapapeles' : ''}
|
|
</span>
|
|
</>
|
|
)
|
|
}
|