11'use client'
22
3- import { SyntheticEvent , useEffect , useState } from "react"
3+ import { SyntheticEvent , Suspense , useEffect , useState } from "react"
44import { useClient , FormLoading , ErrorSummary , TextInput , PrimaryButton , SecondaryButton , ApiStateContext } from "@servicestack/react"
55import { serializeToObject , leftPart , rightPart , toPascalCase } from "@servicestack/client"
66import { useRouter , useSearchParams } from "next/navigation"
@@ -9,7 +9,7 @@ import { getRedirect } from "@/lib/gateway"
99import { Register , RegisterResponse } from "@/lib/dtos"
1010import { appAuth , Redirecting } from "@/lib/auth"
1111
12- export default function SignUp ( ) {
12+ function SignUpContent ( ) {
1313
1414 const client = useClient ( )
1515 const [ displayName , setDisplayName ] = useState < string > ( )
@@ -58,45 +58,57 @@ export default function SignUp() {
5858 }
5959 }
6060
61- return ( < Page title = "Sign Up" >
62- < ApiStateContext . Provider value = { client } >
63- < section className = "mt-4 max-w-xl sm:shadow overflow-hidden sm:rounded-md" >
64- < form onSubmit = { onSubmit } className = "max-w-prose" >
65- < div className = "shadow overflow-hidden sm:rounded-md" >
66- < ErrorSummary except = "displayName,userName,password,confirmPassword" />
67- < div className = "px-4 py-5 bg-white dark:bg-black space-y-6 sm:p-6" >
68- < h3 className = "mb-4 text-2xl font-semibold text-gray-900 dark:text-gray-100 leading-tight" >
69- Create a new account.
70- </ h3 >
71- < div className = "flex flex-col gap-y-4" >
72- < TextInput id = "displayName" help = "Your first and last name" autoComplete = "name"
73- value = { displayName } onChange = { setDisplayName } />
74- < TextInput id = "userName" autoComplete = "email"
75- value = { username } onChange = { setUsername } />
76- < TextInput id = "password" type = "password" help = "6 characters or more"
77- autoComplete = "new-password"
78- value = { password } onChange = { setPassword } />
79- < TextInput id = "confirmPassword" type = "password" value = { confirmPassword } onChange = { setConfirmPassword } />
61+ return (
62+ < >
63+ < ApiStateContext . Provider value = { client } >
64+ < section className = "mt-4 max-w-xl sm:shadow overflow-hidden sm:rounded-md" >
65+ < form onSubmit = { onSubmit } className = "max-w-prose" >
66+ < div className = "shadow overflow-hidden sm:rounded-md" >
67+ < ErrorSummary except = "displayName,userName,password,confirmPassword" />
68+ < div className = "px-4 py-5 bg-white dark:bg-black space-y-6 sm:p-6" >
69+ < h3 className = "mb-4 text-2xl font-semibold text-gray-900 dark:text-gray-100 leading-tight" >
70+ Create a new account.
71+ </ h3 >
72+ < div className = "flex flex-col gap-y-4" >
73+ < TextInput id = "displayName" help = "Your first and last name" autoComplete = "name"
74+ value = { displayName } onChange = { setDisplayName } />
75+ < TextInput id = "userName" autoComplete = "email"
76+ value = { username } onChange = { setUsername } />
77+ < TextInput id = "password" type = "password" help = "6 characters or more"
78+ autoComplete = "new-password"
79+ value = { password } onChange = { setPassword } />
80+ < TextInput id = "confirmPassword" type = "password" value = { confirmPassword } onChange = { setConfirmPassword } />
81+ </ div >
8082 </ div >
81- </ div >
82- < div className = "pt-5 px-4 py-3 bg-gray-50 dark:bg-gray-900 text-right sm:px-6 " >
83- < div className = "flex justify-end" >
84- { client . loading ? < FormLoading className = "flex-1" /> : null }
85- < PrimaryButton className = "ml-3" > Sign Up </ PrimaryButton >
83+ < div className = "pt-5 px-4 py-3 bg-gray-50 dark:bg-gray-900 text-right sm:px-6" >
84+ < div className = "flex justify-end " >
85+ { client . loading ? < FormLoading className = "flex-1" /> : null }
86+ < PrimaryButton className = "ml-3" > Sign Up </ PrimaryButton >
87+ </ div >
8688 </ div >
8789 </ div >
88- </ div >
89- </ form >
90- </ section >
91- </ ApiStateContext . Provider >
90+ </ form >
91+ </ section >
92+ </ ApiStateContext . Provider >
9293
93- < div className = "flex mt-8 ml-8" >
94- < h3 className = "mr-4 leading-8 text-gray-500 dark:text-gray-400" > Quick Links</ h3 >
95- < div className = "flex flex-wrap max-w-lg gap-2" >
96- < SecondaryButton onClick = { ( ) => setUser ( '[email protected] ' ) } > 97- 98- </ SecondaryButton >
94+ < div className = "flex mt-8 ml-8" >
95+ < h3 className = "mr-4 leading-8 text-gray-500 dark:text-gray-400" > Quick Links</ h3 >
96+ < div className = "flex flex-wrap max-w-lg gap-2" >
97+ < SecondaryButton onClick = { ( ) => setUser ( '[email protected] ' ) } > 98+ 99+ </ SecondaryButton >
100+ </ div >
99101 </ div >
100- </ div >
101- </ Page > )
102+ </ >
103+ )
104+ }
105+
106+ export default function SignUp ( ) {
107+ return (
108+ < Page title = "Sign Up" >
109+ < Suspense fallback = { < div > Loading...</ div > } >
110+ < SignUpContent />
111+ </ Suspense >
112+ </ Page >
113+ )
102114}
0 commit comments