refactor: remove unused attendee detail components and provider
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import { Check, Copy, Mail } from 'lucide-react'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { formatPhoneDisplay } from '../../lib/format'
|
||||
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'
|
||||
|
||||
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
|
||||
|
||||
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>
|
||||
<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>
|
||||
) : null}
|
||||
</div>
|
||||
</Section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user