cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

feat: min max chars for long text

Open mhetreayush opened this issue 1 year ago • 7 comments

/claim https://github.com/calcom/cal.com/issues/15577

What does this PR do?

This PR adds an optional minimum and maximum character limit to long text question in booking form.

Loom Video: https://www.loom.com/share/735a6768a92847cabefd1fe2187c499d?sid=2d606562-c6e6-4bd3-92c0-b1fcdab14218

Mandatory Tasks (DO NOT REMOVE)

  • [X] I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • [X] N/A I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • [X] I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set? No

  • What are the minimal test data to have? N.A.

  • What is expected (happy path) to have (input and output)?

  1. Click on Event Types in the sidebar.
  2. Click on an event.
  3. Inside the event, click on the Advanced tab on the left sidebar.
  4. Add / edit a question.
  5. Set type to Long text
  6. Set the min &/or max characters.
  7. Save the question.
  8. Save the form.
  9. Click on the Preview button in the event header.
  10. Select a date on the calendar.
  11. While filling out the form, click save button with: a. Min &/or max character limit unsatisfied -> should show red text with error. b. All the conditions satisfied -> Should save successfully.

Checklist

mhetreayush avatar Jun 27 '24 07:06 mhetreayush

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

A member of the Team first needs to authorize it.

vercel[bot] avatar Jun 27 '24 07:06 vercel[bot]

Graphite Automations

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

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

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

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

graphite-app[bot] avatar Jun 27 '24 07:06 graphite-app[bot]

@sean-brydon thank you for a quick reply. The min < max check you are talking about can only be applied when both min and max are filled, as both are optional, will add the check and request a review.

mhetreayush avatar Jun 27 '24 08:06 mhetreayush

@sean-brydon @hariombalhara Fixed the validation: https://www.loom.com/share/b103eb32e0074a5e8a5397bf0312081b

Also took care of the reviews

mhetreayush avatar Jun 27 '24 13:06 mhetreayush

@anikdhabal Added the tests with https://github.com/calcom/cal.com/pull/15592/commits/9fb138acc07894f715c33314c27319cccbc25fa6

mhetreayush avatar Jun 27 '24 22:06 mhetreayush

📦 Next.js Bundle Analysis for @calcom/web

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

