Skip to content

Commit efe117d

Browse files
committed
fix: auto-redirect to /messages after successful checkout
- Removed modal with 'Okay' button - Now automatically redirects to /messages page after purchase intent sent - Shows brief success message before redirect - User sees seller messages immediately after checkout
1 parent 73b49ce commit efe117d

1 file changed

Lines changed: 21 additions & 23 deletions

File tree

src/components/shop/PurchaseIntentButton.tsx

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,33 @@ export function PurchaseIntentButton({ disabled = false, className = '' }: Purch
4949
}
5050
};
5151

52-
53-
// Modal state for purchase intent sent
54-
const [showIntentSent, setShowIntentSent] = useState(false);
55-
56-
// Show modal when purchase intent is successful
52+
// Redirect to messages after purchase intent is sent
5753
useEffect(() => {
5854
if (success && result) {
59-
setShowIntentSent(true);
55+
logger.info('Purchase intent successful - redirecting to messages', {
56+
service: 'PurchaseIntentButton',
57+
method: 'useEffect[success]',
58+
});
59+
60+
// Redirect immediately to messages page
61+
router.push('/messages');
62+
63+
// Reset state after redirect
64+
setTimeout(() => {
65+
reset();
66+
}, 100);
6067
}
61-
}, [success, result]);
68+
}, [success, result, router, reset]);
6269

63-
// Show modal after purchase intent is sent
64-
if (showIntentSent) {
70+
// Success state - show brief message before redirect
71+
if (success && result) {
6572
return (
66-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-40">
67-
<div className="bg-white rounded-lg shadow-lg max-w-sm w-full p-6">
68-
<div className="text-lg font-bold mb-2">Purchase Intent Sent</div>
69-
<div className="mb-4 text-gray-700">
70-
Purchase intent sent. Please see messages from seller for next steps.
73+
<div className="space-y-3">
74+
<div className="flex items-start gap-2 p-4 bg-green-50 border border-green-200 rounded-md">
75+
<div className="flex-1 min-w-0">
76+
<p className="text-sm font-semibold text-green-900">Purchase Intent Sent!</p>
77+
<p className="text-xs text-green-700 mt-1">Redirecting to messages...</p>
7178
</div>
72-
<button
73-
className="btn-primary w-full"
74-
onClick={() => {
75-
setShowIntentSent(false);
76-
router.push('/messages');
77-
}}
78-
>
79-
Okay
80-
</button>
8179
</div>
8280
</div>
8381
);

0 commit comments

Comments
 (0)