File size: 2,624 Bytes
bcce530
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { StackHandler } from "@stackframe/stack"
import { stackServerApp } from "@/lib/stack-server"

// Custom loading component for OAuth callbacks
function CustomLoading() {
    return (
        <div className="min-h-screen flex items-center justify-center bg-background px-4">
            <div className="text-center space-y-6 max-w-md">
                {/* Logo */}
                <div className="flex justify-center">
                    <div className="h-16 w-16 rounded-2xl bg-gradient-to-br from-primary to-purple-500 flex items-center justify-center shadow-lg shadow-primary/25 animate-pulse">
                        <svg className="h-8 w-8 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
                        </svg>
                    </div>
                </div>
                
                {/* Loading spinner */}
                <div className="flex justify-center">
                    <div className="relative">
                        <div className="h-12 w-12 rounded-full border-4 border-muted"></div>
                        <div className="absolute top-0 left-0 h-12 w-12 rounded-full border-4 border-primary border-t-transparent animate-spin"></div>
                    </div>
                </div>
                
                {/* Text */}
                <div className="space-y-2">
                    <h2 className="text-xl font-semibold text-foreground">
                        Signing you in...
                    </h2>
                    <p className="text-muted-foreground text-sm">
                        Please wait while we complete your authentication
                    </p>
                </div>
                
                {/* Fallback link */}
                <p className="text-xs text-muted-foreground pt-4">
                    Taking too long?{" "}
                    <a href="/" className="text-primary hover:underline font-medium">
                        Return to homepage
                    </a>
                </p>
            </div>
        </div>
    )
}

// Using type assertion for Next.js 16 compatibility
export default function Handler(props: {
    params: Promise<{ stack: string[] }>
    searchParams: Promise<Record<string, string | string[] | undefined>>
}) {
    return (
        <StackHandler 
            app={stackServerApp} 
            routeProps={props}
            fullPage={true}
        />
    )
}