From 7d17e81f4ba29c0345f67814c134ded61ea2c29c Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 14 Mar 2025 18:17:48 +0800 Subject: [PATCH] . --- .../auth/sign-up/[[...sign-up]]/page.tsx | 4 +- .../[locale]/auth/sign-up/email-signup.tsx | 27 +- .../app/[locale]/auth/sign-up/mix-signup.tsx | 270 ++++++++++++++++++ apps/blogai/app/[locale]/page.tsx | 61 +--- apps/blogai/locales/en/common.json | 5 +- apps/blogai/locales/zh-CN/common.json | 5 +- 6 files changed, 291 insertions(+), 81 deletions(-) create mode 100644 apps/blogai/app/[locale]/auth/sign-up/mix-signup.tsx diff --git a/apps/blogai/app/[locale]/auth/sign-up/[[...sign-up]]/page.tsx b/apps/blogai/app/[locale]/auth/sign-up/[[...sign-up]]/page.tsx index 071e43e..758a99e 100644 --- a/apps/blogai/app/[locale]/auth/sign-up/[[...sign-up]]/page.tsx +++ b/apps/blogai/app/[locale]/auth/sign-up/[[...sign-up]]/page.tsx @@ -35,15 +35,15 @@ export default function AuthenticationPage() {

*/} +
- void; -// setVerification: (b: boolean) => void; -// }; - -// export const EmailSignUp: React.FC = ({ setError, setVerification, emailValue, passwordValue }) => { export function EmailSignUp(props: { setError: (e: string | null) => void; @@ -30,7 +23,6 @@ export function EmailSignUp(props: { emailValue: string; passwordValue: string; }) { - // const { signUp, isLoaded: signUpLoaded, setActive } = useSignUp(); const [isLoading, setIsLoading] = React.useState(false); const [showPassword, setShowPassword] = React.useState(false); @@ -45,9 +37,11 @@ export function EmailSignUp(props: { const signUpFromParams = async () => { const ticket = new URL(window.location.href).searchParams.get("__clerk_ticket"); const emailParam = new URL(window.location.href).searchParams.get("email"); + if (!ticket && !emailParam) { return; } + if (ticket) { // await signUp // ?.create({ @@ -185,7 +179,6 @@ export function EmailSignUp(props: { const email = new FormData(e.currentTarget).get("email"); if ( - typeof email !== "string" // typeof first !== "string" || // typeof last !== "string" @@ -200,9 +193,11 @@ export function EmailSignUp(props: { }}>
+ + +
@@ -225,6 +221,7 @@ export function EmailSignUp(props: { {/* {isLoading ? : "Sign Up with Email"} */} {t("next")} + :
{ e.preventDefault(); const password = new FormData(e.currentTarget).get("password"); @@ -236,11 +233,7 @@ export function EmailSignUp(props: { toast.error("two passwords do not match") return } - await signUpWithCode(props.emailValue, password) - - - setGoPassword(false) }} > @@ -268,11 +261,11 @@ export function EmailSignUp(props: {
+ +
+
+ + :
{ + e.preventDefault(); + const password = new FormData(e.currentTarget).get("password"); + const confirmPassword = new FormData(e.currentTarget).get("confirmPassword"); + + console.log("------1", props.emailValue, password, confirmPassword) + + if (typeof password !== "string" || password != confirmPassword) { + toast.error("two passwords do not match") + return + } + await signUpWithCode(props.emailValue, password) + setGoPassword(false) + }} > + +
+ +
+ + show { + setShowPassword(!showPassword) + // toast.success('coming soon') + }} /> +
+
+ +
+ + + +
+ + show { + setShowPassword2(!showPassword2) + // toast.success('coming soon') + }} /> +
+ +
+ + + +
} + + + ); +}; diff --git a/apps/blogai/app/[locale]/page.tsx b/apps/blogai/app/[locale]/page.tsx index e94e188..f48e573 100644 --- a/apps/blogai/app/[locale]/page.tsx +++ b/apps/blogai/app/[locale]/page.tsx @@ -131,7 +131,9 @@ export default async function ChatIndexPage({ params: { locale } }: { params: {
+