2023-01-23 09:58:41 +00:00
|
|
|
import type { ReactNode } from "react";
|
|
|
|
|
|
|
|
import { classNames } from "@calcom/lib";
|
2023-02-17 23:00:19 +00:00
|
|
|
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
2023-01-23 09:58:41 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
|
|
|
|
|
|
export function UpgradeTip({
|
|
|
|
dark,
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
background,
|
|
|
|
features,
|
|
|
|
buttons,
|
|
|
|
isParentLoading,
|
|
|
|
children,
|
|
|
|
}: {
|
|
|
|
dark?: boolean;
|
|
|
|
title: string;
|
|
|
|
description: string;
|
2023-02-01 20:41:47 +00:00
|
|
|
/* overwrite EmptyScreen text */
|
2023-01-23 09:58:41 +00:00
|
|
|
background: string;
|
|
|
|
features: Array<{ icon: JSX.Element; title: string; description: string }>;
|
|
|
|
buttons?: JSX.Element;
|
|
|
|
/**Chldren renders when the user is in a team */
|
|
|
|
children: JSX.Element;
|
|
|
|
isParentLoading?: ReactNode;
|
|
|
|
}) {
|
|
|
|
const { t } = useLocale();
|
2023-02-17 23:00:19 +00:00
|
|
|
const { isLoading, hasTeamPlan } = useHasTeamPlan();
|
2023-01-23 09:58:41 +00:00
|
|
|
|
2023-02-17 23:00:19 +00:00
|
|
|
if (hasTeamPlan) return children;
|
2023-06-06 11:59:57 +00:00
|
|
|
|
2023-05-30 15:00:32 +00:00
|
|
|
if (isLoading) return <>{isParentLoading}</>;
|
2023-01-24 15:27:05 +00:00
|
|
|
|
2023-01-23 09:58:41 +00:00
|
|
|
return (
|
|
|
|
<>
|
2023-03-27 19:53:35 +00:00
|
|
|
<div className="relative flex min-h-[295px] w-full items-center justify-between overflow-hidden rounded-lg pb-10">
|
2023-04-10 21:14:28 +00:00
|
|
|
<picture className="absolute min-h-[295px] w-full rounded-lg object-cover">
|
|
|
|
<source srcSet={`${background}-dark.jpg`} media="(prefers-color-scheme: dark)" />
|
|
|
|
<img
|
2023-05-12 00:23:11 +00:00
|
|
|
className="absolute min-h-[295px] w-full rounded-lg object-cover object-left md:object-center"
|
2023-04-10 21:14:28 +00:00
|
|
|
src={`${background}.jpg`}
|
|
|
|
loading="lazy"
|
|
|
|
alt={title}
|
|
|
|
/>
|
|
|
|
</picture>
|
2023-04-20 22:33:49 +00:00
|
|
|
<div className="relative my-4 px-8 sm:px-14">
|
2023-04-05 18:14:46 +00:00
|
|
|
<h1 className={classNames("font-cal text-3xl", dark && "text-inverted")}>{t(title)}</h1>
|
2023-06-22 22:25:37 +00:00
|
|
|
<p className={classNames("mb-8 mt-4 max-w-sm", dark ? "text-inverted" : "text-default")}>
|
2023-03-23 22:10:01 +00:00
|
|
|
{t(description)}
|
|
|
|
</p>
|
|
|
|
{buttons}
|
2023-01-23 09:58:41 +00:00
|
|
|
</div>
|
2023-03-23 22:10:01 +00:00
|
|
|
</div>
|
2023-01-24 15:27:05 +00:00
|
|
|
|
2023-03-27 19:53:35 +00:00
|
|
|
<div className="mt-4 grid-cols-3 md:grid md:gap-4">
|
2023-03-23 22:10:01 +00:00
|
|
|
{features.map((feature) => (
|
2023-04-05 18:14:46 +00:00
|
|
|
<div key={feature.title} className="bg-muted mb-4 min-h-[180px] w-full rounded-md p-8 md:mb-0">
|
2023-03-23 22:10:01 +00:00
|
|
|
{feature.icon}
|
2023-04-05 18:14:46 +00:00
|
|
|
<h2 className="font-cal text-emphasis mt-4 text-lg">{feature.title}</h2>
|
|
|
|
<p className="text-default">{feature.description}</p>
|
2023-03-23 22:10:01 +00:00
|
|
|
</div>
|
|
|
|
))}
|
2023-01-23 09:58:41 +00:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|