import type { AttentionMember, GroupListItem } from '@gruperly/shared' import { Link } from '@tanstack/react-router' import { cn } from '../../lib/utils' import { AvatarRow } from './AvatarRow' import { groupStatus, type GroupStatus } from './card' const CARD_CLASS_NAME = 'block rounded-2xl border border-border/80 bg-surface px-4 py-4 transition-[border-color,background-color,transform] duration-150 ease-out hover:border-accent/35 focus-visible:ring-2 focus-visible:ring-accent focus-visible:outline-none active:scale-[0.995] motion-reduce:transition-none motion-reduce:active:scale-100 sm:px-5' const STATUS_TONES: Record['tone'], string> = { urgente: 'text-alert-urgent-fg', vigilar: 'text-alert-watch-fg', free: 'text-free-fg', full: 'text-secondary', } type GroupCardProps = { group: GroupListItem /** ACTIVE members with their alerts; `undefined` while they load, `null` * if they could not be loaded (the card keeps the occupancy). */ members: AttentionMember[] | undefined | null } export function GroupCard({ group, members }: GroupCardProps) { const status = members ? groupStatus(members, group.capacity, group.attendeesCount) : null const occupancy = group.capacity === null ? `${group.attendeesCount} ${group.attendeesCount === 1 ? 'alumno' : 'alumnos'}` : `${group.attendeesCount} de ${group.capacity} lugares ocupados` return (

{group.name}

{group.attendeesCount} {group.capacity !== null ? ` / ${group.capacity}` : null}
{members !== null ? (
{members ? ( ) : ( )} {status ? ( {status.text} ) : null}
) : null} ) }