2024-03-30 19:11:24 +01:00
|
|
|
import styles from './ResultRow.module.css'
|
|
|
|
import { formatNumber } from '@/utils'
|
2024-03-31 05:03:37 +02:00
|
|
|
import { ArrowRightIcon } from '@radix-ui/react-icons'
|
2024-03-30 02:03:43 +01:00
|
|
|
import Image from 'next/image'
|
2024-03-29 21:37:30 +01:00
|
|
|
|
2024-03-29 19:54:14 +01:00
|
|
|
type Props = {
|
2024-03-30 02:03:43 +01:00
|
|
|
tokenSymbol: string
|
|
|
|
tokenAddress: string
|
2024-03-29 19:54:14 +01:00
|
|
|
amount: number
|
|
|
|
amountAsi: number
|
|
|
|
amountFiat: number
|
2024-03-31 05:03:37 +02:00
|
|
|
amountOriginalFiat?: number
|
2024-03-31 05:32:11 +02:00
|
|
|
isValidating: boolean
|
2024-03-29 19:54:14 +01:00
|
|
|
}
|
|
|
|
|
2024-03-30 02:03:43 +01:00
|
|
|
export function Result({
|
|
|
|
tokenSymbol,
|
|
|
|
tokenAddress,
|
|
|
|
amount,
|
|
|
|
amountAsi,
|
2024-03-31 05:03:37 +02:00
|
|
|
amountFiat,
|
2024-03-31 05:32:11 +02:00
|
|
|
amountOriginalFiat,
|
|
|
|
isValidating
|
2024-03-30 02:03:43 +01:00
|
|
|
}: Props) {
|
2024-03-29 19:54:14 +01:00
|
|
|
return (
|
2024-03-29 21:37:30 +01:00
|
|
|
<div className={styles.result}>
|
2024-03-31 15:24:07 +02:00
|
|
|
<div className={styles.resultLine}>
|
2024-03-30 02:03:43 +01:00
|
|
|
<span className={styles.logo} data-symbol={tokenSymbol}>
|
|
|
|
<Image
|
|
|
|
src={`https://tokens.1inch.io/${tokenAddress}.png`}
|
|
|
|
width={24}
|
|
|
|
height={24}
|
|
|
|
alt={tokenSymbol}
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
|
2024-03-31 15:24:07 +02:00
|
|
|
<span className={isValidating ? 'isValidating' : ''}>
|
|
|
|
{formatNumber(amount || 0, tokenSymbol)}
|
|
|
|
</span>
|
2024-03-31 05:03:37 +02:00
|
|
|
|
|
|
|
{amountOriginalFiat ? (
|
|
|
|
<span className={styles.fiat}>
|
|
|
|
{formatNumber(amountOriginalFiat || 0, 'USD')}
|
|
|
|
</span>
|
|
|
|
) : null}
|
|
|
|
</div>
|
2024-03-31 15:24:07 +02:00
|
|
|
<div className={styles.resultLine}>
|
2024-03-31 05:03:37 +02:00
|
|
|
<ArrowRightIcon className={styles.iconArrow} />
|
2024-03-31 15:24:07 +02:00
|
|
|
<strong
|
|
|
|
title={`${amountAsi}`}
|
|
|
|
className={isValidating ? 'isValidating' : ''}
|
|
|
|
>
|
2024-03-30 02:20:15 +01:00
|
|
|
{formatNumber(amountAsi || 0, 'ASI')}
|
2024-03-31 05:03:37 +02:00
|
|
|
</strong>
|
2024-03-31 15:24:07 +02:00
|
|
|
<strong
|
|
|
|
className={`${styles.fiat} ${isValidating ? 'isValidating' : ''}`}
|
|
|
|
>
|
2024-03-31 05:03:37 +02:00
|
|
|
{formatNumber(amountFiat || 0, 'USD')}
|
|
|
|
</strong>
|
|
|
|
</div>
|
2024-03-29 21:37:30 +01:00
|
|
|
</div>
|
2024-03-29 19:54:14 +01:00
|
|
|
)
|
|
|
|
}
|