|
1 | 1 | "use client"; |
2 | 2 |
|
3 | | -import { useEffect, useState } from "react"; |
| 3 | +import { Suspense, useEffect, useState } from "react"; |
4 | 4 | import { useSearchParams } from "next/navigation"; |
5 | 5 | import Link from "next/link"; |
6 | 6 | import { CheckCircle2, Loader2, ArrowRight, Sparkles } from "lucide-react"; |
7 | 7 | import { Button } from "@/components/ui/button"; |
8 | 8 | import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; |
9 | 9 |
|
10 | | -export default function CheckoutSuccessPage() { |
| 10 | +function CheckoutSuccessContent() { |
11 | 11 | const searchParams = useSearchParams(); |
12 | 12 | const [isVerifying, setIsVerifying] = useState(true); |
13 | 13 | const [error, setError] = useState<string | null>(null); |
@@ -140,3 +140,26 @@ export default function CheckoutSuccessPage() { |
140 | 140 | </div> |
141 | 141 | ); |
142 | 142 | } |
| 143 | + |
| 144 | +function LoadingFallback() { |
| 145 | + return ( |
| 146 | + <div className="min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-muted/30"> |
| 147 | + <Card className="w-full max-w-md mx-4"> |
| 148 | + <CardContent className="pt-6"> |
| 149 | + <div className="flex flex-col items-center text-center space-y-4"> |
| 150 | + <Loader2 className="h-12 w-12 text-primary animate-spin" /> |
| 151 | + <h2 className="text-xl font-semibold">Loading...</h2> |
| 152 | + </div> |
| 153 | + </CardContent> |
| 154 | + </Card> |
| 155 | + </div> |
| 156 | + ); |
| 157 | +} |
| 158 | + |
| 159 | +export default function CheckoutSuccessPage() { |
| 160 | + return ( |
| 161 | + <Suspense fallback={<LoadingFallback />}> |
| 162 | + <CheckoutSuccessContent /> |
| 163 | + </Suspense> |
| 164 | + ); |
| 165 | +} |
0 commit comments