import { useQuery } from '@tanstack/react-query' import { useNavigate } from '@tanstack/react-router' import { CalendarPlus, Loader2, Plus } from 'lucide-react' import { Button } from '../../components/ui' import { getGroups } from '../../lib/api' import { flaggedStudents } from '../attention/attention' import { attentionQueryOptions } from '../attention/queries' import { AttentionPreview } from './AttentionPreview' import { GroupCard } from './GroupCard' import { groupsSummary, membersOf } from './card' import { NewGroupFab } from './NewGroupFab' export function GroupsView() { const navigate = useNavigate() const groupsQuery = useQuery({ queryKey: ['groups'], queryFn: getGroups, }) const attentionQuery = useQuery(attentionQueryOptions) const groups = groupsQuery.data?.data ?? [] const hasGroups = groupsQuery.isSuccess && groups.length > 0 return ( // The FAB floats over the last card: 88px of room so it can be read.

Grupos

{hasGroups ?

{groupsSummary(groups)}

: null} {groupsQuery.isPending ? (
) : null} {groupsQuery.isError ? (

No pudimos cargar tus grupos.

) : null} {groupsQuery.isSuccess && groups.length === 0 ? ( /* A single icon, one focal point, and the text in secondary: the empty state competes with the action and must not win. */

Todavía no tenés grupos

Creá tu primer grupo y empezá a cobrar las cuotas de tus alumnos.

) : null} {hasGroups ? ( <>

Mis grupos

{groups.map((group) => ( ))}
) : null}
) }