Skip to content

Commit

Permalink
fix: improve step titles in custom steps
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jan 2, 2025
1 parent 588aafa commit 825856c
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions packages/widget/src/components/Step/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,47 @@ export const Step: React.FC<{
)

const getCardTitle = () => {
const hasBridgeStep = step.includedSteps.some(
(step) => step.type === 'cross'
)
const hasSwapStep = step.includedSteps.some((step) => step.type === 'swap')
const hasCustomStep = step.includedSteps.some(
(step) => step.type === 'custom'
)

const isCustomVariant = hasCustomStep && subvariant === 'custom'

switch (step.type) {
case 'lifi': {
const hasBridgeStep = step.includedSteps.some(
(step) => step.type === 'cross'
)
const hasSwapStep = step.includedSteps.some(
(step) => step.type === 'swap'
)
if (hasBridgeStep && hasSwapStep) {
return subvariant === 'custom'
return isCustomVariant
? subvariantOptions?.custom === 'deposit'
? t('main.stepBridgeAndDeposit')
: t('main.stepBridgeAndBuy')
: t('main.stepSwapAndBridge')
}
if (hasBridgeStep) {
return subvariant === 'custom'
return isCustomVariant
? subvariantOptions?.custom === 'deposit'
? t('main.stepBridgeAndDeposit')
: t('main.stepBridgeAndBuy')
: t('main.stepBridge')
}
return subvariant === 'custom'
if (hasSwapStep) {
return isCustomVariant
? subvariantOptions?.custom === 'deposit'
? t('main.stepSwapAndDeposit')
: t('main.stepSwapAndBuy')
: t('main.stepSwap')
}
return isCustomVariant
? subvariantOptions?.custom === 'deposit'
? t('main.stepSwapAndDeposit')
: t('main.stepSwapAndBuy')
? t('main.stepDeposit')
: t('main.stepBuy')
: t('main.stepSwap')
}
default:
return subvariant === 'custom'
return isCustomVariant
? subvariantOptions?.custom === 'deposit'
? t('main.stepDeposit')
: t('main.stepBuy')
Expand Down

0 comments on commit 825856c

Please sign in to comment.