mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-06 12:36:11 +01:00
* feat: initialise a new totals tab with basic UI * fix: update group tabs and add stats page * fix: styling within the new elements * Prettier * Display active user expenses only if active user is set --------- Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
'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 { getGroup, getGroupExpenses } from '@/lib/api'
|
|
import { useActiveUser } from '@/lib/hooks'
|
|
|
|
export function Totals({
|
|
group,
|
|
expenses,
|
|
totalGroupSpendings,
|
|
}: {
|
|
group: NonNullable<Awaited<ReturnType<typeof getGroup>>>
|
|
expenses: NonNullable<Awaited<ReturnType<typeof getGroupExpenses>>>
|
|
totalGroupSpendings: number
|
|
}) {
|
|
const activeUser = useActiveUser(group.id)
|
|
console.log('activeUser', activeUser)
|
|
|
|
return (
|
|
<>
|
|
<TotalsGroupSpending
|
|
totalGroupSpendings={totalGroupSpendings}
|
|
currency={group.currency}
|
|
/>
|
|
{activeUser && activeUser !== 'None' && (
|
|
<>
|
|
<TotalsYourSpendings group={group} expenses={expenses} />
|
|
<TotalsYourShare group={group} expenses={expenses} />
|
|
</>
|
|
)}
|
|
</>
|
|
)
|
|
}
|