'use client' import { TotalsGroupSpending } from '@/app/groups/[groupId]/stats/totals-group-spending' import { TotalsYourShare } from '@/app/groups/[groupId]/stats/totals-your-share' import { TotalsYourSpendings } from '@/app/groups/[groupId]/stats/totals-your-spending' import { Skeleton } from '@/components/ui/skeleton' import { useActiveUser } from '@/lib/hooks' import { trpc } from '@/trpc/client' export function Totals({ groupId }: { groupId: string }) { const activeUser = useActiveUser(groupId) const participantId = activeUser && activeUser !== 'None' ? activeUser : undefined const { data } = trpc.groups.stats.get.useQuery({ groupId, participantId }) const { data: groupData } = trpc.groups.get.useQuery({ groupId }) if (!data || !groupData) return (
{[0, 1, 2].map((index) => (
))}
) const { totalGroupSpendings, totalParticipantShare, totalParticipantSpendings, } = data const { group } = groupData return ( <> {participantId && ( <> )} ) }