Skip to content

fix: Username Overflow Fix using Ellipsis and tooltip #22570

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

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

Conversation

Anshumancanrock
Copy link

What does this PR do?

This PR fixes the overflow issue for long URL prefixes in the signup username field. The prefix is now truncated with an ellipsis (...) and, on hover, a tooltip displays the full URL after a 1-second delay. The solution uses Cal.com’s Tooltip component and applies a maximum width to prevent layout breakage. This change ensures a clean, consistent user experience for both standard and premium username inputs, without affecting any other functionality.

Visual Demo (For contributors especially)

Before Changes:

464639392-aef4aab9-028c-4add-969a-31daa70e596c

After Chnages:

username-prefix-fix.1.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. N/A - These are internal URL construction fixes that don't affect public API.
  • 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 the Signup page where UsernameField is rendered.
  2. Ensure the app is running in an environment with a long addOnLeading URL (e.g. Gitpod).
  3. Hover over or scroll the prefix container horizontally — you should see the full prefix scroll smoothly.

Environment Setup:

  • No special environment variables required
  • Standard Cal.com development setup

Checklist

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

Copy link

vercel bot commented Jul 16, 2025

@Anshumancanrock 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 Jul 16, 2025
@graphite-app graphite-app bot requested a review from a team July 16, 2025 20:00
@github-actions github-actions bot added ui area: UI, frontend, button, form, input 🐛 bug Something isn't working labels Jul 16, 2025
Copy link
Contributor

github-actions bot commented Jul 16, 2025

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:

No release type found in pull request title "Username Overflow Fix using Ellipsis and tooltip". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

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

Copy link
Contributor

coderabbitai bot commented Jul 16, 2025

"""

Walkthrough

The changes introduce a new React component, UrlPrefix, in apps/web/modules/signup-view.tsx. This component truncates URL prefixes longer than 25 characters with an ellipsis in the middle and displays the full URL in a tooltip on hover. The UsernameField's addOnLeading prop now renders this component instead of a plain string. Additionally, two substring presence checks using String.prototype.includes were replaced with String.prototype.indexOf for consistency and to prevent potential runtime errors by checking for truthiness before calling includes. No other functional or control flow changes were made.

Estimated code review effort

2 (~15 minutes)
"""

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/modules/signup-view.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-playwright".

