Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ui-ux): rename dUSDT to ex_USDT #1937

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions cypress/e2e/pages/dex/dex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ context("/dex on macbook-16", () => {
cy.wrap(ele).findByText("Pair").should("be.visible");
cy.wrap(ele).findByText("Total Liquidity").should("be.visible");
cy.wrap(ele).findByText("Volume (24H)").should("be.visible");
cy.wrap(ele)
.findByText("Primary Token Price (USDT)")
.should("be.visible");
cy.wrap(ele).findByText("Primary Token Price (USD)").should("be.visible");
cy.wrap(ele).findByText("APR").should("be.visible");
});
});
Expand Down Expand Up @@ -73,7 +71,7 @@ context("/dex on macbook-16", () => {
.findByTestId("OverflowTable.SortButton")
.should("exist");
cy.wrap(ele)
.findByText("Primary Token Price (USDT)")
.findByText("Primary Token Price (USD)")
.findByTestId("OverflowTable.SortButton")
.should("exist");
});
Expand All @@ -92,7 +90,7 @@ context("/dex on macbook-16", () => {
.eq(3)
.then(($ele) => {
totalLiquid.push(
Number.parseInt($ele.text().substring(1).replaceAll(",", ""))
Number.parseInt($ele.text().substring(1).replaceAll(",", "")),
);
});
});
Expand All @@ -118,7 +116,7 @@ context("/dex on macbook-16", () => {
.eq(2)
.then(($ele) => {
volume.push(
Number.parseInt($ele.text().substring(1).replaceAll(",", ""))
Number.parseInt($ele.text().substring(1).replaceAll(",", "")),
);
});
});
Expand Down Expand Up @@ -154,7 +152,7 @@ context("/dex on macbook-16", () => {
});

cy.findByTestId("OverflowTable.Header").within(() => {
cy.findByText("Primary Token Price (USDT)")
cy.findByText("Primary Token Price (USD)")
.findByTestId("OverflowTable.SortButton")
.click();
});
Expand All @@ -165,7 +163,7 @@ context("/dex on macbook-16", () => {
.eq(1)
.then(($ele) => {
price.push(
Number.parseInt($ele.text().substring(1).replaceAll(",", ""))
Number.parseInt($ele.text().substring(1).replaceAll(",", "")),
);
});
});
Expand Down Expand Up @@ -210,7 +208,7 @@ context("/dex on iphone-x", () => {
.should("be.visible")
.should("have.text", "Total Liquidity");
cy.findByTestId("CardList.Row.Child").should("be.visible");
}
},
);
cy.findByTestId("PoolPairsCard.CardList.24hVolume").within(() => {
cy.findByTestId("CardList.Row.Title")
Expand All @@ -221,7 +219,7 @@ context("/dex on iphone-x", () => {
cy.findByTestId("PoolPairsCard.CardList.TokenPrice").within(() => {
cy.findByTestId("CardList.Row.Title")
.should("be.visible")
.should("have.text", "Primary Token Price (USDT)");
.should("have.text", "Primary Token Price (USD)");
cy.findByTestId("CardList.Row.Child").should("be.visible");
});
cy.findByTestId("PoolPairsCard.CardList.APR").within(() => {
Expand All @@ -231,7 +229,7 @@ context("/dex on iphone-x", () => {
cy.findByTestId("CardList.Row.Child").should("be.visible");
});
});
}
},
);
});

