Merge pull request #11 from jejolare-dev/dev

change: zano price decimals to 4
This commit is contained in:
Dmitrii Kolpakov 2025-08-18 17:01:56 +07:00 committed by GitHub
commit 6bd495c3e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 12 deletions

View file

@ -106,7 +106,7 @@ function PairsTable({ data }: IProps) {
cell: ({ row }) => (
<div className={styles.price_cell}>
<div className={styles.text}>
{roundTo(notationToString(row.original.price), 2)}
{roundTo(notationToString(row.original.price), 4)}
</div>
<div className={styles.sub_text}>{row.original.priceUSD}</div>
</div>
@ -149,7 +149,7 @@ function PairsTable({ data }: IProps) {
cell: ({ row }) => (
<div className={styles.price_cell}>
<div className={styles.text}>
{roundTo(notationToString(row.original?.volume ?? 0), 2)}
{roundTo(notationToString(row.original?.volume ?? 0), 4)}
</div>
<div className={styles.sub_text}>{row.original.volumeUSD}</div>
</div>

View file

@ -36,23 +36,23 @@ const TradingHeader = ({
{
Img: ClockIcon,
title: '24h change',
value: `${roundTo(notationToString(pairStats?.rate || 0), 8)} ${secondCurrencyName}`,
value: `${roundTo(notationToString(pairStats?.rate || 0), 4)} ${secondCurrencyName}`,
coefficient: coefficientOutput,
},
{
Img: UpIcon,
title: '24h high',
value: `${roundTo(notationToString(pairStats?.high || 0), 8)} ${secondCurrencyName}`,
value: `${roundTo(notationToString(pairStats?.high || 0), 4)} ${secondCurrencyName}`,
},
{
Img: DownIcon,
title: '24h low',
value: `${roundTo(notationToString(pairStats?.low || 0), 8)} ${secondCurrencyName}`,
value: `${roundTo(notationToString(pairStats?.low || 0), 4)} ${secondCurrencyName}`,
},
{
Img: VolumeIcon,
title: '24h volume',
value: `${roundTo(notationToString(pairStats?.volume || 0), 8)} ${secondCurrencyName}`,
value: `${roundTo(notationToString(pairStats?.volume || 0), 4)} ${secondCurrencyName}`,
},
];
@ -77,7 +77,8 @@ const TradingHeader = ({
<div className={styles.price}>
<p className={styles.price__secondCurrency}>
{notationToString(pairStats?.rate || 0)} {secondCurrencyName}
{roundTo(notationToString(pairStats?.rate || 0), 4)}{' '}
{secondCurrencyName}
</p>
{pairRateUsd && <p className={styles.price__usd}>~ ${pairRateUsd}</p>}
</div>

View file

@ -35,9 +35,7 @@ const useTradeInit = ({ pairData, pairStats }: useTradeInitParams) => {
const pairRateUsd =
pairStats?.rate !== undefined && secondAssetUsdPrice !== undefined
? new Decimal(pairStats.rate)
.mul(secondAssetUsdPrice)
.toFixed(pairStats.rate < 0.1 ? 6 : 2)
? new Decimal(pairStats.rate).mul(secondAssetUsdPrice).toFixed(2)
: undefined;
const buyForm = useOrderForm({

View file

@ -22,7 +22,7 @@ export default function PairsCard({ pair }: IProps) {
const secondAssetUsdPrice = state.assetsRates.get(secondCurrency.asset_id || '') ?? 0;
const price = Number(roundTo(notationToString(pair.rate ?? 0), 2));
const price = Number(roundTo(notationToString(pair.rate ?? 0), 4));
const currentPriceUSD = secondAssetUsdPrice ? price : 0;
const priceUSD = currentPriceUSD
? String(`$${(secondAssetUsdPrice * price).toFixed(2)}`)
@ -34,7 +34,7 @@ export default function PairsCard({ pair }: IProps) {
? -99.99
: parseFloat(coefficient?.toFixed(2) || '0');
const volume = Number(roundTo(notationToString(pair.volume ?? 0), 2));
const volume = Number(roundTo(notationToString(pair.volume ?? 0), 4));
const currentVolumeUSD = secondAssetUsdPrice ? volume : 0;
const volumeUSD = currentVolumeUSD
? String(`$${(secondAssetUsdPrice * volume).toFixed(2)}`)