Files
gruperly/apps/web/src/features/groups/detail/MembersTable.tsx
Jose Selesan 02af5e3c11 feat: add attendee detail and stats features
- Implemented API endpoints to fetch attendee details and statistics.
- Created new route for fetching attendee by ID and their attendance stats.
- Added schemas for attendee statistics.
- Developed frontend components to display attendee details and attendance statistics.
- Integrated attendee detail provider to manage state and data fetching.
- Added tests for attendee retrieval and statistics calculation.
2026-09-28 16:16:21 -03:00

51 lines
2.0 KiB
TypeScript

import type { AttendeeDto } from '@gruperly/shared'
import { useNavigate } from '@tanstack/react-router'
import { ChevronRight } from 'lucide-react'
import { useGroupDetail } from './GroupDetailProvider'
export function MembersTable({ attendees }: { attendees: AttendeeDto[] }) {
const { groupId } = useGroupDetail()
const navigate = useNavigate()
const openAttendee = (attendeeId: string) => {
void navigate({ to: '/groups/$groupId/attendees/$attendeeId', params: { groupId, attendeeId } })
}
return (
<div className="overflow-x-auto">
<table className="w-full text-left text-sm">
<thead className="border-b border-border text-xs font-semibold uppercase text-foreground/60">
<tr>
<th className="px-3 pb-3">Nombre</th>
<th className="px-3 pb-3">Teléfono</th>
<th className="w-8 px-3 pb-3" />
</tr>
</thead>
<tbody className="divide-y divide-border">
{attendees.map((attendee) => (
<tr
key={attendee.id}
className="cursor-pointer transition-colors hover:bg-primary-soft/50"
onClick={() => openAttendee(attendee.id)}
>
<td className="px-3 py-3">
<div className="flex items-center gap-2.5">
<div className="flex size-8 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
{attendee.fullName.charAt(0).toUpperCase()}
</div>
<span className="font-medium text-primary">{attendee.fullName}</span>
</div>
</td>
<td className="px-3 py-3 text-foreground/70">
{attendee.phone || <span className="text-foreground/40">—</span>}
</td>
<td className="px-1 py-3 text-foreground/30">
<ChevronRight className="size-4" />
</td>
</tr>
))}
</tbody>
</table>
</div>
)
}