Skip to content

Commit

Permalink
fix price ui issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xieqiancaosissi committed Jan 2, 2024
1 parent 2f8f90f commit fbd9797
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions screens/Market/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import type { UIAsset } from "../../interfaces";
import { isMobileDevice } from "../../helpers/helpers";
import { useAPY } from "../../hooks/useAPY";
import { IToken } from "../../interfaces/asset";
import { standardizeAsset } from "../../utils";
import {
toInternationalCurrencySystem_number,
toInternationalCurrencySystem_usd,
format_apy,
isInvalid,
formatWithCommas_usd,
} from "../../utils/uiNumber";
import { APYCell } from "./APYCell";
import getConfig from "../../utils/config";
Expand Down Expand Up @@ -369,7 +369,7 @@ function TableRowPc({
{getIcons()}
<div className="flex flex-col items-start ml-3">
<div className="flex items-end">{getSymbols()}</div>
<span className="text-xs text-gray-300">${row.price}</span>
<span className="text-xs text-gray-300">{formatWithCommas_usd(row?.price)}</span>
</div>
{is_new ? (
<NewTagIcon
Expand Down Expand Up @@ -512,7 +512,7 @@ function TableRowMobile({
row.can_borrow ? toInternationalCurrencySystem_usd(row.availableLiquidityMoney) : ""
}
/>
<TemplateMobile title="Price" value={`$${row.price}`} />
<TemplateMobile title="Price" value={formatWithCommas_usd(row?.price)} />
</div>
</div>
</Link>
Expand Down
10 changes: 6 additions & 4 deletions screens/TokenDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function TokenDetailView({ tokenRow, assets }: { tokenRow: UIAsset; assets: UIAs
function getSymbols() {
const { isLpToken, tokens } = tokenRow;
return (
<div className="flex items-center flex-wrap flex-shrink-0 xsm:max-w-[146px] ml-2">
<div className="flex items-center flex-wrap flex-shrink-0 xsm:max-w-[146px] xsm:ml-2">
{isLpToken ? (
tokens.map((token: IToken, index) => {
return (
Expand Down Expand Up @@ -480,7 +480,7 @@ function TokenOverviewMobile() {
title="# of borrowers"
value={!tokenRow?.can_borrow ? "-" : formatWithCommas_number(borrowers_number, 0)}
/>
<LabelMobile title="Price" value={`$${tokenRow?.price}`} />
<LabelMobile title="Price" value={formatWithCommas_usd(tokenRow?.price)} />
</div>
);
}
Expand All @@ -507,7 +507,7 @@ function TokenOverview() {
<div className="flex flex-col ml-3">
<div className="flex">{getSymbols()}</div>
<span className="text-xs text-gray-300 transform -translate-y-1.5">
${tokenRow?.price}
{formatWithCommas_usd(tokenRow?.price)}
</span>
</div>
</div>
Expand Down Expand Up @@ -795,7 +795,9 @@ function TokenUserInfo() {
);
}
function getUserLpUsd() {
return `$${digitalProcess(new Decimal(supplyBalance || 0).mul(price || 0).toFixed(), 2)}`;
return accountId
? `$${digitalProcess(new Decimal(supplyBalance || 0).mul(price || 0).toFixed(), 2)}`
: "-";
}
const totalBorrowAmount = Object.values(maxBorrowAmountPositions)?.reduce(
(acc, { maxBorrowAmount }) => acc + maxBorrowAmount,
Expand Down

0 comments on commit fbd9797

Please sign in to comment.