From 22729358c03046914e5fa9b63d81b7c13c2230ad Mon Sep 17 00:00:00 2001 From: Finnian Jacobson-Schulte <140328381+finnian0826@users.noreply.github.com> Date: Tue, 7 Jan 2025 09:30:55 -0700 Subject: [PATCH] fix lint --- src/components/GasFeeWarning.tsx | 37 ++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/components/GasFeeWarning.tsx b/src/components/GasFeeWarning.tsx index ea613ffef22..a78158bd624 100644 --- a/src/components/GasFeeWarning.tsx +++ b/src/components/GasFeeWarning.tsx @@ -34,28 +34,23 @@ function GasFeeWarning({ } }, [prepareTransactionsResult]) - if (!prepareTransactionsResult || prepareTransactionsResult.type === 'possible') { - return false - } - - const feeCurrency = - prepareTransactionsResult.type === 'not-enough-balance-for-gas' - ? prepareTransactionsResult.feeCurrencies[0] - : prepareTransactionsResult.feeCurrency - - const title = t('gasFeeWarning.title', { - context: flow === 'Dapp' ? 'Dapp' : undefined, - tokenSymbol: feeCurrency.symbol, - }) - - const { description, ctaLabel } = useMemo(() => { + const { title, description, ctaLabel } = useMemo(() => { + const title = t('gasFeeWarning.title', { + context: flow === 'Dapp' ? 'Dapp' : undefined, + tokenSymbol: feeCurrency.symbol, + }) if (flow === 'Dapp') { return { + title, description: t('gasFeeWarning.descriptionDapp', { tokenSymbol: feeCurrency.symbol }), ctaLabel: undefined, } - } else if (prepareTransactionsResult.type === 'not-enough-balance-for-gas') { + } else if ( + prepareTransactionsResult && + prepareTransactionsResult.type === 'not-enough-balance-for-gas' + ) { return { + title, description: t('gasFeeWarning.descriptionNotEnoughGas', { context: flow, tokenSymbol: feeCurrency.symbol, @@ -64,6 +59,7 @@ function GasFeeWarning({ } } else { return { + title, description: t('gasFeeWarning.descriptionMaxAmount', { context: flow, tokenSymbol: feeCurrency.symbol, @@ -73,6 +69,15 @@ function GasFeeWarning({ } }, [flow, prepareTransactionsResult]) + if (!prepareTransactionsResult || prepareTransactionsResult.type === 'possible') { + return false + } + + const feeCurrency = + prepareTransactionsResult.type === 'not-enough-balance-for-gas' + ? prepareTransactionsResult.feeCurrencies[0] + : prepareTransactionsResult.feeCurrency + const onPressCta = () => { AppAnalytics.track(AppEvents.gas_fee_warning_cta_press, { flow,