feat(attendee-detail): enhance attendee detail view with payment and notes sections
- 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.
This commit is contained in:
@@ -1,42 +1,67 @@
|
||||
import { MessageCircle, Phone } from 'lucide-react'
|
||||
import { formatPhoneDisplay } from '../../lib/format'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { ACTION_BUTTON_CLASS } from './actionButton'
|
||||
import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
|
||||
import { useAttendeeDetail } from './AttendeeDetailProvider'
|
||||
|
||||
export function AttendeeContactActions() {
|
||||
const { attendee } = useAttendeeDetail()
|
||||
|
||||
const phone = attendee?.phone
|
||||
if (!phone) return null
|
||||
|
||||
// The links use the raw digits: wa.me and tel: do not understand formats.
|
||||
const digits = phone.replace(/\D/g, '')
|
||||
const label = formatPhoneDisplay(phone) ?? phone
|
||||
const digits = phone?.replace(/\D/g, '') ?? ''
|
||||
const label = formatPhoneDisplay(phone) ?? attendee?.fullName ?? 'el miembro'
|
||||
|
||||
return (
|
||||
<div className="flex gap-2.5">
|
||||
{/* The icons go with `accent-fg` and not with `accent`: the `accent` blue is
|
||||
the same in both themes and on dark `primary-soft` it sits at 2.2:1.
|
||||
`accent-fg` gives 6.2:1 in light and 7.1:1 in dark. */}
|
||||
<a
|
||||
href={`https://wa.me/${digits}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`Abrir WhatsApp con ${label}`}
|
||||
className={cn(ACTION_BUTTON_CLASS, 'flex-1')}
|
||||
>
|
||||
<MessageCircle className="size-4 text-accent-fg" aria-hidden="true" />
|
||||
WhatsApp
|
||||
</a>
|
||||
<a
|
||||
href={`tel:${digits}`}
|
||||
aria-label={`Llamar a ${label}`}
|
||||
className={cn(ACTION_BUTTON_CLASS, 'flex-1')}
|
||||
>
|
||||
<Phone className="size-4 text-accent-fg" aria-hidden="true" />
|
||||
Llamar
|
||||
</a>
|
||||
<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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user