Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions apps/web/modules/team/team-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// 2. org/[orgSlug]/[user]/[type]
import classNames from "classnames";
import Link from "next/link";
import { useCallback, useState } from "react";

import { sdkActionManager, useIsEmbed } from "@calcom/embed-core/embed-iframe";
import EventTypeDescription from "@calcom/web/modules/event-types/components/EventTypeDescription";
Expand Down Expand Up @@ -36,6 +37,13 @@ function TeamPage({ team, considerUnpublished, isValidOrgDomain }: PageProps) {
const isEmbed = useIsEmbed();
const teamName = team.name || t("nameless_team");
const isBioEmpty = !team.bio || !team.bio.replace("<p><br></p>", "").length;
const [isBioExpanded, setIsBioExpanded] = useState(false);
const [isBioClamped, setIsBioClamped] = useState(false);
const checkBioClamped = useCallback((node: HTMLDivElement | null) => {
if (node) {
setIsBioClamped(node.scrollHeight > node.clientHeight);
}
}, []);
const metadata = teamMetadataSchema.parse(team.metadata);

const teamOrOrgIsPrivate = team.isPrivate || (team?.parent?.isOrganization && team.parent?.isPrivate);
Expand Down Expand Up @@ -154,13 +162,25 @@ function TeamPage({ team, considerUnpublished, isValidOrgDomain }: PageProps) {
{teamName}
</p>
{!isBioEmpty && (
<>
<div>
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via safeBio */}
<div
className=" text-subtle wrap-break-word text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
ref={checkBioClamped}
className={classNames(
"text-subtle break-words text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600",
!isBioExpanded && "line-clamp-3"
)}
dangerouslySetInnerHTML={{ __html: team.safeBio }}
/>
</>
{(isBioClamped || isBioExpanded) && (
<button
type="button"
className="text-emphasis mt-1 text-sm font-medium hover:underline"
onClick={() => setIsBioExpanded((prev) => !prev)}>
{isBioExpanded ? t("show_less") : t("show_more")}
</button>
)}
</div>
)}
</div>
{team.isOrganization ? (
Expand Down
1 change: 1 addition & 0 deletions packages/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -3144,6 +3144,7 @@
"redirect_to": "Redirect to",
"having_trouble_finding_time": "Having trouble finding a time?",
"show_more": "Show more",
"show_less": "Show less",
"signup_with_google": "Sign up with Google",
"signup_with_microsoft": "Sign up with Microsoft",
"signin_with_microsoft": "Sign in with Microsoft",
Expand Down
Loading