From bc93b9b65a5ec59306062dbdfd7fc6f1f68dcddc Mon Sep 17 00:00:00 2001 From: kayra1 Date: Thu, 1 Aug 2024 21:36:57 +0300 Subject: [PATCH] add stylings from other form components --- ui/src/app/onboarding/page.tsx | 79 ++++++++++++++++++++++------------ ui/src/app/users/asideForm.tsx | 3 +- 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/ui/src/app/onboarding/page.tsx b/ui/src/app/onboarding/page.tsx index 522726d..74bcc49 100644 --- a/ui/src/app/onboarding/page.tsx +++ b/ui/src/app/onboarding/page.tsx @@ -4,6 +4,7 @@ import { useState, ChangeEvent } from "react" import { postFirstUser } from "../queries" import { useMutation } from "react-query" import { useRouter } from "next/navigation" +import { passwordIsValid } from "../utils" export default function Onboarding() { @@ -22,6 +23,7 @@ export default function Onboarding() { const [password2, setPassword2] = useState("") const passwordsMatch = password1 === password2 const [errorText, setErrorText] = useState("") + const [showPassword1, setShowPassword1] = useState(false) const handleUsernameChange = (event: ChangeEvent) => { setUsername(event.target.value) } const handlePassword1Change = (event: ChangeEvent) => { setPassword1(event.target.value) } const handlePassword2Change = (event: ChangeEvent) => { setPassword2(event.target.value) } @@ -43,35 +45,56 @@ export default function Onboarding() {
Please create an admin user to get started
-
-
- - - - -

- Password must have 8 or more characters, must include at least one capital letter, one lowercase letter, and either a number or a symbol. -

- - - {!passwordsMatch &&

Passwords do not match

} - {errorText && -
-
-
Error
-

{errorText.split("error: ")}

-
+ +
+
+ + +
+ +
- } - {!passwordsMatch ? ( - <> - - - ) : ( - - ) - } -
+ +

+ Password must have 8 or more characters, must include at least one capital letter, one lowercase letter, and either a number or a symbol. +

+ + + {!passwordIsValid(password1) && password1 != "" &&

Password is not valid

} + {passwordIsValid(password1) && !passwordsMatch && password2 != "" &&

Passwords do not match

} + {errorText && +
+
+
Error
+

{errorText.split("error: ")}

+
+
+ } + {!passwordsMatch || !passwordIsValid(password1) ? ( + <> + + + ) : ( + + )} +
+
diff --git a/ui/src/app/users/asideForm.tsx b/ui/src/app/users/asideForm.tsx index 1ba11f2..c3cd905 100644 --- a/ui/src/app/users/asideForm.tsx +++ b/ui/src/app/users/asideForm.tsx @@ -101,8 +101,7 @@ function AddNewUserForm() { ) : ( - ) - } + )} )