import type { AttendeeListItem, AttendanceStatus } from '@gruperly/shared' import { Link } from '@tanstack/react-router' import { Check } from 'lucide-react' import { cn } from '../../../lib/utils' import { dotClass, statusLabel } from '../analytics/format' import { useGroupDetail } from './GroupDetailProvider' import { type PaymentState, paymentStateLabel, resolvePaymentState, summarizeAttendance, } from './member-row' /* Only the exceptional is painted. "Ok" stays in the base tone and with a check so the state reads without depending on color; overdue is the only one that gains weight. */ const PAYMENT_TONE: Record = { settled: 'text-foreground', dueSoon: 'font-medium text-warning', overdue: 'font-semibold text-danger', } function PaymentLabel({ state }: { state: PaymentState }) { return ( {state.kind === 'settled' ? ( ) } function AttendanceStrip({ recent }: { recent: AttendanceStatus[] }) { const summary = summarizeAttendance(recent) if (summary.recorded === 0) { return

{summary.label}

} return (
{/* Every dot carries its own accessible name: color is only the visual reinforcement, not the only way to know what happened. */} {summary.dots.map((status, index) => ( ))} {summary.label}
) } function MemberRow({ attendee, groupId, }: { attendee: AttendeeListItem groupId: string }) { const paymentState = resolvePaymentState(attendee.payment) return ( , and it also serves the real // href when opened in another tab. className={cn( 'flex min-h-14 items-center border-b border-foreground/10 px-3 py-2.5', 'transition-colors duration-150 hover:bg-surface/60 active:bg-surface', 'focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent', )} >
{attendee.fullName} {paymentState ? : null}
) } export function MembersList({ attendees }: { attendees: AttendeeListItem[] }) { // groupId is read once and passed down: subscribing every row to the whole // context makes a provider state change re-render N rows for no reason. const { groupId } = useGroupDetail() return ( ) }