asi-calculator/features/prices/components/MarketData/MarketData.tsx

63 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-03-30 19:27:18 +01:00
'use client'
import { ratioOceanToAsi, ratioAgixToAsi, ratioFetToAsi } from '@/constants'
2024-04-01 14:42:08 +02:00
import styles from './MarketData.module.css'
2024-04-01 15:23:01 +02:00
import { usePrices } from '@/features/prices'
import { Label } from '@/components'
2024-03-30 19:27:18 +01:00
2024-04-01 14:42:08 +02:00
export function MarketData() {
2024-04-01 02:15:51 +02:00
const { prices, isValidating, isLoading } = usePrices()
const feedbackClasses = isLoading
? 'isLoading'
: isValidating
? 'isValidating'
: ''
2024-03-30 19:27:18 +01:00
return (
2024-04-01 14:42:08 +02:00
<ul className={styles.marketData}>
2024-03-30 19:27:18 +01:00
<li>
2024-03-31 15:24:07 +02:00
<p>1 ASI</p>
2024-04-01 02:15:51 +02:00
<p>
2024-04-01 04:38:59 +02:00
<span className={`${styles.fiat} ${feedbackClasses}`}>
${prices.asi}
</span>
2024-04-01 02:15:51 +02:00
</p>
2024-03-30 19:27:18 +01:00
</li>
2024-03-30 23:10:36 +01:00
<li>
2024-03-31 15:24:07 +02:00
<p>
1 Fet = {ratioFetToAsi} ASI
<Label>fixed</Label>
</p>
2024-04-01 02:15:51 +02:00
<p>
2024-04-01 04:38:59 +02:00
<span className={`${styles.fiat} ${feedbackClasses}`}>
${prices.fet}
</span>
2024-04-01 02:15:51 +02:00
</p>
2024-03-30 23:10:36 +01:00
</li>
2024-03-30 19:27:18 +01:00
<li>
2024-03-31 15:24:07 +02:00
<p>
1 OCEAN = {ratioOceanToAsi} ASI
<Label>fixed</Label>
</p>
2024-04-01 02:15:51 +02:00
<p>
2024-04-01 04:38:59 +02:00
<span className={`${styles.fiat} ${feedbackClasses}`}>
${prices.ocean}
</span>
2024-04-01 02:15:51 +02:00
</p>
2024-03-30 19:27:18 +01:00
</li>
<li>
2024-03-31 15:24:07 +02:00
<p>
1 AGIX = {ratioAgixToAsi} ASI
<Label>fixed</Label>
</p>
2024-04-01 02:15:51 +02:00
<p>
2024-04-01 04:38:59 +02:00
<span className={`${styles.fiat} ${feedbackClasses}`}>
${prices.agix}
</span>
2024-04-01 02:15:51 +02:00
</p>
2024-03-30 19:27:18 +01:00
</li>
</ul>
)
}