@@ -10,6 +10,7 @@ import { BigMath } from '~/utils/numbers';
1010import { EntityAvatar } from '../ui/avatar' ;
1111import { CurrencyInput } from '../ui/currency-input' ;
1212import { AppDrawer } from '../ui/drawer' ;
13+ import { useSession } from 'next-auth/react' ;
1314
1415export const GroupSettleUp : React . FC < {
1516 amount : bigint ;
@@ -19,6 +20,7 @@ export const GroupSettleUp: React.FC<{
1920 children : ReactNode ;
2021 groupId : number ;
2122} > = ( { amount : _amount , currency, friend, user, children, groupId } ) => {
23+ const { data } = useSession ( ) ;
2224 const { displayName, t, getCurrencyHelpersCached } = useTranslationWithUtils ( ) ;
2325 const [ amount , setAmount ] = useState < bigint > ( BigMath . abs ( _amount ) ) ;
2426 const [ amountStr , setAmountStr ] = useState ( getCurrencyHelpersCached ( currency ) . toUIString ( amount ) ) ;
@@ -38,8 +40,8 @@ export const GroupSettleUp: React.FC<{
3840 const addExpenseMutation = api . expense . addOrEditExpense . useMutation ( ) ;
3941 const utils = api . useUtils ( ) ;
4042
41- const sender = 0 > amount ? user : friend ;
42- const receiver = 0 > amount ? friend : user ;
43+ const sender = 0 > _amount ? user : friend ;
44+ const receiver = 0 > _amount ? friend : user ;
4345
4446 const saveExpense = React . useCallback ( ( ) => {
4547 if ( ! amount ) {
@@ -97,7 +99,9 @@ export const GroupSettleUp: React.FC<{
9799 < EntityAvatar entity = { receiver } />
98100 </ div >
99101 < p className = "mt-2 text-center text-sm text-gray-400" >
100- { displayName ( sender ) } { t ( 'ui.expense.user.pay' ) } { displayName ( receiver ) }
102+ { displayName ( sender , data ?. user . id ) } { ' ' }
103+ { t ( `ui.expense.${ sender . id === data ?. user . id ? 'you' : 'user' } .pay` ) } { ' ' }
104+ { displayName ( receiver , data ?. user . id ) }
101105 </ p >
102106 </ div >
103107 < CurrencyInput
0 commit comments