-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Links on avatar for org events (#12892)
* fix: Links on avatar for org events * Remove noop code * Fix self review feedbavk
- Loading branch information
1 parent
2693b30
commit 9a2c2aa
Showing
3 changed files
with
48 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; | ||
import { CAL_URL, WEBAPP_URL } from "@calcom/lib/constants"; | ||
import { WEBAPP_URL } from "@calcom/lib/constants"; | ||
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; | ||
import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client"; | ||
import type { Team, User } from "@calcom/prisma/client"; | ||
import { AvatarGroup } from "@calcom/ui"; | ||
|
||
type UserAvatarProps = Omit<React.ComponentProps<typeof AvatarGroup>, "items"> & { | ||
users: Pick<User, "organizationId" | "name" | "username">[]; | ||
users: (Pick<User, "organizationId" | "name" | "username"> & { bookerUrl: string })[]; | ||
organization: Pick<Team, "slug" | "name">; | ||
}; | ||
|
||
export function UserAvatarGroupWithOrg(props: UserAvatarProps) { | ||
const { users, organization, ...rest } = props; | ||
const orgBranding = useOrgBranding(); | ||
const baseUrl = `${orgBranding?.fullDomain ?? CAL_URL}`; | ||
const items = [ | ||
{ | ||
href: baseUrl, | ||
href: getBookerBaseUrlSync(organization.slug), | ||
image: `${WEBAPP_URL}/team/${organization.slug}/avatar.png`, | ||
alt: organization.name || undefined, | ||
title: organization.name, | ||
}, | ||
].concat( | ||
users.map((user) => { | ||
return { | ||
href: `${baseUrl}/${user.username}/?redirect=false`, | ||
href: `${user.bookerUrl}/${user.username}?redirect=false`, | ||
image: getUserAvatarUrl(user), | ||
alt: user.name || undefined, | ||
title: user.name || user.username || "", | ||
}; | ||
}) | ||
); | ||
users.unshift(); | ||
return <AvatarGroup {...rest} items={items} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters