Skip to content

Conversation

@C-W-D-Harshit
Copy link
Contributor

What does this PR do?

This PR addresses a UI bug on the update username modal at https://app.cal.com/settings/my-account/profile, where entering a very long username would break the layout. The fix includes applying a character limit on the username input field and ensuring long usernames are truncated with an ellipsis to prevent UI issues.

Loom Video: https://www.loom.com/share/5112a72ae42d4aae9bf42bf2aa4d20c3?sid=09aa27f8-b4f9-46b7-92be-e3a87aff80fe

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent-sized PR without self-review might be rejected).
  • 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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Go to https://app.cal.com/settings/my-account/profile.
  2. Try to update the username with a long string and verify that the UI no longer breaks.
  3. Check that a character limit is enforced on the username input field.
  4. Verify that long usernames are correctly displayed with truncation (e.g., ellipsis) if they exceed the allowed space.
  • No additional environment variables are required.
  • Minimal test data: Any valid username.
  • Expected result: The username should update without breaking the UI, and long usernames should be truncated with ellipses when displayed.
@vercel
Copy link

vercel bot commented Aug 21, 2024

@C-W-D-Harshit is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Aug 21, 2024
@graphite-app graphite-app bot requested a review from a team August 21, 2024 11:34
@github-actions github-actions bot added linear Sync Github Issue from community members to Linear.app ui area: UI, frontend, button, form, input ✅ good first issue Good for newcomers 🐛 bug Something isn't working labels Aug 21, 2024
@graphite-app
Copy link

graphite-app bot commented Aug 21, 2024

Graphite Automations

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

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

"Add community label" took an action on this PR • (08/21/24)

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

@dosubot dosubot bot added the 🧹 Improvements Improvements to existing features. Mostly UX/UI label Aug 21, 2024
@C-W-D-Harshit C-W-D-Harshit changed the title feat: Improve UI for username availability in UsernameTextfield compo… Aug 21, 2024
@github-actions
Copy link
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

Unknown release type "Feat" found in pull request title "Feat: Prevent UI Breakage from Long Usernames in Profile Settings". 

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit
@C-W-D-Harshit C-W-D-Harshit changed the title Feat: Prevent UI Breakage from Long Usernames in Profile Settings Aug 21, 2024
Copy link
Contributor

@Amit91848 Amit91848 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! In addition to this, it gets all wonky when you have extra long current username, can you fix that as well @C-W-D-Harshit

Screenshot 2024-08-21 174229

@C-W-D-Harshit
Copy link
Contributor Author

Hi @Amit91848 I am currently working on that.

Comment on lines 163 to 178
<div className="max-w-96 w-fit">
<p className="text-subtle">{t("current_username")}</p>
<Tooltip content={currentUsername}>
<p
className="text-emphasis mt-1 max-w-md overflow-hidden text-ellipsis"
className="text-emphasis mt-1 w-full max-w-md overflow-hidden text-ellipsis"
data-testid="current-username">
{currentUsername}
</p>
</Tooltip>
</div>
<div>
<div className="max-w-96 w-fit">
<p className="text-subtle" data-testid="new-username">
{t("new_username")}
</p>
<Tooltip content={inputUsernameValue}>
<p className="text-emphasis mt-1 max-w-md overflow-hidden text-ellipsis">
<p className="text-emphasis mt-1 w-full overflow-hidden text-ellipsis">
Copy link
Contributor

@anikdhabal anikdhabal Aug 21, 2024

Choose a reason for hiding this comment

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

The changes are unnecessary. You can easily fix it by breaking the text onto the next line

Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2024-08-21 184624

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anikdhabal Yes you can also fix that by adding a new line, but what if someone just entered a very very long username 😅. The issue would still persist.
I think there should be some kind of character limit with zod validation in the username field.

Copy link
Contributor

@anikdhabal anikdhabal Aug 21, 2024

Choose a reason for hiding this comment

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

It still manages and doesn’t break. What do we mean by a very, very long username? Are we thinking about one million letters? 😅

Also, you can't see the text that is outside the area, so it's better to show the full username before saving, instead of just hiding some parts

Copy link
Contributor Author

@C-W-D-Harshit C-W-D-Harshit Aug 21, 2024

Choose a reason for hiding this comment

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

It still manages and doesn’t break. What do we mean by a very, very long username? Are we thinking about one million words? 😅

Nah mate 😅. I like your approach, it is a lot simpler. My approach was to just fix the code way it was.

anikdhabal
anikdhabal previously approved these changes Aug 21, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2024

E2E results are ready!

@Amit91848
Copy link
Contributor

Shouldn't these changes be made in apps/web/components/ui/UsernameAvailability/PremiumTextfield.tsx as well?

@anikdhabal
Copy link
Contributor

anikdhabal commented Aug 21, 2024

Shouldn't these changes be made in apps/web/components/ui/UsernameAvailability/PremiumTextfield.tsx as well?

Yeah, we need to make changes there as well. @C-W-D-Harshit pls do

@C-W-D-Harshit
Copy link
Contributor Author

Hi @Amit91848, I have made the changes in PremiumTextfield.tsx.

Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

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

Looks good !

Copy link
Contributor

@Amit91848 Amit91848 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @C-W-D-Harshit

@CarinaWolli CarinaWolli enabled auto-merge (squash) August 21, 2024 16:07
@CarinaWolli CarinaWolli merged commit f52de73 into calcom:main Aug 21, 2024
@C-W-D-Harshit C-W-D-Harshit deleted the fixUsernameBug branch August 21, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync ✅ good first issue Good for newcomers 🧹 Improvements Improvements to existing features. Mostly UX/UI linear Sync Github Issue from community members to Linear.app ready-for-e2e ui area: UI, frontend, button, form, input

4 participants