mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-09 13:49:04 +01:00
Fix balances display
This commit is contained in:
@@ -40,6 +40,7 @@ export function BalancesList({ balances, participants, currency }: Props) {
|
|||||||
<div className="absolute inset-0 p-2 z-20">
|
<div className="absolute inset-0 p-2 z-20">
|
||||||
{currency} {(balances[participant.id]?.total ?? 0).toFixed(2)}
|
{currency} {(balances[participant.id]?.total ?? 0).toFixed(2)}
|
||||||
</div>
|
</div>
|
||||||
|
{balances[participant.id]?.total !== 0 && (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'absolute top-1 h-7 z-10',
|
'absolute top-1 h-7 z-10',
|
||||||
@@ -55,6 +56,7 @@ export function BalancesList({ balances, participants, currency }: Props) {
|
|||||||
'%',
|
'%',
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ function divide(total: number, count: number, isLast: boolean): number {
|
|||||||
export function getSuggestedReimbursements(
|
export function getSuggestedReimbursements(
|
||||||
balances: Balances,
|
balances: Balances,
|
||||||
): Reimbursement[] {
|
): Reimbursement[] {
|
||||||
const balancesArray = Object.entries(balances).map(
|
const balancesArray = Object.entries(balances)
|
||||||
([participantId, { total }]) => ({ participantId, total }),
|
.map(([participantId, { total }]) => ({ participantId, total }))
|
||||||
)
|
.filter((b) => b.total !== 0)
|
||||||
balancesArray.sort((b1, b2) => b2.total - b1.total)
|
balancesArray.sort((b1, b2) => b2.total - b1.total)
|
||||||
const reimbursements: Reimbursement[] = []
|
const reimbursements: Reimbursement[] = []
|
||||||
while (balancesArray.length > 1) {
|
while (balancesArray.length > 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user