File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
apps/dashboard/src/components/pay/PayAnalytics/components Expand file tree Collapse file tree 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: {
4949 }
5050 const lastPeriod = newUsersData [ newUsersData . length - 2 ] ;
5151 const currentPeriod = newUsersData [ newUsersData . length - 1 ] ;
52+ // Calculate the percent change from last period to current period
5253 const trend =
5354 lastPeriod && currentPeriod && lastPeriod . value > 0
5455 ? ( currentPeriod . value - lastPeriod . value ) / lastPeriod . value
55- : 0 ;
56+ : lastPeriod ?. value === 0
57+ ? 100
58+ : 0 ;
5659 return { graphData : newUsersData , trend } ;
5760 } , [ props . data , props . dateFormat ] ) ;
5861 const isEmpty = useMemo (
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ export function Payouts(props: {
5454 const trend =
5555 lastPeriod && currentPeriod && lastPeriod . value > 0
5656 ? ( currentPeriod . value - lastPeriod . value ) / lastPeriod . value
57- : 0 ;
57+ : lastPeriod ?. value === 0
58+ ? 100
59+ : 0 ;
5860 return {
5961 graphData : cleanedData ,
6062 totalPayoutsUSD : totalPayouts / 100 ,
Original file line number Diff line number Diff line change @@ -34,7 +34,13 @@ export function ChangeBadge(props: { percent: number }) {
3434 ) : (
3535 < ArrowDownIcon className = "size-4" />
3636 ) }
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 ) }
3844 </ Badge >
3945 </ div >
4046 </ ToolTipLabel >
You can’t perform that action at this time.
0 commit comments