fix: Team and User Links (#15342)

* fix: Team and User Links

* Add tests
This commit is contained in:
Hariom Balhara authored and GitHub committed 2024-06-06 11:40:29 +00:00
1 parent 4153e5b2d5
commit def87ea84a
7 files changed
+55 -17

No files matched your search

@@ -115,7 +115,12 @@ const ProfileView = () => {
const isAdmin =
team && (team.membership.role === MembershipRole.OWNER || team.membership.role === MembershipRole.ADMIN);
const permalink = `${WEBAPP_URL}/team/${team?.slug}`;
const permalink = team
? `${getTeamUrlSync({
orgSlug: team.parent ? team.parent.slug : null,
teamSlug: team.slug,
})}`
: "";
const isBioEmpty = !team || !team.bio || !team.bio.replace("<p><br></p>", "").length;
@@ -1,11 +1,11 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import type { Props } from "react-select";
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
import { classNames } from "@calcom/lib";
import { WEBSITE_URL } from "@calcom/lib/constants";
import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { MembershipRole } from "@calcom/prisma/enums";
import type { UserProfile } from "@calcom/types/UserProfile";
import { Avatar, Badge, Button, ButtonGroup, Select, Switch, Tooltip } from "@calcom/ui";
export type ChildrenEventType = {
@@ -20,6 +20,7 @@ export type ChildrenEventType = {
username: string;
membership: MembershipRole;
eventTypeSlugs: string[];
profile: UserProfile;
};
slug: string;
hidden: boolean;
@@ -35,10 +36,7 @@ export const ChildrenEventTypeSelect = ({
onChange: (value: readonly ChildrenEventType[]) => void;
}) => {
const { t } = useLocale();
const orgBranding = useOrgBranding();
const [animationRef] = useAutoAnimate<HTMLUListElement>();
const domain = orgBranding?.fullDomain ?? WEBSITE_URL;
return (
<>
@@ -109,7 +107,9 @@ export const ChildrenEventTypeSelect = ({
color="secondary"
target="_blank"
variant="icon"
href={`${domain}/${children.owner?.username}/${children.slug}`}
href={`${getBookerBaseUrlSync(
children.owner.profile?.organization?.slug ?? null
)}/${children.owner?.username}/${children.slug}`}
StartIcon="external-link"
/>
</Tooltip>