(The package "eslint-plugin-playwright" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-playwright@latest --save-dev

The plugin "eslint-plugin-playwright" was referenced from the config file in ".eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/web/modules/signup-view.tsx (1)

87-108: Verify the truncation logic and consider edge cases.

The UrlPrefix component implementation looks mostly correct, but there are a few considerations:

  1. The truncation logic uses fixed percentages (60% start, 30% end) which may not work well for all URL structures
  2. The maxLength constant of 30 seems arbitrary and might need adjustment based on UI requirements
  3. No handling for URLs shorter than the sum of startChars + endChars + 3 (for "...")

Consider these improvements:

 function UrlPrefix({ url }: { url: string }) {
   const maxLength = 30;
   
   // Show full URL if it's short enough
   if (url.length <= maxLength) {
     return <span className="text-muted text-sm font-medium leading-none">{url}</span>;
   }
   
   // For long URLs, show beginning and end with ellipsis in middle
   const startChars = Math.floor(maxLength * 0.6);
   const endChars = Math.floor(maxLength * 0.3);
+  
+  // Ensure we don't exceed the original length
+  const minRequiredLength = startChars + endChars + 3; // +3 for "..."
+  if (url.length < minRequiredLength) {
+    return <span className="text-muted text-sm font-medium leading-none">{url}</span>;
+  }
+  
   const truncated = `${url.substring(0, startChars)}...${url.substring(url.length - endChars)}`;

Please test the component with various URL lengths to ensure the truncation works as expected, particularly with very short URLs that might be close to the maxLength threshold.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b40d448 and 79c6a17.

📒 Files selected for processing (1)
  • apps/web/modules/signup-view.tsx (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/prisma/schema.prisma:1068-1071
Timestamp: 2025-07-16T05:10:22.863Z
Learning: In PR #22304 for Cal.com private link expiration features, the `maxUsageCount` field was intentionally set to default to 1 (non-nullable) as a breaking change, making all existing private links single-use after migration. This was a deliberate design decision by alishaz-polymath.
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.341Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/features/eventtypes/components/MultiplePrivateLinksController.tsx:92-94
Timestamp: 2025-07-16T06:42:27.001Z
Learning: In the MultiplePrivateLinksController component (packages/features/eventtypes/components/MultiplePrivateLinksController.tsx), the `currentLink.maxUsageCount ?? 1` fallback in the openSettingsDialog function is intentional. Missing maxUsageCount values indicate old/legacy private links that existed before the expiration feature was added, and they should default to single-use behavior (1) for backward compatibility.
apps/web/modules/signup-view.tsx (2)
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.341Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/features/eventtypes/components/MultiplePrivateLinksController.tsx:92-94
Timestamp: 2025-07-16T06:42:27.001Z
Learning: In the MultiplePrivateLinksController component (packages/features/eventtypes/components/MultiplePrivateLinksController.tsx), the `currentLink.maxUsageCount ?? 1` fallback in the openSettingsDialog function is intentional. Missing maxUsageCount values indicate old/legacy private links that existed before the expiration feature was added, and they should default to single-use behavior (1) for backward compatibility.
🧬 Code Graph Analysis (1)
apps/web/modules/signup-view.tsx (2)
packages/features/ee/organizations/lib/orgDomains.ts (1)
  • getOrgFullOrigin (147-155)
packages/lib/constants.ts (1)
  • URL_PROTOCOL_REGEX (166-166)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Security Check
🔇 Additional comments (4)
apps/web/modules/signup-view.tsx (4)

48-48: LGTM: Import addition is correct.

The import for the Tooltip component is properly added and will be used by the new UrlPrefix component.


186-186: LGTM: String operation refactoring is correct.

The change from url.includes("?") to url.indexOf("?") !== -1 is functionally equivalent and maintains the same logic while potentially offering slight performance benefits.


255-255: LGTM: String operation refactoring is correct.

The change from redirectUrl?.includes("platform") and redirectUrl?.includes("new") to redirectUrl?.indexOf("platform") !== -1 and redirectUrl?.indexOf("new") !== -1 is functionally equivalent and maintains the same logic.


423-434: LGTM: Integration of UrlPrefix component is well-implemented.

The integration of the new UrlPrefix component in the UsernameField's addOnLeading prop is clean and follows the existing pattern. The URL construction logic properly handles both organization slugs and regular website URLs, correctly removing the protocol using the URL_PROTOCOL_REGEX.

The component will now:

  1. Display truncated URLs with ellipsis for long prefixes
  2. Show the full URL in a tooltip on hover
  3. Maintain the same visual styling as before

@dosubot dosubot bot added the 🧹 Improvements Improvements to existing features. Mostly UX/UI label Jul 16, 2025
Copy link

graphite-app bot commented Jul 16, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (07/16/25)

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

"Add community label" took an action on this PR • (07/16/25)

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

"Add ready-for-e2e label" took an action on this PR • (07/17/25)

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

@Anshumancanrock
Copy link
Author

@cubic-dev-ai /review

@Anshumancanrock Anshumancanrock changed the title Username Overflow Fix using Ellipsis and tooltip fix: Username Overflow Fix using Ellipsis and tooltip Jul 16, 2025
Copy link
Contributor

@Devanshusharma2005 Devanshusharma2005 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

github-actions bot commented Jul 17, 2025

E2E results are ready!

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

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

Does not work

Image

@kart1ka
Copy link
Contributor

kart1ka commented Jul 21, 2025

@Anshumancanrock a test seems to be failing. can you fix it?

@kart1ka kart1ka marked this pull request as draft July 21, 2025 17:38
@Anshumancanrock Anshumancanrock force-pushed the username-textfield-prefix branch from f69859f to 008f2e1 Compare July 21, 2025 19:04
@Anshumancanrock
Copy link
Author

@kart1ka Fixed the test failing issue sir.

And here is the video, working fine for me !

Recording.2025-07-22.024456.mp4

@Anshumancanrock Anshumancanrock marked this pull request as ready for review July 21, 2025 21:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5fda62 and 6fd2d52.

📒 Files selected for processing (1)
  • apps/web/modules/signup-view.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code. Functions like .add, .diff, .isBefore, and .isAfter are slow, especially in timezone mode. Prefer .utc() for better performance. Where possible, replace with native Date and direct .valueOf() comparisons for faster execution. Recommend using native methods or Day.js .utc() consistently in hot paths like loops.

Files:

  • apps/web/modules/signup-view.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/prisma/schema.prisma:1068-1071
Timestamp: 2025-07-16T05:10:22.891Z
Learning: In PR #22304 for Cal.com private link expiration features, the `maxUsageCount` field was intentionally set to default to 1 (non-nullable) as a breaking change, making all existing private links single-use after migration. This was a deliberate design decision by alishaz-polymath.
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/features/eventtypes/components/MultiplePrivateLinksController.tsx:92-94
Timestamp: 2025-07-16T06:42:27.024Z
Learning: In the MultiplePrivateLinksController component (packages/features/eventtypes/components/MultiplePrivateLinksController.tsx), the `currentLink.maxUsageCount ?? 1` fallback in the openSettingsDialog function is intentional. Missing maxUsageCount values indicate old/legacy private links that existed before the expiration feature was added, and they should default to single-use behavior (1) for backward compatibility.
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-21T13:54:11.770Z
Learning: Applies to frontend/**/*.{js,jsx,ts,tsx} : Always use t() for text localization in frontend code; direct text embedding should trigger a warning.
apps/web/modules/signup-view.tsx (2)

Learnt from: eunjae-lee
PR: #22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Learnt from: alishaz-polymath
PR: #22304
File: packages/features/eventtypes/components/MultiplePrivateLinksController.tsx:92-94
Timestamp: 2025-07-16T06:42:27.024Z
Learning: In the MultiplePrivateLinksController component (packages/features/eventtypes/components/MultiplePrivateLinksController.tsx), the currentLink.maxUsageCount ?? 1 fallback in the openSettingsDialog function is intentional. Missing maxUsageCount values indicate old/legacy private links that existed before the expiration feature was added, and they should default to single-use behavior (1) for backward compatibility.

🧬 Code Graph Analysis (1)
apps/web/modules/signup-view.tsx (2)
packages/features/ee/organizations/lib/orgDomains.ts (1)
  • getOrgFullOrigin (147-155)
packages/lib/constants.ts (1)
  • URL_PROTOCOL_REGEX (166-166)
🪛 Biome (1.9.4)
apps/web/modules/signup-view.tsx

[error] 253-253: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Security Check
🔇 Additional comments (4)
apps/web/modules/signup-view.tsx (4)

48-48: LGTM! Tooltip import added for the new component.

The import addition is correct and necessary for the UrlPrefix component implementation.


87-106: Well-implemented URL truncation component with accessibility considerations.

The UrlPrefix component provides a clean solution to the username field overflow issue:

  • Properly truncates long URLs with ellipsis
  • Uses Cal.com's Tooltip component for accessibility
  • Applies consistent styling with existing components
  • Uses a reasonable maxLength of 25 characters

The implementation follows React best practices and provides good UX for users with long URL prefixes.


184-184: String method change is functionally equivalent.

The change from url.includes("?") to url.indexOf("?") !== -1 maintains the same logic while using a different string method. Both approaches correctly detect the presence of a query string separator.


422-431: Effective implementation of the overflow fix using the new component.

The modification correctly replaces the plain string URL prefix with the new UrlPrefix component:

  • Properly passes the constructed URL string as a prop
  • Maintains existing logic for both organization and non-organization scenarios
  • Uses getOrgFullOrigin and URL_PROTOCOL_REGEX appropriately
  • The URL construction logic is correct and consistent with the codebase

This change successfully addresses the PR objective of fixing username field overflow while maintaining functionality.

@Anshumancanrock
Copy link
Author

@kart1ka

Copy link
Contributor

github-actions bot commented Aug 9, 2025

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Aug 9, 2025
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 🧹 Improvements Improvements to existing features. Mostly UX/UI ready-for-e2e Stale ui area: UI, frontend, button, form, input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Username Field Prefix overflows in Signup Form
3 participants