From 8c10d23868b0af97559ee299ab3871ddf072422b Mon Sep 17 00:00:00 2001 From: bunsy-0900 <148200748+bunsy-0900@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:23:39 +0700 Subject: [PATCH] ES-559 - UI Forgot Password Landing Page (#49) * feat: implement forgot password landing page * fix: remove popover for fullname * fix: fix fullname in specific lng validation * fix: fix phone number validation * fix: fix username label * fix: fix generate challenge payload * fix: add continue loading state --------- Co-authored-by: Bunsy Signed-off-by: Sreang Rathanak --- signup-ui/public/locales/en.json | 4 + signup-ui/public/locales/km.json | 4 + signup-ui/src/App.tsx | 2 +- signup-ui/src/app/AppRouter.tsx | 61 +++-- ...{active-message.tsx => action-message.tsx} | 8 +- signup-ui/src/components/ui/nav-bar.tsx | 2 +- signup-ui/src/components/ui/step.tsx | 2 +- signup-ui/src/layouts/AppLayout.tsx | 16 ++ signup-ui/src/layouts/PageLayout.tsx | 21 ++ .../src/pages/ResetPasswordPage/Otp/Otp.tsx | 3 + .../src/pages/ResetPasswordPage/Otp/index.tsx | 1 + .../ResetPassword/ResetPassword.tsx | 3 + .../ResetPasswordPage/ResetPassword/index.tsx | 1 + .../ResetPasswordConfirmation.tsx | 3 + .../ResetPasswordConfirmation/index.tsx | 1 + .../ResetPasswordPage/ResetPasswordPage.tsx | 143 ++++++++++ .../ResetPasswordPageContainer.tsx | 29 ++ .../ResetPasswordPopover.tsx | 72 +++++ .../ResetPasswordStatus.tsx | 3 + .../ResetPasswordStatus/index.tsx | 1 + .../ResetPasswordPage/UserInfo/UserInfo.tsx | 256 ++++++++++++++++++ .../ResetPasswordPage/UserInfo/index.tsx | 1 + .../src/pages/ResetPasswordPage/index.tsx | 1 + .../useResetPasswordStore.tsx | 53 ++++ .../AccountRegistrationStatus.tsx | 4 +- .../AccountRegistrationStatusLayout.tsx | 8 +- .../SignUpPage/AccountSetup/AccountSetup.tsx | 4 +- .../AccountSetupStatus/AccountSetupStatus.tsx | 4 +- signup-ui/src/pages/SignUpPage/Otp/Otp.tsx | 15 +- .../src/pages/SignUpPage/Phone/Phone.tsx | 17 +- .../SignUpPage/PhoneStatus/PhoneStatus.tsx | 10 +- signup-ui/src/pages/SignUpPage/SignUpPage.tsx | 14 +- .../pages/SignUpPage/SignUpPageContainer.tsx | 22 +- .../src/pages/SignUpPage/SignUpPopover.tsx | 10 +- .../pages/{SignUpPage => shared}/mutations.ts | 0 .../pages/{SignUpPage => shared}/queries.ts | 0 .../pages/{SignUpPage => shared}/service.ts | 0 signup-ui/src/resources.d.ts | 4 + .../ErrorPageTemplate/ErrorPageTemplate.tsx | 2 +- signup-ui/src/typings/types.ts | 40 ++- signup-ui/tsconfig.paths.json | 5 +- 41 files changed, 760 insertions(+), 90 deletions(-) rename signup-ui/src/components/ui/{active-message.tsx => action-message.tsx} (70%) create mode 100644 signup-ui/src/layouts/AppLayout.tsx create mode 100644 signup-ui/src/layouts/PageLayout.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/Otp/Otp.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/Otp/index.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPassword/ResetPassword.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPassword/index.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordConfirmation/ResetPasswordConfirmation.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordConfirmation/index.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordPage.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordPageContainer.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordPopover.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordStatus/ResetPasswordStatus.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/ResetPasswordStatus/index.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/UserInfo/UserInfo.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/UserInfo/index.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/index.tsx create mode 100644 signup-ui/src/pages/ResetPasswordPage/useResetPasswordStore.tsx rename signup-ui/src/pages/{SignUpPage => shared}/mutations.ts (100%) rename signup-ui/src/pages/{SignUpPage => shared}/queries.ts (100%) rename signup-ui/src/pages/{SignUpPage => shared}/service.ts (100%) diff --git a/signup-ui/public/locales/en.json b/signup-ui/public/locales/en.json index e81b5bea..61998739 100644 --- a/signup-ui/public/locales/en.json +++ b/signup-ui/public/locales/en.json @@ -41,13 +41,17 @@ "login": "Login", "okay": "Okay", "continue": "Continue", + "forgot_password": "Forgot Password?", + "forgot_password_description": "Please enter your 8-9 digit registered mobile number and full name.", "page_under_construction": "Page Under Construction!", "page_under_construction_detail": "Our experts are working hard to make this page available. Meanwhile, we request you to please visit after some time.", "something_went_wrong": "Something went wrong!", "something_went_wrong_detail": "Our experts are working hard to make things working again.", "attempts_left": "{attemptLeft} of {totalAttempt} attempts left", "captcha_token_validation": "Please verify that you are a human.", + "username_validation": "Please enter a valid username", "full_name_validation": "Please enter a valid name", + "full_name_in_lng_validation": "Full Name has to be in Khmer only.", "password_validation": "Please enter a valid password", "password_validation_must_match": "Passwords must match", "terms_and_conditions_validation": "You must accept the terms and conditions", diff --git a/signup-ui/public/locales/km.json b/signup-ui/public/locales/km.json index e0ebc735..afc4e1a8 100644 --- a/signup-ui/public/locales/km.json +++ b/signup-ui/public/locales/km.json @@ -41,13 +41,17 @@ "login": "ចូលគណនី", "okay": "យល់ព្រម", "continue": "បន្ត", + "forgot_password": "ភ្លេចលេខសម្ងាត់?", + "forgot_password_description": "សូមបញ្ចូលលេខទូរសព្ទដែលបានចុះឈ្មោះ 8-9 ខ្ទង់ និងឈ្មោះពេញរបស់អ្នក", "page_under_construction": "ទំព័រកំពុងសាងសង់!", "page_under_construction_detail": "អ្នកជំនាញកំពុងធ្វើការដើម្បីឱ្យទំព័រនេះអាចប្រើប្រាស់បាន។ សូមចូលម្ដងទៀតនៅពេលក្រោយ។", "something_went_wrong": "មានអ្វីមួយខុសប្រក្រតី!", "something_went_wrong_detail": "អ្នកជំនាញកំពុងធ្វើការដើម្បីឱ្យអ្វីៗដំណើរការឡើងវិញ។", "attempts_left": "ការព្យាយាមនៅសល់ {attemptLeft} នៃ {totalAttempt}", "captcha_token_validation": "សូមបញ្ជាក់ថាអ្នកជាមនុស្ស", + "username_validation": "សូមបញ្ចូលឈ្មោះអ្នកប្រើប្រាស់ត្រឹមត្រូវ", "full_name_validation": "សូមបញ្ចូលគោត្តនាម-នាមឱ្យបានត្រឹមត្រូវ", + "full_name_in_lng_validation": "គោត្តនាម-នាមត្រូវតែមានតែអក្សរខ្មែរ", "password_validation": "សូមបញ្ចូលលេខសម្ងាត់ឱ្យបានត្រឹមត្រូវ", "password_validation_must_match": "លេខចម្ងាត់ត្រូវតែដូចគ្នា", "terms_and_conditions_validation": "អ្នកត្រូវយល់ព្រមតាមលក្ខខណ្ឌ និងគោលការណ៍", diff --git a/signup-ui/src/App.tsx b/signup-ui/src/App.tsx index 8699a971..eb0e5fa3 100644 --- a/signup-ui/src/App.tsx +++ b/signup-ui/src/App.tsx @@ -18,7 +18,7 @@ import Footer from "~components/ui/footer"; const queryClient = new QueryClient({ defaultOptions: { queries: { - staleTime: Infinity, + staleTime: 60 * 1000, // set to one minutes retry: (failureCount, error) => { // Do not retry on 4xx error codes if (error instanceof HttpError && String(error.code).startsWith("4")) { diff --git a/signup-ui/src/app/AppRouter.tsx b/signup-ui/src/app/AppRouter.tsx index d7be722b..97d171d7 100644 --- a/signup-ui/src/app/AppRouter.tsx +++ b/signup-ui/src/app/AppRouter.tsx @@ -1,12 +1,26 @@ import { lazy, ReactNode, Suspense, useEffect } from "react"; -import { Route, Routes, useNavigate, useLocation, Navigate } from "react-router-dom"; +import { AppLayout } from "~layouts/AppLayout"; +import { + Navigate, + Route, + Routes, + useLocation, + useNavigate, +} from "react-router-dom"; -import { ROOT_ROUTE, SIGNUP_ROUTE, SOMETHING_WENT_WRONG, UNDER_CONSTRUCTION } from "~constants/routes"; -import Footer from "~components/ui/footer"; -import NavBar from "~components/ui/nav-bar"; +import { + RESET_PASSWORD, + ROOT_ROUTE, + SIGNUP_ROUTE, + SOMETHING_WENT_WRONG, + UNDER_CONSTRUCTION, +} from "~constants/routes"; import { lazyRetry } from "~utils/lazyRetry"; const SignUpPage = lazy(() => lazyRetry(() => import("~pages/SignUpPage"))); +const ResetPasswordPage = lazy(() => + lazyRetry(() => import("~pages/ResetPasswordPage")) +); const LandingPage = lazy(() => lazyRetry(() => import("~pages/LandingPage"))); const UnderConstructionPage = lazy(() => lazyRetry(() => import("~pages/UnderConstructionPage")) @@ -31,26 +45,23 @@ export const AppRouter = () => { }, [navigate]); return ( -
- -
- - - } /> - } - /> - } - /> - } /> - } /> - - -
-
-
+ + + }> + } /> + } /> + } + /> + } + /> + } /> + } /> + + + ); }; diff --git a/signup-ui/src/components/ui/active-message.tsx b/signup-ui/src/components/ui/action-message.tsx similarity index 70% rename from signup-ui/src/components/ui/active-message.tsx rename to signup-ui/src/components/ui/action-message.tsx index f20d033a..68c031be 100644 --- a/signup-ui/src/components/ui/active-message.tsx +++ b/signup-ui/src/components/ui/action-message.tsx @@ -2,10 +2,10 @@ import * as React from "react"; import { cn } from "~utils/cn"; -export interface ActiveMessageProps +export interface ActionMessageProps extends React.HTMLAttributes {} -const ActiveMessage = React.forwardRef( +const ActionMessage = React.forwardRef( ({ className, hidden, children, ...props }, ref) => (
( ) ); -ActiveMessage.displayName = "ActiveMessage"; +ActionMessage.displayName = "ActionMessage"; -export { ActiveMessage }; +export { ActionMessage }; diff --git a/signup-ui/src/components/ui/nav-bar.tsx b/signup-ui/src/components/ui/nav-bar.tsx index a25d3378..f1b302e2 100644 --- a/signup-ui/src/components/ui/nav-bar.tsx +++ b/signup-ui/src/components/ui/nav-bar.tsx @@ -4,7 +4,7 @@ import { Language } from "~components/language"; const NavBar = () => { return ( -