11"use client" ;
22
3- import { useEffect , useState } from "react" ;
3+ import { Suspense , useEffect , useState } from "react" ;
44import Link from "next/link" ;
55import { useSearchParams } from "next/navigation" ;
66import { Navbar } from "@/components/landing/Navbar" ;
77import { Footer } from "@/components/landing/Footer" ;
88import { Button } from "@/components/ui/button" ;
99import { CheckCircle2 , Loader2 } from "lucide-react" ;
1010
11- export default function CheckoutSuccessPage ( ) {
11+ function CheckoutSuccessContent ( ) {
1212 const searchParams = useSearchParams ( ) ;
1313 const sessionId = searchParams . get ( "session_id" ) ;
1414 const [ isVerifying , setIsVerifying ] = useState ( ! ! sessionId ) ;
@@ -23,47 +23,61 @@ export default function CheckoutSuccessPage() {
2323 } , [ sessionId ] ) ;
2424
2525 return (
26- < div className = "min-h-screen bg-white dark:bg-gray-900 flex flex-col" >
27- < Navbar />
28- < main className = "flex-1 flex items-center justify-center px-4 py-20" >
29- < div className = "max-w-lg w-full text-center" >
30- < div className = "mb-8" >
31- { isVerifying ? (
32- < div className = "mx-auto w-16 h-16 rounded-full bg-indigo-100 dark:bg-indigo-900/50 flex items-center justify-center" >
33- < Loader2
34- className = "h-8 w-8 text-indigo-600 dark:text-indigo-400 animate-spin"
35- aria-hidden
36- />
37- </ div >
38- ) : (
39- < div className = "mx-auto w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center" >
40- < CheckCircle2
41- className = "h-10 w-10 text-green-600 dark:text-green-400"
42- aria-hidden
43- />
44- </ div >
45- ) }
46- </ div >
47- < h1 className = "text-3xl font-bold text-gray-900 dark:text-white mb-2" >
48- { isVerifying ? "Confirming your subscription…" : "Payment successful" }
49- </ h1 >
50- < p className = "text-lg text-gray-600 dark:text-gray-400 mb-8" >
51- { isVerifying
52- ? "Please wait while we verify your payment."
53- : "Thank you for upgrading to SmartQuery Pro. Your account has been updated with Pro features." }
54- </ p >
55- { ! isVerifying && (
56- < div className = "flex flex-col sm:flex-row gap-4 justify-center" >
57- < Button asChild className = "bg-indigo-600 hover:bg-indigo-700" >
58- < Link href = "/dashboard" > Go to Dashboard</ Link >
59- </ Button >
60- < Button variant = "outline" asChild >
61- < Link href = "/workspace" > Open Workspace</ Link >
62- </ Button >
26+ < main className = "flex-1 flex items-center justify-center px-4 py-20" >
27+ < div className = "max-w-lg w-full text-center" >
28+ < div className = "mb-8" >
29+ { isVerifying ? (
30+ < div className = "mx-auto w-16 h-16 rounded-full bg-indigo-100 dark:bg-indigo-900/50 flex items-center justify-center" >
31+ < Loader2
32+ className = "h-8 w-8 text-indigo-600 dark:text-indigo-400 animate-spin"
33+ aria-hidden
34+ />
35+ </ div >
36+ ) : (
37+ < div className = "mx-auto w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center" >
38+ < CheckCircle2
39+ className = "h-10 w-10 text-green-600 dark:text-green-400"
40+ aria-hidden
41+ />
6342 </ div >
6443 ) }
6544 </ div >
66- </ main >
45+ < h1 className = "text-3xl font-bold text-gray-900 dark:text-white mb-2" >
46+ { isVerifying ? "Confirming your subscription…" : "Payment successful" }
47+ </ h1 >
48+ < p className = "text-lg text-gray-600 dark:text-gray-400 mb-8" >
49+ { isVerifying
50+ ? "Please wait while we verify your payment."
51+ : "Thank you for upgrading to SmartQuery Pro. Your account has been updated with Pro features." }
52+ </ p >
53+ { ! isVerifying && (
54+ < div className = "flex flex-col sm:flex-row gap-4 justify-center" >
55+ < Button asChild className = "bg-indigo-600 hover:bg-indigo-700" >
56+ < Link href = "/dashboard" > Go to Dashboard</ Link >
57+ </ Button >
58+ < Button variant = "outline" asChild >
59+ < Link href = "/workspace" > Open Workspace</ Link >
60+ </ Button >
61+ </ div >
62+ ) }
63+ </ div >
64+ </ main >
65+ ) ;
66+ }
67+
68+ export default function CheckoutSuccessPage ( ) {
69+ return (
70+ < div className = "min-h-screen bg-white dark:bg-gray-900 flex flex-col" >
71+ < Navbar />
72+ < Suspense
73+ fallback = {
74+ < main className = "flex-1 flex items-center justify-center px-4 py-20" >
75+ < Loader2 className = "h-8 w-8 text-indigo-600 animate-spin" />
76+ </ main >
77+ }
78+ >
79+ < CheckoutSuccessContent />
80+ </ Suspense >
6781 < Footer />
6882 </ div >
6983 ) ;
0 commit comments