Skip to content

Commit

Permalink
Update default pricing selection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonmanRolls committed Feb 5, 2025
1 parent 606819a commit e14a504
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ tsconfig.vitest-temp.json
.sentryclirc

.dev.vars

certificates
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,6 @@ const Pricing = ({
const hasPendingMoonpayTransaction = moonpayTransactionStatus === 'pending'
const hasFailedMoonpayTransaction = moonpayTransactionStatus === 'failed'

const previousMoonpayTransactionStatus = usePrevious(moonpayTransactionStatus)

const [paymentMethodChoice, setPaymentMethodChoice] = useState<PaymentMethod>(
hasPendingMoonpayTransaction || !balance?.value
? PaymentMethod.moonpay
Expand All @@ -548,21 +546,12 @@ const Pricing = ({

// Keep radio button choice up to date
useEffect(() => {
if (moonpayTransactionStatus) {
setPaymentMethodChoice(
hasPendingMoonpayTransaction || hasFailedMoonpayTransaction || !balance?.value
? PaymentMethod.moonpay
: PaymentMethod.ethereum,
)
}
}, [
balance,
hasFailedMoonpayTransaction,
hasPendingMoonpayTransaction,
moonpayTransactionStatus,
previousMoonpayTransactionStatus,
setPaymentMethodChoice,
])
setPaymentMethodChoice(
hasPendingMoonpayTransaction || hasFailedMoonpayTransaction || !balance?.value
? PaymentMethod.moonpay
: PaymentMethod.ethereum,
)
}, [balance, hasFailedMoonpayTransaction, hasPendingMoonpayTransaction, setPaymentMethodChoice])

const fullEstimate = useEstimateFullRegistration({
name,
Expand Down

0 comments on commit e14a504

Please sign in to comment.