- Added payment presentation logic to display payment status and due dates. - Introduced AttendeeNotesSection and AttendeePaymentsSection components for managing notes and payments. - Implemented forms for editing contact information and notes with validation. - Updated API to support attendee updates and added corresponding tests. - Improved attendance summary logic to reflect all visible sessions. - Enhanced UI with loading states and error handling for better user experience.
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
import { MessageCircle, Phone } from 'lucide-react'
|
|
import { formatPhoneDisplay } from '../../lib/format'
|
|
import { cn } from '../../lib/utils'
|
|
import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
|
|
import { useAttendeeDetail } from './AttendeeDetailProvider'
|
|
|
|
export function AttendeeContactActions() {
|
|
const { attendee } = useAttendeeDetail()
|
|
|
|
const phone = attendee?.phone
|
|
const digits = phone?.replace(/\D/g, '') ?? ''
|
|
const label = formatPhoneDisplay(phone) ?? attendee?.fullName ?? 'el miembro'
|
|
|
|
return (
|
|
<div>
|
|
<div className="grid grid-cols-[1.4fr_1fr] gap-2.5">
|
|
{phone ? (
|
|
<a
|
|
href={`https://wa.me/${digits}`}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
aria-label={`Abrir WhatsApp con ${label}`}
|
|
className={PRIMARY_ACTION_CLASS}
|
|
>
|
|
<MessageCircle className="size-4" aria-hidden="true" />
|
|
WhatsApp
|
|
</a>
|
|
) : (
|
|
<button
|
|
type="button"
|
|
disabled
|
|
aria-describedby="missing-phone-feedback"
|
|
className={cn(PRIMARY_ACTION_CLASS, 'cursor-not-allowed opacity-45')}
|
|
>
|
|
<MessageCircle className="size-4" aria-hidden="true" />
|
|
WhatsApp
|
|
</button>
|
|
)}
|
|
{phone ? (
|
|
<a
|
|
href={`tel:${digits}`}
|
|
aria-label={`Llamar a ${label}`}
|
|
className={cn(ACTION_BUTTON_CLASS, 'w-full')}
|
|
>
|
|
<Phone className="size-4 text-accent-fg" aria-hidden="true" />
|
|
Llamar
|
|
</a>
|
|
) : (
|
|
<button
|
|
type="button"
|
|
disabled
|
|
aria-describedby="missing-phone-feedback"
|
|
className={cn(ACTION_BUTTON_CLASS, 'w-full cursor-not-allowed opacity-45')}
|
|
>
|
|
<Phone className="size-4 text-secondary" aria-hidden="true" />
|
|
Llamar
|
|
</button>
|
|
)}
|
|
</div>
|
|
{!phone ? (
|
|
<p id="missing-phone-feedback" className="mt-2 text-xs text-secondary">
|
|
Agregá un teléfono para usar estas acciones
|
|
</p>
|
|
) : null}
|
|
</div>
|
|
)
|
|
}
|