Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
finnian0826 committed Jan 7, 2025
1 parent 33ce118 commit 2272935
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/components/GasFeeWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -64,6 +59,7 @@ function GasFeeWarning({
}
} else {
return {
title,
description: t('gasFeeWarning.descriptionMaxAmount', {
context: flow,
tokenSymbol: feeCurrency.symbol,
Expand All @@ -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,
Expand Down

0 comments on commit 2272935

Please sign in to comment.