1111 <template v-if =" isGiftCard && shouldShowExchangeRate " >
1212 <div class =" flex items-center justify-between" >
1313 <span class =" text-primary" >{{ formatMessage(messages.feeBreakdownGiftCardValue) }}</span >
14- <span class =" font-semibold text-contrast"
15- >{{ formatMoney(amount || 0) }} ({{ formattedLocalCurrency }})</span
16- >
14+ <span class =" font-semibold text-contrast" >{{ formatMoney(amountInUsd) }} ({{ formattedLocalCurrencyAmount }})</span >
1715 </div >
1816 </template >
1917 <template v-else >
2018 <div class =" flex items-center justify-between" >
2119 <span class =" text-primary" >{{ formatMessage(messages.feeBreakdownAmount) }}</span >
22- <span class =" font-semibold text-contrast" >{{ formatMoney(amount || 0 ) }}</span >
20+ <span class =" font-semibold text-contrast" >{{ formatMoney(amountInUsd ) }}</span >
2321 </div >
2422 </template >
2523
2927 <template v-if =" feeLoading " >
3028 <LoaderCircleIcon class =" size-5 animate-spin !text-secondary" />
3129 </template >
32- <template v-else >-{{ formatMoney(fee || 0 ) }}</template >
30+ <template v-else >-{{ formatMoney(feeInUsd ) }}</template >
3331 </span >
3432 </div >
3533
@@ -79,9 +77,23 @@ const props = withDefaults(
7977
8078const { formatMessage } = useVIntl ()
8179
80+ const amountInUsd = computed (() => {
81+ if (props .isGiftCard && shouldShowExchangeRate .value ) {
82+ return (props .amount || 0 ) / (props .exchangeRate || 1 )
83+ }
84+ return props .amount || 0
85+ })
86+
87+ const feeInUsd = computed (() => {
88+ if (props .isGiftCard && shouldShowExchangeRate .value ) {
89+ return (props .fee || 0 ) / (props .exchangeRate || 1 )
90+ }
91+ return props .fee || 0
92+ })
93+
8294const netAmount = computed (() => {
83- const amount = props . amount || 0
84- const fee = props . fee || 0
95+ const amount = amountInUsd . value
96+ const fee = feeInUsd . value
8597 return Math .max (0 , amount - fee )
8698})
8799
@@ -96,6 +108,11 @@ const netAmountInLocalCurrency = computed(() => {
96108 return netAmount .value * (props .exchangeRate || 0 )
97109})
98110
111+ const localCurrencyAmount = computed (() => {
112+ if (! shouldShowExchangeRate .value ) return null
113+ return (props .amount || 0 )
114+ })
115+
99116const formattedLocalCurrency = computed (() => {
100117 if (! shouldShowExchangeRate .value || ! netAmountInLocalCurrency .value || ! props .localCurrency )
101118 return ' '
@@ -112,6 +129,22 @@ const formattedLocalCurrency = computed(() => {
112129 }
113130})
114131
132+ const formattedLocalCurrencyAmount = computed (() => {
133+ if (! shouldShowExchangeRate .value || ! localCurrencyAmount .value || ! props .localCurrency )
134+ return ' '
135+
136+ try {
137+ return new Intl .NumberFormat (' en-US' , {
138+ style: ' currency' ,
139+ currency: props .localCurrency ,
140+ minimumFractionDigits: 2 ,
141+ maximumFractionDigits: 2 ,
142+ }).format (localCurrencyAmount .value )
143+ } catch {
144+ return ` ${props .localCurrency } ${localCurrencyAmount .value .toFixed (2 )} `
145+ }
146+ })
147+
115148const messages = defineMessages ({
116149 feeBreakdownAmount: {
117150 id: ' dashboard.creator-withdraw-modal.fee-breakdown-amount' ,
0 commit comments