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,9 +1,9 @@
|
||||
import { useId, useState } from 'react'
|
||||
import { Check, ChevronDown, Copy, MessageCircle } from 'lucide-react'
|
||||
import { Check, Copy, MessageCircle } from 'lucide-react'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { useAttendeeDetail } from './AttendeeDetailProvider'
|
||||
import { ACTION_BUTTON_CLASS } from './actionButton'
|
||||
import { SECTION_TITLE_CLASS, Section } from './Section'
|
||||
import { ACTION_BUTTON_CLASS, PRIMARY_ACTION_CLASS } from './actionButton'
|
||||
import { Section } from './Section'
|
||||
import { useCopyToClipboard } from './useCopyToClipboard'
|
||||
|
||||
export function AbsenceLinkSection() {
|
||||
@@ -25,66 +25,52 @@ export function AbsenceLinkSection() {
|
||||
|
||||
return (
|
||||
<Section
|
||||
title={
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsOpen((value) => !value)}
|
||||
aria-expanded={isOpen}
|
||||
aria-controls={panelId}
|
||||
className={cn(
|
||||
SECTION_TITLE_CLASS,
|
||||
'flex min-h-11 w-full items-center gap-1.5 text-left',
|
||||
)}
|
||||
>
|
||||
Link de ausencias
|
||||
<ChevronDown
|
||||
className={cn('size-4 transition-transform', isOpen && 'rotate-180')}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</button>
|
||||
}
|
||||
title="Link de ausencias"
|
||||
toggle={{ isOpen, panelId, onToggle: () => setIsOpen((value) => !value) }}
|
||||
>
|
||||
{/* El panel queda en el DOM pero oculto: `aria-controls` siempre resuelve y
|
||||
el texto de "Link copiado" no se pierde al plegar y desplegar. */}
|
||||
<div id={panelId} hidden={!isOpen}>
|
||||
<div className="pt-1">
|
||||
<p className="text-sm text-foreground">
|
||||
Mandales este link para que avisen cuando no puedan venir.
|
||||
</p>
|
||||
<div className="mt-2.5 flex flex-col gap-2 sm:flex-row">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => copy(url)}
|
||||
className={cn(ACTION_BUTTON_CLASS, 'flex-1')}
|
||||
>
|
||||
<Copy className="size-4" aria-hidden="true" />
|
||||
Copiar link
|
||||
</button>
|
||||
{shareUrl ? (
|
||||
<a
|
||||
href={shareUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`Enviar el link por WhatsApp a ${attendee.fullName}`}
|
||||
className={cn(ACTION_BUTTON_CLASS, 'flex-1')}
|
||||
>
|
||||
<MessageCircle className="size-4" aria-hidden="true" />
|
||||
Enviar por WhatsApp
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
<p
|
||||
aria-live="polite"
|
||||
className="flex min-h-5 items-center gap-1.5 pt-2 text-xs font-medium text-success"
|
||||
<p className="text-sm text-foreground">
|
||||
Mandales este link para que avisen cuando no puedan venir.
|
||||
</p>
|
||||
{/* Apiladas y a ancho completo: al 50% los rótulos ("Enviar por WhatsApp")
|
||||
se partían en dos líneas y quedaban por debajo del mínimo táctil.
|
||||
Copiar queda arriba, pegado a su confirmación, y la acción principal
|
||||
se distingue por el relleno de acento. */}
|
||||
<div className="mt-2.5 flex flex-col gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => copy(url)}
|
||||
className={cn(ACTION_BUTTON_CLASS, 'w-full')}
|
||||
>
|
||||
{copied ? (
|
||||
<>
|
||||
<Check className="size-3.5" aria-hidden="true" />
|
||||
Link copiado
|
||||
</>
|
||||
) : null}
|
||||
</p>
|
||||
<Copy className="size-4" aria-hidden="true" />
|
||||
Copiar link
|
||||
</button>
|
||||
{shareUrl ? (
|
||||
<a
|
||||
href={shareUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`Enviar el link por WhatsApp a ${attendee.fullName}`}
|
||||
className={PRIMARY_ACTION_CLASS}
|
||||
>
|
||||
<MessageCircle className="size-4" aria-hidden="true" />
|
||||
Enviar por WhatsApp
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
<p
|
||||
aria-live="polite"
|
||||
className="flex min-h-5 items-center gap-1.5 pt-2 text-xs font-medium text-success"
|
||||
>
|
||||
{copied ? (
|
||||
<>
|
||||
<Check className="size-3.5" aria-hidden="true" />
|
||||
Link copiado
|
||||
</>
|
||||
) : null}
|
||||
</p>
|
||||
</div>
|
||||
</Section>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user