Skip to content

Commit 16bd521

Browse files
fix: Username Overflow Fix using Ellipsis and tooltip (calcom#22570)
* Username Overflow Fix * fix * fix * fix * Update signup-view.tsx --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
1 parent 9a2705c commit 16bd521

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

apps/web/modules/signup-view.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ const FEATURES = [
8383
},
8484
];
8585

86+
function truncateDomain(domain: string) {
87+
const maxLength = 25;
88+
const cleanDomain = domain.replace(URL_PROTOCOL_REGEX, "");
89+
90+
if (cleanDomain.length <= maxLength) {
91+
return cleanDomain;
92+
}
93+
94+
return `${cleanDomain.substring(0, maxLength - 3)}.../`;
95+
}
96+
8697
function UsernameField({
8798
username,
8899
setPremium,
@@ -398,11 +409,15 @@ export default function Signup({
398409
setPremium={(value) => setPremiumUsername(value)}
399410
addOnLeading={
400411
orgSlug
401-
? `${getOrgFullOrigin(orgSlug, { protocol: true }).replace(
402-
URL_PROTOCOL_REGEX,
403-
""
404-
)}/`
405-
: `${process.env.NEXT_PUBLIC_WEBSITE_URL.replace(URL_PROTOCOL_REGEX, "")}/`
412+
? truncateDomain(
413+
`${getOrgFullOrigin(orgSlug, { protocol: true }).replace(
414+
URL_PROTOCOL_REGEX,
415+
""
416+
)}/`
417+
)
418+
: truncateDomain(
419+
`${process.env.NEXT_PUBLIC_WEBSITE_URL.replace(URL_PROTOCOL_REGEX, "")}/`
420+
)
406421
}
407422
/>
408423
) : null}

0 commit comments

Comments
 (0)