fix: Across Org Scenarios - Wrong links for event and team (#12358)

Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
This commit is contained in:
Hariom Balhara
2023-12-19 19:33:30 +10:00
committed by GitHub
co-authored by sean-brydon
parent f1caaad536
commit e5e0fa97eb
35 changed files with 570 additions and 154 deletions
@@ -1,6 +1,5 @@
import { usePathname, useRouter } from "next/navigation";
import { useBookerUrl } from "@calcom/lib/hooks/useBookerUrl";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { ButtonColor } from "@calcom/ui";
@@ -19,7 +18,7 @@ import { Plus } from "@calcom/ui/components/icon";
export interface Option {
teamId: number | null | undefined; // if undefined, then it's a profile
label: string | null;
image?: string | null;
image: string | null;
slug: string | null;
}
@@ -43,7 +42,6 @@ export function CreateButton(props: CreateBtnProps) {
const router = useRouter();
const searchParams = useCompatSearchParams();
const pathname = usePathname();
const bookerUrl = useBookerUrl();
const {
createDialog,
@@ -114,12 +112,7 @@ export function CreateButton(props: CreateBtnProps) {
type="button"
data-testid={`option${option.teamId ? "-team" : ""}-${idx}`}
StartIcon={(props) => (
<Avatar
alt={option.label || ""}
imageSrc={option.image || `${bookerUrl}/${option.label}/avatar.png`} // if no image, use default avatar
size="sm"
{...props}
/>
<Avatar alt={option.label || ""} imageSrc={option.image} size="sm" {...props} />
)}
onClick={() =>
!!CreateDialog