Skip to content

Commit

Permalink
RouteEndPoint.tsx fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lufaque committed Dec 7, 2023
1 parent 919544e commit d6b2042
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/components/cards/RouteCard/RouteEndPoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from './RouteCard.module.pcss'
import { Avatar } from '../../tags/Avatar/Avatar'
import { DataContext } from '../../../hooks/DataContext/DataContext'
import { getChainLogoURIById } from './getChainLogoURIById'
import { addingTokenDecimals, numberToFormatString } from '../../../utils/formatting'

interface RouteEndPointProps {
side: {
Expand All @@ -19,13 +20,6 @@ interface RouteEndPointProps {
}
}

function getFormatAmount(amount: string, decimals: number) {
if (amount.includes('.')) {
return parseFloat(amount).toFixed(2)
}
return (parseFloat(amount) / 10 ** decimals).toFixed(2)
}

export const RouteEndPoint: FC<RouteEndPointProps> = ({ side }) => {
const [chainLogoURI, setChainLogoURI] = useState('')
const { amount } = side.token
Expand All @@ -41,7 +35,7 @@ export const RouteEndPoint: FC<RouteEndPointProps> = ({ side }) => {
<Avatar src={side.token.logo_uri} size="md" />
<Avatar src={chainLogoURI} size="xs" className={classNames.chainAvatar} />
</div>
<h4>{getFormatAmount(amount, side.token.decimals)}</h4>
<h4>{numberToFormatString(Number(addingTokenDecimals(amount, side.token.decimals)), 4, true)}</h4>
</div>
)
}
2 changes: 1 addition & 1 deletion src/hooks/useTracking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const useTracking = () => {
label: 'Wallet Connected',
})
}
}, [address, isConnected])
}, [isConnected])

// Use callbacks to reference the standalone functions
const memoizedTrackTransaction = useCallback(trackTransaction, [])
Expand Down

0 comments on commit d6b2042

Please sign in to comment.