Forty-two Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/[user]/[type] 416.97 KB 644.68 KB 184.19% (🟡 +0.24%)
/[user]/[type]/embed 416.97 KB 644.68 KB 184.20% (🟡 +0.23%)
/apps/[slug]/[...pages] 593.64 KB 821.36 KB 234.67% (🟡 +0.29%)
/apps/installation/[[...step]] 168.18 KB 395.9 KB 113.11% (🟡 +0.15%)
/auth/saml-idp 12.22 KB 239.94 KB 68.55% (🟢 -20.80%)
/booking/[uid] 236.49 KB 464.21 KB 132.63% (🟡 +0.15%)
/booking/[uid]/embed 236.5 KB 464.21 KB 132.63% (🟡 +0.15%)
/bookings/[status] 330.73 KB 558.44 KB 159.55% (🟡 +0.16%)
/d/[link]/[slug] 416.77 KB 644.48 KB 184.14% (🟡 +0.23%)
/event-types 566.67 KB 794.38 KB 226.97% (🟡 +0.37%)
/event-types/[type] 442.33 KB 670.04 KB 191.44% (🟡 +0.23%)
/org/[orgSlug] 266.88 KB 494.59 KB 141.31% (🟡 +0.15%)
/org/[orgSlug]/[user] 272.99 KB 500.71 KB 143.06% (🟡 +0.15%)
/org/[orgSlug]/[user]/[type] 417.17 KB 644.88 KB 184.25% (🟡 +0.23%)
/org/[orgSlug]/[user]/[type]/embed 417.19 KB 644.91 KB 184.26% (🟡 +0.23%)
/org/[orgSlug]/[user]/embed 273.02 KB 500.74 KB 143.07% (🟡 +0.14%)
/org/[orgSlug]/embed 266.89 KB 494.61 KB 141.32% (🟡 +0.14%)
/org/[orgSlug]/instant-meeting/team/[slug]/[type] 416.79 KB 644.5 KB 184.14% (🟡 +0.24%)
/org/[orgSlug]/team/[slug] 266.88 KB 494.6 KB 141.31% (🟡 +0.15%)
/org/[orgSlug]/team/[slug]/[type] 416.98 KB 644.7 KB 184.20% (🟡 +0.23%)
/settings/admin/lockedSMS/UsersTable 79.98 KB 307.69 KB 87.91% (🟢 -0.14%)
/settings/admin/lockedSMS/lockedSMSView 119.46 KB 347.18 KB 99.19% (🟢 -0.17%)
/settings/admin/oAuth/oAuthView 95.5 KB 323.21 KB 92.35% (🟢 -0.18%)
/settings/admin/orgMigrations/moveTeamToOrg 305.66 KB 533.38 KB 152.39% (🟡 +0.16%)
/settings/admin/orgMigrations/moveUserToOrg 325.43 KB 553.15 KB 158.04% (🟡 +0.17%)
/settings/admin/orgMigrations/removeTeamFromOrg 305.42 KB 533.14 KB 152.33% (🟡 +0.15%)
/settings/admin/orgMigrations/removeUserFromOrg 305.43 KB 533.15 KB 152.33% (🟡 +0.16%)
/settings/admin/users/[id]/edit 398.79 KB 626.5 KB 179.00% (🟡 +0.16%)
/settings/admin/users/add 398.45 KB 626.17 KB 178.91% (🟡 +0.16%)
/settings/my-account/appearance 320.22 KB 547.94 KB 156.55% (🟡 +0.16%)
/settings/organizations/[id]/about 159.67 KB 387.39 KB 110.68% (🟡 +0.48%)
/settings/organizations/[id]/add-teams 159.66 KB 387.38 KB 110.68% (🟡 +0.47%)
/settings/organizations/new 159.67 KB 387.39 KB 110.68% (🟡 +0.48%)
/settings/platform/new 120.72 KB 348.43 KB 99.55% (🟡 +0.52%)
/settings/security/password 310.55 KB 538.27 KB 153.79% (🟡 +0.16%)
/signup 179.2 KB 406.91 KB 116.26% (🟡 +0.15%)
/team/[slug] 266.81 KB 494.53 KB 141.29% (🟡 +0.15%)
/team/[slug]/[type] 416.95 KB 644.67 KB 184.19% (🟡 +0.23%)
/team/[slug]/[type]/embed 416.98 KB 644.7 KB 184.20% (🟡 +0.23%)
/team/[slug]/embed 266.88 KB 494.59 KB 141.31% (🟡 +0.15%)
/video/[uid] 291.22 KB 518.94 KB 148.27% (🟢 -0.17%)
/workflows/[workflow] 420.26 KB 647.98 KB 185.14% (🟡 +0.17%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/-

github-actions[bot] avatar Jun 28 '24 11:06 github-actions[bot]

The test seems to be failing, could you check image

hariombalhara avatar Jun 28 '24 13:06 hariombalhara

@hariombalhara I am actually unavailable for some time, so will be inactive on the issue, could you or someone else take this ahead?

mhetreayush avatar Jul 04 '24 14:07 mhetreayush

@mhetreayush I would like to collaborate with you and make progress on this issue. I will take on this issue :)

varshith257 avatar Jul 04 '24 17:07 varshith257

Thanks @varshith257 , I will cancel my claim attempt then

mhetreayush avatar Jul 06 '24 17:07 mhetreayush

@hariombalhara I am actually unavailable for some time, so will be inactive on the issue, could you or someone else take this ahead?

@mhetreayush Hey, I have fixed the issue. please merge the below changes into your branch. https://github.com/mhetreayush/cal.com/pull/1

rajesh-jonnalagadda avatar Jul 08 '24 14:07 rajesh-jonnalagadda

Closing it in favour of #15693 which improves over the changes in this PR.

hariombalhara avatar Jul 09 '24 03:07 hariombalhara