Expand Down Expand Up @@ -314,7 +312,7 @@ context("/dex on iphone-x", () => {
if (text !== undefined) {
totalLiquid.push(Number.parseInt(text.replaceAll(",", "")));
}
}
},
);
});
});
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/pages/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ context("/ on macbook-16", () => {
.should("be.visible")
.should("have.text", "Minted by");
cy.findByTestId("BlockCardDetails.MintedByValue").should(
"be.visible"
"be.visible",
);
cy.findByTestId("BlockCardDetails.TransactionsLabel")
.should("be.visible")
Expand All @@ -98,7 +98,7 @@ context("/ on macbook-16", () => {
cy.findAllByTestId("LiquidityPoolCard").each(($el) => {
cy.wrap($el).within(() => {
cy.findByTestId("LiquidityPoolCard.PoolPairSymbol").should(
"be.visible"
"be.visible",
);

cy.findByTestId("LiquidityCardStat.APR.Label")
Expand All @@ -113,7 +113,7 @@ context("/ on macbook-16", () => {
.should("have.text", "Liquidity");
cy.findByTestId("LiquidityCardStat.Liquidity.Value")
.should("be.visible")
.contains(/^\d{1,3}(,\d{3})* USDT$/);
.contains(/^\d{1,3}(,\d{3})* USD$/);

cy.findByTestId("LiquidityCardStat.Ratio.Label")
.should("be.visible")
Expand Down Expand Up @@ -204,7 +204,7 @@ context("/ on iphone-x", () => {
.should("be.visible")
.should("have.text", "Minted by");
cy.findByTestId("BlockCardDetails.MintedByValue").should(
"be.visible"
"be.visible",
);
cy.findByTestId("BlockCardDetails.TransactionsLabel")
.should("be.visible")
Expand All @@ -228,7 +228,7 @@ context("/ on iphone-x", () => {
cy.findAllByTestId("LiquidityPoolCard").each(($el) => {
cy.wrap($el).within(() => {
cy.findByTestId("LiquidityPoolCard.PoolPairSymbol").should(
"be.visible"
"be.visible",
);

cy.findByTestId("LiquidityCardStat.APR.Label")
Expand All @@ -243,7 +243,7 @@ context("/ on iphone-x", () => {
.should("have.text", "Liquidity");
cy.findByTestId("LiquidityCardStat.Liquidity.Value")
.should("be.visible")
.contains(/^\d{1,3}(,\d{3})* USDT$/);
.contains(/^\d{1,3}(,\d{3})* USD$/);

cy.findByTestId("LiquidityCardStat.Ratio.Label")
.should("be.visible")
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/tokens/tokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ context("/tokens on macbook-16", () => {
cy.findAllByTestId("OverflowTable.Row")
.eq(3)
.then((ele) => {
cy.wrap(ele).findByText("dUSDT").should("be.visible");
cy.wrap(ele).findByText("ex_USDT").should("be.visible");
cy.wrap(ele).findByText("Tether USD").should("be.visible");
cy.wrap(ele).findByText("DAT").should("be.visible");
});
Expand Down
10 changes: 7 additions & 3 deletions src/components/commons/token/PoolPairSymbol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classnames from "classnames";
import { useWhaleApiClient } from "@contexts/WhaleContext";
import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
import { getAssetIcon } from "@components/icons/assets/tokens";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface PoolPairSymbolProps {
poolPairId: string | number;
Expand All @@ -17,7 +18,7 @@ export function PoolPairSymbol(props: PoolPairSymbolProps): JSX.Element {
const api = useWhaleApiClient();

const [poolPairData, setPoolPairData] = useState<PoolPairData | undefined>(
undefined
undefined,
);
const [showPoolPairId, setShowPoolPairId] = useState<boolean>(false);

Expand Down Expand Up @@ -56,6 +57,9 @@ export function PoolPairSymbol(props: PoolPairSymbolProps): JSX.Element {
const IconA = getAssetIcon(poolPairData.tokenA.symbol);
const IconB = getAssetIcon(poolPairData.tokenB.symbol);

const tokenADisplay = renameTokenSymbol(poolPairData.tokenA.displaySymbol);
const tokenBDisplay = renameTokenSymbol(poolPairData.tokenB.displaySymbol);

return (
<div className="flex items-center" data-testid={props.testId}>
<IconA
Expand All @@ -67,11 +71,11 @@ export function PoolPairSymbol(props: PoolPairSymbolProps): JSX.Element {
className={classnames(
"absolute",
props.symbolSizeClassName,
props.symbolMarginClassName
props.symbolMarginClassName,
)}
/>
<div className={classnames(props.textClassName)}>
{`${poolPairData.tokenA.displaySymbol}-${poolPairData.tokenB.displaySymbol}`}
{`${tokenADisplay}-${tokenBDisplay}`}
</div>
</div>
);
Expand Down
8 changes: 6 additions & 2 deletions src/components/commons/token/PoolPairSymbolLocal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import classnames from "classnames";
import { getAssetIcon } from "@components/icons/assets/tokens";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface PoolPairSymbolProps {
tokenA: {
Expand All @@ -23,6 +24,9 @@ export function PoolPairSymbolLocal(props: PoolPairSymbolProps): JSX.Element {
const IconA = getAssetIcon(props.tokenA.symbol);
const IconB = getAssetIcon(props.tokenB.symbol);

const tokenADisplaySymbol = renameTokenSymbol(props.tokenA.displaySymbol);
const tokenBDisplaySymbol = renameTokenSymbol(props.tokenB.displaySymbol);

return (
<div className="flex items-center" data-testid={props.testId}>
<IconA
Expand All @@ -33,10 +37,10 @@ export function PoolPairSymbolLocal(props: PoolPairSymbolProps): JSX.Element {
/>
<div className={classnames(props.textClassName)}>
<span className={classnames(props.primaryTextClassName)}>
{props.tokenA.displaySymbol}
{tokenADisplaySymbol}
</span>
<span className={classnames(props.secondaryTextClassName)}>
-{props.tokenB.displaySymbol}
-{tokenBDisplaySymbol}
</span>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/commons/token/TokenSymbol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TokenData } from "@defichain/whale-api-client/dist/api/tokens";
import classNames from "classnames";
import { getAssetIcon, getTokenIcon } from "@components/icons/assets/tokens";
import { EVMLinearGradient } from "@components/icons/assets/tokens/EVMLinearGradient";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface TokenSymbolProps {
tokenId: number;
Expand Down Expand Up @@ -69,7 +70,7 @@ export function TokenSymbol(props: TokenSymbolProps): JSX.Element {
)}
data-testid={props.testId}
>
{tokenData.displaySymbol}
{renameTokenSymbol(tokenData.displaySymbol)}
{!tokenData.isDAT && `#${tokenData.id}`}
</div>
{(() => {
Expand Down
7 changes: 4 additions & 3 deletions src/components/index/LiquidityPoolList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
import { Link } from "@components/commons/link/Link";
import { NumericFormat } from "react-number-format";
import { PoolPairSymbol } from "@components/commons/token/PoolPairSymbol";
import { renameTokenSymbol } from "../../utils/commons/RenameToken";

export function LiquidityPoolList({
liquidityPools,
Expand Down Expand Up @@ -32,8 +33,8 @@ export function LiquidityPoolList({
: ""
}
priceRatio={pool.priceRatio.ba}
tokenASymbol={pool.tokenA.displaySymbol}
tokenBSymbol={pool.tokenB.displaySymbol}
tokenASymbol={renameTokenSymbol(pool.tokenA.displaySymbol)}
tokenBSymbol={renameTokenSymbol(pool.tokenB.displaySymbol)}
/>
);
})}
Expand Down Expand Up @@ -109,7 +110,7 @@ function LiquidityPoolCard(props: {
thousandSeparator
value={props.totalLiquidity}
decimalScale={0}
suffix=" USDT"
suffix=" USD"
data-testid="LiquidityCardStat.Liquidity.Value"
/>
</LiquidityCardStat>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/address/_components/AddressBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CgSpinner } from "react-icons/cg";
import { PoolPairSymbol } from "@components/commons/token/PoolPairSymbol";
import { Link } from "@components/commons/link/Link";
import { EmptySection } from "@components/commons/sections/EmptySection";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface AddressBalancesProps {
address: string;
Expand Down Expand Up @@ -163,7 +164,7 @@ function TokenSymbolName(props: { token: AddressToken }): JSX.Element {
>
<Link href={{ pathname: `/tokens/${props.token.id}` }}>
<a className="contents">
{props.token.displaySymbol}
{renameTokenSymbol(props.token.displaySymbol)}
{!props.token.isDAT && `#${props.token.id}`}
</a>
</Link>
Expand Down
7 changes: 4 additions & 3 deletions src/pages/auctions/_components/commons/BidAmountValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from "react";
import { LoanVaultLiquidationBatch } from "@defichain/whale-api-client/dist/api/loan";
import classNames from "classnames";
import { useTokenPrice } from "../../../vaults/hooks/TokenPrice";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

interface BidAmountValueProps {
batch: LoanVaultLiquidationBatch;
Expand All @@ -24,7 +25,7 @@ export function BidAmountValue(props: BidAmountValueProps): JSX.Element {
minBidValue = getTokenPrice(props.batch.loan.symbol, minBidAmount);
} else {
minBidAmount = new BigNumber(
props.batch.highestBid.amount.amount
props.batch.highestBid.amount.amount,
).multipliedBy(1.01);
minBidValue = getTokenPrice(props.batch.loan.symbol, minBidAmount);
}
Expand All @@ -35,15 +36,15 @@ export function BidAmountValue(props: BidAmountValueProps): JSX.Element {
value={minBidAmount.toFixed(8)}
thousandSeparator
decimalScale={8}
suffix={` ${props.batch.loan.displaySymbol}`}
suffix={` ${renameTokenSymbol(props.batch.loan.displaySymbol)}`}
displayType="text"
data-testid="BidAmountValue.MinBidAmount"
className="dark:text-gray-100"
/>
<div
className={classNames(
"text-gray-500 dark:text-gray-400",
props.valueClassName
props.valueClassName,
)}
data-testid="BidAmountValue.MinBidValue"
>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/auctions/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function AuctionsPage({
alignRight
/>
<OverflowTable.Head
title="Collateral Value (USDT)"
title="Collateral Value (USD)"
testId="AuctionTable.CollateralValue"
alignRight
/>
Expand Down Expand Up @@ -123,7 +123,7 @@ export default function AuctionsPage({
}

export async function getServerSideProps(
context: GetServerSidePropsContext
context: GetServerSidePropsContext,
): Promise<GetServerSidePropsResult<ActionsPageProps>> {
const next = CursorPagination.getNext(context);
try {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/dex/[poolpairId]/_components/PoolPairDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
import { NumericFormat } from "react-number-format";
import { getAssetIcon } from "@components/icons/assets/tokens";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

export function PoolPairDetails(props: {
poolpair: PoolPairData;
Expand Down Expand Up @@ -89,7 +90,8 @@ function TokenDetailsItem(props: {
data-testid={props.testId}
>
<span className="flex items-center dark:text-gray-400">
<TokenIcon className="mr-2 w-4 h-4" /> {props.displaySymbol}
<TokenIcon className="mr-2 w-4 h-4" />
{renameTokenSymbol(props.displaySymbol)}
</span>
<NumericFormat
value={props.value}
Expand Down
7 changes: 5 additions & 2 deletions src/pages/dex/[poolpairId]/_components/PoolPairDetailsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PoolPairSymbolLocal } from "@components/commons/token/PoolPairSymbolLoc
import { NumericFormat } from "react-number-format";
import BigNumber from "bignumber.js";
import { useTokenPrice } from "../../../vaults/hooks/TokenPrice";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

export function PoolPairDetailsBar(props: {
poolpair: PoolPairData;
Expand Down Expand Up @@ -35,7 +36,7 @@ export function PoolPairDetailsBar(props: {
prefix="$"
value={getTokenPrice(
props.poolpair.tokenB.symbol,
new BigNumber(props.poolpair.priceRatio.ba)
new BigNumber(props.poolpair.priceRatio.ba),
).toFixed(2, BigNumber.ROUND_HALF_UP)}
/>
<NumericFormat
Expand All @@ -46,7 +47,9 @@ export function PoolPairDetailsBar(props: {
fixedDecimalScale
className="text-sm flex lg:justify-end text-gray-400"
prefix="≈ "
suffix={` ${props.poolpair.tokenB.displaySymbol} `}
suffix={` ${renameTokenSymbol(
props.poolpair.tokenB.displaySymbol,
)} `}
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dex/_components/PoolPairsCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function PoolPairsCard({

<CardList.List>
<CardList.ListItem
title="Primary Token Price (USDT)"
title="Primary Token Price (USD)"
titleClassNames="text-sm"
testId="PoolPairsCard.CardList.TokenPrice"
>
Expand Down
Loading
Loading