From 4966d4e5d70f6b10b2cc69185e695e0c2d3ad4d9 Mon Sep 17 00:00:00 2001
From: plubber <51789398+ericHgorski@users.noreply.github.com>
Date: Fri, 1 Nov 2024 18:30:34 -0400
Subject: [PATCH] [FRE-1183, FRE-1185, FRE-1146] (#411)
---
.../src/pages/ErrorPage/ErrorPageTransactionFailed.tsx | 1 -
.../SwapExecutionPage/SwapExecutionPageRouteDetailed.tsx | 6 ------
.../SwapExecutionPage/SwapExecutionPageRouteSimpleRow.tsx | 8 +++++++-
packages/widget-v2/src/pages/SwapPage/SwapDetailModal.tsx | 4 ----
packages/widget-v2/src/stories/ErrorState.stories.tsx | 1 -
packages/widget-v2/src/utils/number.ts | 2 ++
6 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/packages/widget-v2/src/pages/ErrorPage/ErrorPageTransactionFailed.tsx b/packages/widget-v2/src/pages/ErrorPage/ErrorPageTransactionFailed.tsx
index c1b3ca0a..d41dfb25 100644
--- a/packages/widget-v2/src/pages/ErrorPage/ErrorPageTransactionFailed.tsx
+++ b/packages/widget-v2/src/pages/ErrorPage/ErrorPageTransactionFailed.tsx
@@ -48,7 +48,6 @@ export const ErrorPageTransactionFailed = ({
description={
<>
- This transaction encountered a critical error.
Please contact our support team below.
;
@@ -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);
@@ -159,7 +154,6 @@ export const SwapExecutionPageRouteDetailed = ({
);
})}
-
);
};
diff --git a/packages/widget-v2/src/pages/SwapExecutionPage/SwapExecutionPageRouteSimpleRow.tsx b/packages/widget-v2/src/pages/SwapExecutionPage/SwapExecutionPageRouteSimpleRow.tsx
index 09b1ec16..574c0881 100644
--- a/packages/widget-v2/src/pages/SwapExecutionPage/SwapExecutionPageRouteSimpleRow.tsx
+++ b/packages/widget-v2/src/pages/SwapExecutionPage/SwapExecutionPageRouteSimpleRow.tsx
@@ -18,6 +18,7 @@ import { formatUSD } from "@/utils/intl";
import { copyToClipboard } from "@/utils/misc";
import {
limitDecimalsDisplayed,
+ removeTrailingZeros,
} from "@/utils/number";
export type SwapExecutionPageRouteSimpleRowProps = {
@@ -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 (
{assetDetails.assetImage && (
@@ -95,7 +101,7 @@ export const SwapExecutionPageRouteSimpleRow = ({
)}
- {limitDecimalsDisplayed(assetDetails.amount)} {assetDetails?.symbol}
+ {displayAmount} {assetDetails?.symbol}
{usdValue && (
diff --git a/packages/widget-v2/src/pages/SwapPage/SwapDetailModal.tsx b/packages/widget-v2/src/pages/SwapPage/SwapDetailModal.tsx
index 01340746..841738de 100644
--- a/packages/widget-v2/src/pages/SwapPage/SwapDetailModal.tsx
+++ b/packages/widget-v2/src/pages/SwapPage/SwapDetailModal.tsx
@@ -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);
@@ -222,9 +221,6 @@ export const SwapDetailModal = createModal((modalProps: ModalProps) => {
)}
)}
-
-
-
diff --git a/packages/widget-v2/src/stories/ErrorState.stories.tsx b/packages/widget-v2/src/stories/ErrorState.stories.tsx
index f5473676..1061b995 100644
--- a/packages/widget-v2/src/stories/ErrorState.stories.tsx
+++ b/packages/widget-v2/src/stories/ErrorState.stories.tsx
@@ -77,7 +77,6 @@ const transactionFailedProps = (theme: Theme) => {
description: (
<>
- This transaction encountered a critical error.
Please contact our support team below.
input?.replace(/0+$/, '');
+
export function limitDecimalsDisplayed(input: string | number | undefined, decimalPlaces = 6) {
if (input === undefined) return "";