Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual Insights Page has Team Insights #12215 #14778

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/web/pages/insights/index.tsx
Expand Up @@ -17,6 +17,7 @@
import Shell from "@calcom/features/shell/Shell";
import { UpgradeTip } from "@calcom/features/tips";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc";
import { Button, ButtonGroup } from "@calcom/ui";
Expand All @@ -29,6 +30,7 @@
export default function InsightsPage() {
const { t } = useLocale();
const { data: user } = trpc.viewer.me.useQuery();
const { isPending, hasTeamPlan } = useHasTeamPlan();

Check warning on line 33 in apps/web/pages/insights/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

apps/web/pages/insights/index.tsx#L33

[@typescript-eslint/no-unused-vars] 'isPending' is assigned a value but never used. Allowed unused vars must match /^_/u.

const features = [
{
Expand Down Expand Up @@ -57,7 +59,7 @@
title="Insights"
description="View booking insights across your events.">
<UpgradeTip
plan="team"
plan={hasTeamPlan ? "team" : "individual"}
title={t("make_informed_decisions")}
description={t("make_informed_decisions_description")}
features={features}
Expand All @@ -71,6 +73,9 @@
<Button color="minimal" href="https://go.cal.com/insights" target="_blank">
{t("learn_more")}
</Button>
<Button color="minimal" href="https://go.cal.com/insights/opt-out" target="_blank">
{t("Opt out of team insights")}
</Button>
</ButtonGroup>
</div>
}>
Expand Down
18 changes: 15 additions & 3 deletions packages/features/tips/UpgradeTip.tsx
Expand Up @@ -22,10 +22,10 @@ export function UpgradeTip({
background: string;
features: Array<{ icon: JSX.Element; title: string; description: string }>;
buttons?: JSX.Element;
/**Chldren renders when the user is in a team */
/**Children renders when the user is in a team */
children: JSX.Element;
isParentLoading?: ReactNode;
plan: "team" | "enterprise";
plan: "individual" | "team" | "enterprise";
}) {
const { activeTheme } = useGetTheme();
const { t } = useLocale();
Expand All @@ -44,7 +44,7 @@ export function UpgradeTip({

if (isPending) return <>{isParentLoading}</>;

return (
return plan !== "team" && plan !== "enterprise" ? (
<>
<div className="relative flex min-h-[295px] w-full items-center justify-between overflow-hidden rounded-lg pb-10">
<picture className="absolute min-h-[295px] w-full rounded-lg object-cover">
Expand Down Expand Up @@ -73,5 +73,17 @@ export function UpgradeTip({
))}
</div>
</>
) : (
<>
<div className="mt-4 grid-cols-3 md:grid md:gap-4">
{features.slice(1).map((feature) => (
<div key={feature.title} className="bg-muted mb-4 min-h-[180px] w-full rounded-md p-8 md:mb-0">
{feature.icon}
<h2 className="font-cal text-emphasis mt-4 text-lg">{feature.title}</h2>
<p className="text-default">{feature.description}</p>
</div>
))}
</div>
</>
);
}