Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Show "Sending..." state immediately after clicking the send but… #7065

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zly199
Copy link

@zly199 zly199 commented Nov 22, 2024

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR modifies the behavior of the "Send" button for sending verification codes. Now, when the button is clicked, it immediately shows a "Sending..." state, improving user experience by providing instant feedback. After a successful request, a countdown is displayed. This makes the process clearer for users and reduces confusion during waiting time.

Which issue(s) this PR fixes:
Fixes #7064

Special notes for your reviewer:
Please review the implementation for consistent UI behavior and ensure no race conditions occur if the button is clicked multiple times quickly.

Does this PR introduce a user-facing change?
Improved user experience for sending verification codes: the button now immediately shows "

…ton, start countdown only after successful request
@f2c-ci-robot f2c-ci-robot bot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 22, 2024
Copy link

f2c-ci-robot bot commented Nov 22, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@f2c-ci-robot f2c-ci-robot bot requested review from LIlGG and ruibaby November 22, 2024 14:43
@f2c-ci-robot f2c-ci-robot bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Nov 22, 2024
Copy link

f2c-ci-robot bot commented Nov 22, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign guqing for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

sendRequest()
.then(() => {
startCountdown();
Toast.success(i18nResources.sendVerificationCodeSuccess);
})
.catch((e) => {
button.disabled = false;
button.textContent = "Send";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

完善 i18n,或者在首次更改 button.textContent 之前缓存一下按钮的原始文字(推荐),比如:

function sendVerificationCode(button, sendRequest) {
    let timer;
    const countdown = 60;
    let originalButtonText = button.textContent;

    button.addEventListener("click", () => {
        button.disabled = true;
        button.textContent = "Sending...";
        sendRequest()
            .then(() => {
                startCountdown();
                Toast.success(i18nResources.sendVerificationCodeSuccess);
            })
            .catch((e) => {
                button.disabled = false;
                button.textContent = originalButtonText;
                ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面的 startCountdown 方法中设置 button.textContent 似乎也没有 i18n,建议帮忙修改下。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已做修改, 麻烦再看下了.

@@ -93,13 +93,15 @@ function sendVerificationCode(button, sendRequest) {

button.addEventListener("click", () => {
button.disabled = true;
button.textContent = "Sending...";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

完善 i18n。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已做修改, 麻烦再看下了.

Copy link

sonarcloud bot commented Nov 27, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

注册页面, 点击邮件发送按钮, 如果邮件服务器响应时间过长, 页面假死, 且没有提示
3 participants