From 34fb5fba79ce354191cebdc44883b71c550f4323 Mon Sep 17 00:00:00 2001
From: Nguyễn Hoàng Đức <lazyc97@protonmail.com>
Date: Mon, 16 Sep 2024 00:16:21 +0700
Subject: fix(web): Better message when signups are disabled (#374)

* Clear disabled signups message

* Change the message and center it

---------

Co-authored-by: MohamedBassem <me@mbassem.com>
---
 apps/web/components/signin/CredentialsForm.tsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'apps/web/components/signin/CredentialsForm.tsx')

diff --git a/apps/web/components/signin/CredentialsForm.tsx b/apps/web/components/signin/CredentialsForm.tsx
index 65fec6a8..a505f699 100644
--- a/apps/web/components/signin/CredentialsForm.tsx
+++ b/apps/web/components/signin/CredentialsForm.tsx
@@ -108,7 +108,6 @@ function SignIn() {
 }
 
 function SignUp() {
-  const clientConfig = useClientConfig();
   const form = useForm<z.infer<typeof zSignUpSchema>>({
     resolver: zodResolver(zSignUpSchema),
   });
@@ -212,11 +211,7 @@ function SignUp() {
               );
             }}
           />
-          <ActionButton
-            type="submit"
-            loading={form.formState.isSubmitting}
-            disabled={clientConfig.auth.disableSignups}
-          >
+          <ActionButton type="submit" loading={form.formState.isSubmitting}>
             Sign Up
           </ActionButton>
         </div>
@@ -226,6 +221,8 @@ function SignUp() {
 }
 
 export default function CredentialsForm() {
+  const clientConfig = useClientConfig();
+
   return (
     <Tabs defaultValue="signin" className="w-full">
       <TabsList className="grid w-full grid-cols-2">
@@ -236,7 +233,11 @@ export default function CredentialsForm() {
         <SignIn />
       </TabsContent>
       <TabsContent value="signup">
-        <SignUp />
+        {clientConfig.auth.disableSignups ? (
+          <p className="text-center">Signups are currently disabled.</p>
+        ) : (
+          <SignUp />
+        )}
       </TabsContent>
     </Tabs>
   );
-- 
cgit v1.2.3-70-g09d2

