diff --git a/components/offramp/offramp-page-client.tsx b/components/offramp/offramp-page-client.tsx index 218b5ab..a75122c 100644 --- a/components/offramp/offramp-page-client.tsx +++ b/components/offramp/offramp-page-client.tsx @@ -94,6 +94,14 @@ export function OfframpPageClient() { const [showConfirmDialog, setShowConfirmDialog] = useState(false) const [isSubmitting, setIsSubmitting] = useState(false) + const [showConfirmDialog, setShowConfirmDialog] = useState(false) + + // Show the confirmation summary first; the order is only created after + // the user explicitly confirms in the dialog. + const handleInitialSubmit = () => { + if (!form.isValid || isSubmitting) return + setShowConfirmDialog(true) + } const handleInitialSubmit = () => { if (!form.isValid || isSubmitting) return @@ -137,6 +145,9 @@ export function OfframpPageClient() { localStorage.setItem(ORDER_KEY, JSON.stringify(order)) localStorage.setItem(`offramp:order:${order.id}`, JSON.stringify(order)) + + setShowConfirmDialog(false) + router.push(`/offramp/bank-details?order=${order.id}`) } catch (err) { console.error('Offramp order creation failed:', err) @@ -274,55 +285,72 @@ export function OfframpPageClient() { - Confirm Order + Confirm your withdrawal - Please review the details of your transaction before submitting. + Review the details below. Your order will only be created after you confirm. - -
-
+ +
+
You are selling - {form.state.amountInput || '0'} {selectedAsset.asset} + + {form.state.amountInput || '0'} {selectedAsset.asset} +
- -
+ +
You will receive - {formatCurrency(form.fees.receiveAmount, form.state.fiatCurrency)} + + {formatCurrency(form.fees.receiveAmount, form.state.fiatCurrency)} +
- -
- Exchange Rate + +
+ Exchange rate
-
1 {selectedAsset.asset} = {formatCurrency(rate || 0, form.state.fiatCurrency)}
+
+ 1 {selectedAsset.asset} = {formatCurrency(rate || 0, form.state.fiatCurrency)} +
- Lock: {lockCountdown !== null ? formatRateCountdown(lockCountdown) : '15:00 on submit'} + Rate lock:{' '} + {lockCountdown !== null + ? formatRateCountdown(lockCountdown) + : '15:00 on submit'}
- -
- Network Fee - {formatCurrency(form.fees.networkFee, form.state.fiatCurrency)} + +
+ Network fee + + {formatCurrency(form.fees.networkFee, form.state.fiatCurrency)} +
-
- Destination Bank - To be provided next +
+ Destination bank account + + Entered on the next step +
-
- Estimated Time - 1-3 Business Days +
+ Estimated completion + 1–3 business days
- -
-
diff --git a/components/onramp/onramp-page-client.tsx b/components/onramp/onramp-page-client.tsx index a3113a8..a3e5ec5 100644 --- a/components/onramp/onramp-page-client.tsx +++ b/components/onramp/onramp-page-client.tsx @@ -121,6 +121,14 @@ export function OnrampPageClient() { const [showConfirmDialog, setShowConfirmDialog] = useState(false) const [isSubmitting, setIsSubmitting] = useState(false) + const [showConfirmDialog, setShowConfirmDialog] = useState(false) + + // Show the confirmation summary first; the order is only created after + // the user explicitly confirms in the dialog. + const handleInitialSubmit = () => { + if (!form.isValid || isSubmitting) return + setShowConfirmDialog(true) + } const handleInitialSubmit = () => { if (!form.isValid || isSubmitting) return @@ -188,6 +196,8 @@ export function OnrampPageClient() { localStorage.setItem(ORDER_KEY, JSON.stringify(order)) localStorage.setItem(`onramp:order:${order.id}`, JSON.stringify(order)) + setShowConfirmDialog(false) + // Follow correct workflow: Calculator → Payment Instructions → Processing → Success router.push(`/onramp/payment?order=${order.id}`) } catch (err) { @@ -401,53 +411,75 @@ export function OnrampPageClient() { - Confirm Order + Confirm your order - Please review the details of your transaction before submitting. + Review the details below. Your order will only be created after you confirm. - -
-
+ +
+
You are paying - {formatCurrency(form.fees.totalCost, form.state.fiatCurrency)} + + {formatCurrency(form.fees.totalCost, form.state.fiatCurrency)} +
- -
+ +
You will receive - {form.cryptoAmount} {form.state.cryptoAsset} + + {form.cryptoAmount} {form.state.cryptoAsset} +
- -
- Exchange Rate + +
+ Exchange rate
-
1 {form.state.cryptoAsset} = {formatCurrency(data?.rate || 0, form.state.fiatCurrency)}
-
Updates in {countdown}s
+
+ 1 {form.state.cryptoAsset} ={' '} + {formatCurrency(data?.rate || 0, form.state.fiatCurrency)} +
+
+ {countdown > 0 ? `Rate updates in ${countdown}s` : 'Refreshing rate…'} +
- -
- Network Fee - {formatCurrency(form.fees.networkFee, form.state.fiatCurrency)} + +
+ Processing fee + {processingFeeLabel}
-
- Destination Address - {address} +
+ Network fee + + {formatCurrency(form.fees.networkFee, form.state.fiatCurrency)} +
-
- Estimated Time - Seconds +
+ Destination address + + {address || 'Connect wallet'} + +
+ +
+ Estimated completion + A few seconds
- -
-