From 0c3179ba7c09ca7c7a72a77bc1996ea507f026c6 Mon Sep 17 00:00:00 2001 From: bunsy23 Date: Mon, 29 Jan 2024 07:29:09 +0700 Subject: [PATCH] feat: show retry after countdown is zero Signed-off-by: bunsy23 --- signup-ui/public/locales/en.json | 3 ++- signup-ui/public/locales/km.json | 3 ++- signup-ui/src/components/resend-attempt.tsx | 4 +++- signup-ui/src/pages/ResetPasswordPage/Otp/Otp.tsx | 3 ++- signup-ui/src/pages/SignUpPage/Otp/Otp.tsx | 3 ++- signup-ui/src/resources.d.ts | 1 + 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/signup-ui/public/locales/en.json b/signup-ui/public/locales/en.json index 2e285463..a5b54e36 100644 --- a/signup-ui/public/locales/en.json +++ b/signup-ui/public/locales/en.json @@ -62,7 +62,8 @@ "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, plural, =0 {0 of {totalAttempt} attempts left. Please try again after {attemptRetryAfter} minutes.} other {{attemptLeft} of {totalAttempt} attempts left}}", + "attempts_left": "{attemptLeft, plural, =0 {0 of {totalAttempt} attempts left} other {{attemptLeft} of {totalAttempt} attempts left}}", + "attempts_left_and_retry": "{attemptLeft, plural, =0 {0 of {totalAttempt} attempts left. Please try again after {attemptRetryAfter} minutes.} other {{attemptLeft} of {totalAttempt} attempts left}}", "captcha_token_validation": "Please verify that you are a human.", "username_validation": "Enter a valid username", "username_lead_zero_validation": "Number cannot start with zero. Enter a valid mobile number.", diff --git a/signup-ui/public/locales/km.json b/signup-ui/public/locales/km.json index efac5a54..c9bdb9ea 100644 --- a/signup-ui/public/locales/km.json +++ b/signup-ui/public/locales/km.json @@ -62,7 +62,8 @@ "page_under_construction_detail": "អ្នកជំនាញកំពុងធ្វើការដើម្បីឱ្យទំព័រនេះអាចប្រើប្រាស់បាន។ សូមចូលម្ដងទៀតនៅពេលក្រោយ។", "something_went_wrong": "មានអ្វីមួយខុសប្រក្រតី!", "something_went_wrong_detail": "អ្នកជំនាញកំពុងធ្វើការដើម្បីឱ្យអ្វីៗដំណើរការឡើងវិញ។", - "attempts_left": "{attemptLeft, plural, =0 {ការព្យាយាមនៅសល់ 0 នៃ {totalAttempt}។ សូមព្យាយាមម្តងទៀតនៅ {attemptRetryAfter} នាទីបន្ទាប់។} other {ការព្យាយាមនៅសល់ {attemptLeft} នៃ {totalAttempt}}}", + "attempts_left": "{attemptLeft, plural, =0 {ការព្យាយាមនៅសល់ 0 នៃ {totalAttempt}} other {ការព្យាយាមនៅសល់ {attemptLeft} នៃ {totalAttempt}}}", + "attempts_left_and_retry": "{attemptLeft, plural, =0 {ការព្យាយាមនៅសល់ 0 នៃ {totalAttempt}។ សូមព្យាយាមម្តងទៀតនៅ {attemptRetryAfter} នាទីបន្ទាប់។} other {ការព្យាយាមនៅសល់ {attemptLeft} នៃ {totalAttempt}}}", "captcha_token_validation": "សូមបញ្ជាក់ថាអ្នកជាមនុស្ស", "username_validation": "សូមបញ្ចូលឈ្មោះអ្នកប្រើប្រាស់ត្រឹមត្រូវ", "username_lead_zero_validation": "លេខមិនអាចចាប់ផ្តើមដោយលេខសូន្យបានទេ។បញ្ចូលលេខទូរស័ព្ទដែលត្រឹមត្រូវ។", diff --git a/signup-ui/src/components/resend-attempt.tsx b/signup-ui/src/components/resend-attempt.tsx index 64fa451c..cef25ff8 100644 --- a/signup-ui/src/components/resend-attempt.tsx +++ b/signup-ui/src/components/resend-attempt.tsx @@ -4,19 +4,21 @@ interface ResendAttemptProps { currentAttempts: number; totalAttempts: number; attemptRetryAfter?: number; + showRetry?: boolean; } export const ResendAttempt = ({ currentAttempts, totalAttempts, attemptRetryAfter = 300, + showRetry = false, }: ResendAttemptProps) => { const { t } = useTranslation(); return ( <> {currentAttempts < totalAttempts && (
- {t("attempts_left", { + {t(showRetry ? "attempts_left_and_retry" : "attempts_left", { attemptLeft: currentAttempts, totalAttempt: totalAttempts, attemptRetryAfter: attemptRetryAfter / 60, diff --git a/signup-ui/src/pages/ResetPasswordPage/Otp/Otp.tsx b/signup-ui/src/pages/ResetPasswordPage/Otp/Otp.tsx index 71b2ad09..59b9c120 100644 --- a/signup-ui/src/pages/ResetPasswordPage/Otp/Otp.tsx +++ b/signup-ui/src/pages/ResetPasswordPage/Otp/Otp.tsx @@ -352,9 +352,10 @@ export const Otp = ({ methods, settings }: OtpProps) => { currentAttempts={resendAttempts} totalAttempts={settings.response.configs["resend.attempts"]} attemptRetryAfter={settings.response.configs["otp.blocked"]} + showRetry={resendAttempts === 0 && resendOtpTotalSecs === 0} /> )} - {resendAttempts === 0 && ( + {resendAttempts === 0 && resendOtpTotalSecs === 0 && (