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: Add URL-type input in booking question field #15481

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

Conversation

anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Jun 18, 2024

What does this PR do?

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • N/A-I have added a Docs issue here if this PR makes changes that would require a documentation change
  • N/A-I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Copy link

vercel bot commented Jun 18, 2024

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

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the ✨ feature New feature or request label Jun 18, 2024
@dosubot dosubot bot added the booking-page area: booking page, public booking page, booker label Jun 18, 2024
@graphite-app graphite-app bot requested a review from a team June 18, 2024 17:39
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jun 18, 2024
Copy link

graphite-app bot commented Jun 18, 2024

Graphite Automations

"Add community label" took an action on this PR • (06/18/24)

1 label was added to this PR based on Keith Williams's automation.

"Add consumer team as reviewer" took an action on this PR • (06/18/24)

1 reviewer was added to this PR based on Keith Williams's automation.

@keithwillcode keithwillcode added this to the v4.4 milestone Jun 19, 2024
@anikdhabal anikdhabal added the Low priority Created by Linear-GitHub Sync label Jun 27, 2024
@keithwillcode keithwillcode added the community-interns The team responsible for reviewing, testing and shipping low/medium community PRs label Jun 27, 2024
@@ -120,6 +120,7 @@ function preprocess<T extends z.ZodType>({
return isValidPhoneNumber(val);
});
// Tag the message with the input name so that the message can be shown at appropriate place
const urlSchema = z.string().url();
Copy link
Member

@hariombalhara hariombalhara Jun 28, 2024

Choose a reason for hiding this comment

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

This line came in b/w comment on line 122 and related code.

Comment on lines +250 to +259
if (bookingField.type === "url") {
// URL schema to validate if the input is a valid URL
if (!urlSchema.safeParse(value).success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: m("url_validation_error"),
});
}
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

It would be the right place to add the superRefine for url type field in the same way we have done for 'name' type field.

We want to avoid increase this file's size and make all refinements testable.
After that it would make sense to add a simple test for url type field schema validation

url: {
propsType: propsTypes.url,
factory: (props) => {
if (!props) {
Copy link
Member

@hariombalhara hariombalhara Jun 28, 2024

Choose a reason for hiding this comment

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

Is there a case where props could be undefined?

It feels wrong to return a different element from the same component conditionally. Like if no props are provided return <div> otherwise <TextWidget>

Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

Left some feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
booking-page area: booking page, public booking page, booker community Created by Linear-GitHub Sync community-interns The team responsible for reviewing, testing and shipping low/medium community PRs ✨ feature New feature or request Low priority Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Website Field Type
4 participants