diff --git a/src/app/[locale]/auth/forget/ForgetForm.tsx b/src/app/[locale]/auth/forget/ForgetForm.tsx index 0907e18..30bdefa 100644 --- a/src/app/[locale]/auth/forget/ForgetForm.tsx +++ b/src/app/[locale]/auth/forget/ForgetForm.tsx @@ -1,7 +1,188 @@ -import React from "react"; +"use client"; +import LanguageSwitcher from "@/components/LanguageSwitcher"; +import { useTranslations } from "next-intl"; +import Link from "next/link"; +import React, { useEffect, useState } from "react"; const ForgetForm = () => { - return
ForgetForm
; + const t = useTranslations("Auth"); + const [second, setSecond] = useState(0); + const [show, setShow] = useState({ + password: false, + refirmPassword: false, + }); + const [signUpForm, setSignUpForm] = useState({ + email: "", + password: "", + refirmPassword: "", + verifyCode: "", + }); + + const pressToSendCode = () => { + second === 0 && setSecond(60); + }; + + useEffect(() => { + if (second > 0) { + const interval = setTimeout(() => { + setSecond((prev) => prev - 1); + if (second === 0) clearInterval(interval); + }, 1000); + return () => clearInterval(interval); + } + }, [second]); + + return ( +
+

{t("forget_title")}

+
+ + setSignUpForm({ ...signUpForm, email: e.target.value }) + } + /> +
+ + setSignUpForm({ ...signUpForm, password: e.target.value }) + } + /> + +
+ +
+ + setSignUpForm({ ...signUpForm, refirmPassword: e.target.value }) + } + /> + +
+ +
+ + setSignUpForm({ ...signUpForm, verifyCode: e.target.value }) + } + /> +
+ {second === 0 ? t("send_code") : `${second} s`} +
+
+ + + +
+

{t("already_have")}

+ + {t("login")} + +
+ +
+ +
+
+
+ ); }; export default ForgetForm; diff --git a/src/app/[locale]/auth/forget/page.tsx b/src/app/[locale]/auth/forget/page.tsx index bf29896..96ac5dc 100644 --- a/src/app/[locale]/auth/forget/page.tsx +++ b/src/app/[locale]/auth/forget/page.tsx @@ -1,7 +1,19 @@ +import { getTranslator } from "next-intl/server"; import React from "react"; +import ForgetForm from "./ForgetForm"; const Index = () => { - return
Index
; + return ; }; +export async function generateMetadata({ params: { locale } }: any) { + const t = await getTranslator(locale, "Auth"); + + return { + title: t("forget_title"), + description: "asdfsadf", + keywords: ["a", "b", "c"], + }; +} + export default Index; diff --git a/src/app/[locale]/auth/login/LoginForm.tsx b/src/app/[locale]/auth/login/LoginForm.tsx index 937c842..d7932ef 100644 --- a/src/app/[locale]/auth/login/LoginForm.tsx +++ b/src/app/[locale]/auth/login/LoginForm.tsx @@ -81,10 +81,7 @@ const LoginForm = () => {
- { - // TODO: add link - } - {t("forget")} + {t("forget")}
diff --git a/src/app/[locale]/auth/signup/SignupForm.tsx b/src/app/[locale]/auth/signup/SignupForm.tsx index e5298d1..2b27578 100644 --- a/src/app/[locale]/auth/signup/SignupForm.tsx +++ b/src/app/[locale]/auth/signup/SignupForm.tsx @@ -169,10 +169,7 @@ const SignupForm = () => {
- { - // TODO: add link - } - {t("forget")} + {t("forget")}
diff --git a/src/languages/en.json b/src/languages/en.json index 799e0f3..372f14d 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -15,6 +15,10 @@ "confirm_password": "Confirm Password", "already_have": "Already have an account?", "verify_code": "Verify Code", - "send_code": "Send" + "send_code": "Send", + "forget_title": "Forget", + "reset_password": "Reset Password", + "new_password": "New Password", + "confirm_new_password": "Confirm New Password" } } diff --git a/src/languages/zh-HK.json b/src/languages/zh-HK.json index 2ad989d..f5c6b17 100644 --- a/src/languages/zh-HK.json +++ b/src/languages/zh-HK.json @@ -5,7 +5,7 @@ "Auth": { "title": "登錄", "subtitle": "如果您已有帳號,請登錄", - "email": "電子郵件", + "email": "電子郵箱", "password": "密碼", "login": "登錄", "forget": "忘記密碼?", @@ -15,6 +15,10 @@ "confirm_password": "確認密碼", "already_have": "已有帳號?", "verify_code": "驗證碼", - "send_code": "發送" + "send_code": "發送", + "forget_title": "忘記密碼", + "reset_password": "重設密碼", + "new_password": "新密碼", + "confirm_new_password": "確認新密碼" } }