import type { ReactNode } from "react"; import { useGetTheme } from "@calcom/lib/hooks/useTheme"; import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { useHasTeamPlan } from "@calcom/web/modules/billing/hooks/useHasPaidPlan"; export function UpgradeTip({ title, description, background, features, buttons, isParentLoading, children, plan, }: { title: string; description: string; /* overwrite EmptyScreen text */ background: string; features: Array<{ icon: JSX.Element; title: string; description: string }>; buttons?: JSX.Element; /**Chldren renders when the user is in a team */ children: ReactNode; isParentLoading?: ReactNode; plan: "team" | "enterprise"; }) { const { resolvedTheme } = useGetTheme(); const { isPending, hasTeamPlan } = useHasTeamPlan(); const { data } = trpc.viewer.teams.getUpgradeable.useQuery(); const imageSrc = `${background}${resolvedTheme === "dark" ? "-dark" : ""}.jpg`; const hasEnterprisePlan = false; //const { isPending , hasEnterprisePlan } = useHasEnterprisePlan(); const hasUnpublishedTeam = !!data?.[0]; if (plan === "team" && (hasTeamPlan || hasUnpublishedTeam)) return <>{children}; if (plan === "enterprise" && hasEnterprisePlan) return <>{children}; if (isPending) return <>{isParentLoading}; return ( <>
{" "} {title}

{title}

{description}

{buttons}
{features.map((feature) => (
{feature.icon}

{feature.title}

{feature.description}

))}
); }