File tree 3 files changed +14
-3
lines changed
apps/dashboard/src/components/pay/PayAnalytics/components 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,13 @@ export function PayNewCustomers(props: {
49
49
}
50
50
const lastPeriod = newUsersData [ newUsersData . length - 2 ] ;
51
51
const currentPeriod = newUsersData [ newUsersData . length - 1 ] ;
52
+ // Calculate the percent change from last period to current period
52
53
const trend =
53
54
lastPeriod && currentPeriod && lastPeriod . value > 0
54
55
? ( currentPeriod . value - lastPeriod . value ) / lastPeriod . value
55
- : 0 ;
56
+ : lastPeriod ?. value === 0
57
+ ? 100
58
+ : 0 ;
56
59
return { graphData : newUsersData , trend } ;
57
60
} , [ props . data , props . dateFormat ] ) ;
58
61
const isEmpty = useMemo (
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ export function Payouts(props: {
54
54
const trend =
55
55
lastPeriod && currentPeriod && lastPeriod . value > 0
56
56
? ( currentPeriod . value - lastPeriod . value ) / lastPeriod . value
57
- : 0 ;
57
+ : lastPeriod ?. value === 0
58
+ ? 100
59
+ : 0 ;
58
60
return {
59
61
graphData : cleanedData ,
60
62
totalPayoutsUSD : totalPayouts / 100 ,
Original file line number Diff line number Diff line change @@ -34,7 +34,13 @@ export function ChangeBadge(props: { percent: number }) {
34
34
) : (
35
35
< ArrowDownIcon className = "size-4" />
36
36
) }
37
- { percentValue }
37
+
38
+ { new Intl . NumberFormat ( "en-US" , {
39
+ style : "percent" ,
40
+ minimumFractionDigits : 0 ,
41
+ maximumFractionDigits : 0 ,
42
+ signDisplay : "never" ,
43
+ } ) . format ( props . percent ) }
38
44
</ Badge >
39
45
</ div >
40
46
</ ToolTipLabel >
You can’t perform that action at this time.
0 commit comments