1
1
"use client" ;
2
+ import { useClerk } from "@clerk/clerk-react" ;
2
3
import * as Clerk from "@clerk/elements/common" ;
3
4
import * as ClerkSignUp from "@clerk/elements/sign-up" ;
4
5
import { faGithub , faGoogle , faSpinnerThird , Icon } from "@rivet-gg/icons" ;
5
6
import { Link } from "@tanstack/react-router" ;
6
7
import { motion } from "framer-motion" ;
7
- import { cn } from "@/components" ;
8
+ import { Badge , cn , Skeleton } from "@/components" ;
8
9
import { Button } from "@/components/ui/button" ;
9
10
import {
10
11
Card ,
@@ -18,14 +19,58 @@ import { Input } from "@/components/ui/input";
18
19
import { Label } from "@/components/ui/label" ;
19
20
20
21
export function SignUp ( ) {
22
+ const clerk = useClerk ( ) ;
21
23
return (
22
24
< motion . div
23
25
className = "grid w-full grow items-center px-4 sm:justify-center"
24
26
initial = { { opacity : 0 , y : 10 } }
25
27
animate = { { opacity : 1 , y : 0 } }
26
28
exit = { { opacity : 0 , y : 10 } }
27
29
>
28
- < ClerkSignUp . Root routing = "virtual" >
30
+ < ClerkSignUp . Root
31
+ routing = "virtual"
32
+ path = "/"
33
+ fallback = {
34
+ < Card className = "w-full sm:w-96" >
35
+ < CardHeader >
36
+ < CardTitle > Welcome!</ CardTitle >
37
+ < CardDescription >
38
+ Enter your email below to login to your account.
39
+ </ CardDescription >
40
+ </ CardHeader >
41
+ < CardContent className = "grid gap-y-4" >
42
+ < div className = "grid grid-cols-2 gap-4" >
43
+ < Skeleton className = "h-10 w-full" />
44
+ < Skeleton className = "h-10 w-full" />
45
+ </ div >
46
+ < p className = "flex items-center gap-x-3 text-sm text-muted-foreground before:h-px before:flex-1 before:bg-border after:h-px after:flex-1 after:bg-border" >
47
+ or
48
+ </ p >
49
+ < div className = "space-y-2" >
50
+ < Label > Email address</ Label >
51
+ < Input disabled placeholder = "[email protected] " />
52
+ </ div >
53
+ < div className = "space-y-2" >
54
+ < Label > Password</ Label >
55
+ < Input disabled placeholder = "Your password" />
56
+ </ div >
57
+ </ CardContent >
58
+ < CardFooter >
59
+ < div className = "grid w-full gap-y-4" >
60
+ < Skeleton className = "h-10 w-full" />
61
+ < Button
62
+ variant = "link"
63
+ size = "sm"
64
+ disabled
65
+ className = "text-primary-foreground"
66
+ >
67
+ Already have an account? Sign in
68
+ </ Button >
69
+ </ div >
70
+ </ CardFooter >
71
+ </ Card >
72
+ }
73
+ >
29
74
< Clerk . Loading >
30
75
{ ( isGlobalLoading ) => (
31
76
< >
@@ -71,6 +116,13 @@ export function SignUp() {
71
116
)
72
117
}
73
118
</ Clerk . Loading >
119
+ { clerk . client
120
+ . lastAuthenticationStrategy ===
121
+ "oauth_github" ? (
122
+ < Badge className = "ml-2 absolute -top-1/2 -right-4 text-xs" >
123
+ Last used
124
+ </ Badge >
125
+ ) : null }
74
126
</ Button >
75
127
</ Clerk . Connection >
76
128
< Clerk . Connection
@@ -104,6 +156,14 @@ export function SignUp() {
104
156
)
105
157
}
106
158
</ Clerk . Loading >
159
+
160
+ { clerk . client
161
+ . lastAuthenticationStrategy ===
162
+ "oauth_google" ? (
163
+ < Badge className = "ml-2 absolute -top-1/2 -right-4 text-xs" >
164
+ Last used
165
+ </ Badge >
166
+ ) : null }
107
167
</ Button >
108
168
</ Clerk . Connection >
109
169
</ div >
@@ -174,7 +234,7 @@ export function SignUp() {
174
234
asChild
175
235
className = "text-primary-foreground"
176
236
>
177
- < Link to = "/" >
237
+ < Link to = "/login " >
178
238
Already have an account?
179
239
Sign in
180
240
</ Link >
0 commit comments