From c5d0ef06564dbb2c7f5435052ad04471cb5534f2 Mon Sep 17 00:00:00 2001 From: Eugene Chybisov Date: Tue, 3 Dec 2024 13:40:02 +0100 Subject: [PATCH] fix: deposit flow adjustments --- examples/deposit-flow/src/App.tsx | 2 -- packages/widget/src/components/RouteCard/RouteCard.tsx | 4 ++-- packages/widget/src/components/Routes/Routes.tsx | 2 +- packages/widget/src/components/Step/Step.tsx | 4 ++-- packages/widget/src/i18n/en.json | 4 +++- packages/widget/src/pages/MainPage/MainPage.tsx | 5 +---- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/examples/deposit-flow/src/App.tsx b/examples/deposit-flow/src/App.tsx index 660f93563..4888e834b 100644 --- a/examples/deposit-flow/src/App.tsx +++ b/examples/deposit-flow/src/App.tsx @@ -12,7 +12,6 @@ import { contractTool } from './config' // EXAMPLE CONTRACT, DON'T DEPOSIT const depositAddress = '0x4bF3E32de155359D1D75e8B474b66848221142fc' -const depositAmount = 5000000n const contractCalls: ContractCall[] = [] @@ -54,7 +53,6 @@ export function App() { coinKey: CoinKey.USDC, logoURI: 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png', - amount: depositAmount, }} contractCalls={contractCalls} /> diff --git a/packages/widget/src/components/RouteCard/RouteCard.tsx b/packages/widget/src/components/RouteCard/RouteCard.tsx index a96cdf898..6487ec4e5 100644 --- a/packages/widget/src/components/RouteCard/RouteCard.tsx +++ b/packages/widget/src/components/RouteCard/RouteCard.tsx @@ -26,7 +26,7 @@ export const RouteCard: React.FC< ...other }) => { const { t } = useTranslation() - const { subvariant } = useWidgetConfig() + const { subvariant, subvariantOptions } = useWidgetConfig() const [cardExpanded, setCardExpanded] = useState(defaulExpanded) const handleExpand: MouseEventHandler = (e) => { @@ -35,7 +35,7 @@ export const RouteCard: React.FC< } const token: TokenAmount = - subvariant === 'custom' + subvariant === 'custom' && subvariantOptions?.custom !== 'deposit' ? { ...route.fromToken, amount: BigInt(route.fromAmount) } : { ...route.toToken, amount: BigInt(route.toAmount) } const impactToken: TokenAmount | undefined = diff --git a/packages/widget/src/components/Routes/Routes.tsx b/packages/widget/src/components/Routes/Routes.tsx index 339661871..66dabbe36 100644 --- a/packages/widget/src/components/Routes/Routes.tsx +++ b/packages/widget/src/components/Routes/Routes.tsx @@ -46,7 +46,7 @@ export const Routes: React.FC = (props) => { const title = subvariant === 'custom' ? subvariantOptions?.custom === 'deposit' - ? t('header.deposit') + ? t('header.receive') : t('header.youPay') : t('header.receive') diff --git a/packages/widget/src/components/Step/Step.tsx b/packages/widget/src/components/Step/Step.tsx index a05dd6bf0..35cac5e02 100644 --- a/packages/widget/src/components/Step/Step.tsx +++ b/packages/widget/src/components/Step/Step.tsx @@ -58,8 +58,8 @@ export const Step: React.FC<{ default: return subvariant === 'custom' ? subvariantOptions?.custom === 'deposit' - ? t('main.stepSwapAndDeposit') - : t('main.stepSwapAndBuy') + ? t('main.stepDeposit') + : t('main.stepBuy') : t('main.stepSwap') } } diff --git a/packages/widget/src/i18n/en.json b/packages/widget/src/i18n/en.json index 56f2281e4..51a57ea24 100644 --- a/packages/widget/src/i18n/en.json +++ b/packages/widget/src/i18n/en.json @@ -267,13 +267,15 @@ "stepBridge": "Bridge", "stepBridgeAndBuy": "Bridge and buy", "stepBridgeAndDeposit": "Bridge and deposit", + "stepBuy": "Buy", + "stepDeposit": "Deposit", "stepDetails": "{{tool}} via LI.FI", "stepSwap": "Swap", "stepSwapAndBridge": "Swap and bridge", "stepSwapAndBuy": "Swap and buy", "stepSwapAndDeposit": "Swap and deposit", - "transferId": "Transfer ID", "swapStepDetails": "Swap on {{chain}} via {{tool}}", + "transferId": "Transfer ID", "tags": { "cheapest": "Best Return", "fastest": "Fastest" diff --git a/packages/widget/src/pages/MainPage/MainPage.tsx b/packages/widget/src/pages/MainPage/MainPage.tsx index 9fa09b9cf..fc0a0471f 100644 --- a/packages/widget/src/pages/MainPage/MainPage.tsx +++ b/packages/widget/src/pages/MainPage/MainPage.tsx @@ -44,10 +44,7 @@ export const MainPage: React.FC = () => { ) : null} {!custom || subvariantOptions?.custom === 'deposit' ? ( - + ) : null} {!wideVariant ? : null}