Skip to content

fix: If the labels are empty for inputs then show default values and also show the last label if the inputs are in split mode in event types.#10727

Closed
ZainGulbaz wants to merge 4 commits intocalcom:mainfrom
ZainGulbaz:fix_10563
Closed

fix: If the labels are empty for inputs then show default values and also show the last label if the inputs are in split mode in event types.#10727
ZainGulbaz wants to merge 4 commits intocalcom:mainfrom
ZainGulbaz:fix_10563

Conversation

@ZainGulbaz
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR rectifies the label issue when the label for field types of config variants in field form of event's booking question is split and shows default label if the label fields are empty

Fixes # (10390)

Before:
https://www.loom.com/share/63704afcc62b4253b26477f448de94ac
After:
https://www.loom.com/share/99a142ebd593499aa741251aac07226b

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

The user can edit the event and from advanced setting he can edit the "name" field and change the label in split mode.
Add empty label in all fields or any one field.

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 12, 2023

@ZainGulbaz is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2023 10:03am

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 12, 2023

Thank you for following the naming conventions! 🙏

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 12, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@PeerRich PeerRich requested a review from hariombalhara August 14, 2023 06:23
@PeerRich PeerRich changed the title If the labels are empty for inputs then show default values and also show the last label if the inputs are in split mode in event types. fix: If the labels are empty for inputs then show default values and also show the last label if the inputs are in split mode in event types. Aug 14, 2023
@PeerRich PeerRich added the Low priority Created by Linear-GitHub Sync label Aug 14, 2023

variantField.label = variantField.label || t(defaultVariantFieldLabel || "");
const fieldTypeVariantConfig = fieldTypeVariantsConfig?.variants[variantName];
variantField.label = getVariantFieldLabel({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ZainGulbaz Reused getVariantFieldLabel here to make the implementation consistent with the app that you implemented. Earlier, if just spaces are entered, then booker was showing just the spaces and not the fallback, now with your fix it would fallback to default.

fieldTypeVariantConfig: FieldTypeVariantConfig | undefined;
t: TFunction;
}) {
if (!variantField.label?.trim()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Your logic is here now. Also removed length check, it's a string and we can simply check for truthy.

@hariombalhara
Copy link
Copy Markdown
Member

Thank you for the PR @ZainGulbaz and double thanks @MehulZR for pointing out the issue. I have made a small refactor and it looks good to me.
@ZainGulbaz can you test from your end as well once.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 28, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown
Contributor

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Sep 12, 2023
@github-actions
Copy link
Copy Markdown
Contributor

This PR is being closed due to inactivity. Please reopen if work is intended to be continued.

@github-actions github-actions bot closed this Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Low priority Created by Linear-GitHub Sync Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants