Skip to content

Commit

Permalink
[FRE-1183, FRE-1185, FRE-1146] (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericHgorski authored Nov 1, 2024
1 parent 073be86 commit 4966d4e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const ErrorPageTransactionFailed = ({
description={
<>
<SmallText color={theme.error.text} textAlign="center" textWrap="balance">
This transaction encountered a critical error. <br />
Please contact our support team below.
</SmallText>
<Row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { useAtomValue } from "jotai";
import { SwapExecutionState } from "./SwapExecutionPage";
import { SwapExecutionPageRouteProps } from "./SwapExecutionPageRouteSimple";
import React from "react";
import { EvmDisclaimer } from "@/components/EvmDisclaimer";
import { swapExecutionStateAtom } from "@/state/swapExecutionPage";

type operationTypeToIcon = Record<OperationType, JSX.Element>;

Expand Down Expand Up @@ -52,9 +50,6 @@ export const SwapExecutionPageRouteDetailed = ({
onClickEditDestinationWallet: _onClickEditDestinationWallet,
swapExecutionState
}: SwapExecutionPageRouteProps) => {
const { route } = useAtomValue(
swapExecutionStateAtom
);
const { data: swapVenues } = useAtomValue(skipSwapVenuesAtom);
const { data: bridges } = useAtomValue(skipBridgesAtom);

Expand Down Expand Up @@ -159,7 +154,6 @@ export const SwapExecutionPageRouteDetailed = ({
);
})}
</Column>
<EvmDisclaimer route={route} />
</StyledSwapExecutionPageRoute>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { formatUSD } from "@/utils/intl";
import { copyToClipboard } from "@/utils/misc";
import {
limitDecimalsDisplayed,
removeTrailingZeros,
} from "@/utils/number";

export type SwapExecutionPageRouteSimpleRowProps = {
Expand Down Expand Up @@ -75,6 +76,11 @@ export const SwapExecutionPageRouteSimpleRow = ({
}
}, [account?.address, account?.wallet.logo, chainAddresses, context]);

const displayAmount = useMemo(() => {
return removeTrailingZeros(limitDecimalsDisplayed(assetDetails.amount))
}
, [assetDetails.amount]);

return (
<Row gap={25} align="center">
{assetDetails.assetImage && (
Expand All @@ -95,7 +101,7 @@ export const SwapExecutionPageRouteSimpleRow = ({
)}
<Column gap={5}>
<StyledSymbolAndAmount>
{limitDecimalsDisplayed(assetDetails.amount)} {assetDetails?.symbol}
{displayAmount} {assetDetails?.symbol}
</StyledSymbolAndAmount>
{usdValue && (
<SmallText>
Expand Down
4 changes: 0 additions & 4 deletions packages/widget-v2/src/pages/SwapPage/SwapDetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { getClientOperations, OperationType } from "@/utils/clientType";
import { convertTokenAmountToHumanReadableAmount } from "@/utils/crypto";
import { getBrandButtonTextColor } from "@/utils/colors";
import { QuestionMarkIcon } from "@/icons/QuestionMarkIcon";
import { EvmDisclaimer } from "@/components/EvmDisclaimer";

export const SwapDetailModal = createModal((modalProps: ModalProps) => {
const { data: route } = useAtomValue(skipRouteAtom);
Expand Down Expand Up @@ -222,9 +221,6 @@ export const SwapDetailModal = createModal((modalProps: ModalProps) => {
)}
</Column>
)}

<EvmDisclaimer route={route} />

<SwapDetailText justify="space-between">
<SwapPageFooterItems showRouteInfo />
</SwapDetailText>
Expand Down
1 change: 0 additions & 1 deletion packages/widget-v2/src/stories/ErrorState.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const transactionFailedProps = (theme: Theme) => {
description: (
<>
<SmallText color={theme.error.text} textAlign="center">
This transaction encountered a critical error. <br />
Please contact our support team below.
</SmallText>
<Row
Expand Down
2 changes: 2 additions & 0 deletions packages/widget-v2/src/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export function formatNumberWithoutCommas(str: string | number) {
return str.toString().replace(/,/g, "");
}

export const removeTrailingZeros = (input: string | undefined) => input?.replace(/0+$/, '');

export function limitDecimalsDisplayed(input: string | number | undefined, decimalPlaces = 6) {
if (input === undefined) return "";

Expand Down

0 comments on commit 4966d4e

Please sign in to comment.