Skip to content

Commit 8adb720

Browse files
authored
fix: Double skeleton apps page (calcom#21965)
1 parent 4d6f338 commit 8adb720

1 file changed

Lines changed: 2 additions & 42 deletions

File tree

packages/app-store/components.tsx

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
"use client";
22

33
import Link from "next/link";
4-
import { useRouter } from "next/navigation";
5-
import { useEffect, useRef } from "react";
64

75
import type { UseAddAppMutationOptions } from "@calcom/app-store/_utils/useAddAppMutation";
86
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
97
import { WEBAPP_URL } from "@calcom/lib/constants";
108
import { deriveAppDictKeyFromType } from "@calcom/lib/deriveAppDictKeyFromType";
11-
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
129
import { useLocale } from "@calcom/lib/hooks/useLocale";
13-
import { trpc } from "@calcom/trpc/react";
1410
import type { RouterOutputs } from "@calcom/trpc/react";
1511
import type { App } from "@calcom/types/App";
16-
import { Icon } from "@calcom/ui/components/icon";
1712
import classNames from "@calcom/ui/classNames";
13+
import { Icon } from "@calcom/ui/components/icon";
1814

1915
import { InstallAppButtonMap } from "./apps.browser.generated";
2016
import type { InstallAppButtonProps } from "./types";
@@ -59,44 +55,8 @@ export const InstallAppButton = (
5955
disableInstall?: boolean;
6056
} & InstallAppButtonProps
6157
) => {
62-
const { isPending: isUserLoading, data: user } = trpc.viewer.me.get.useQuery();
63-
const router = useRouter();
64-
const proProtectionElementRef = useRef<HTMLDivElement | null>(null);
65-
const { isPending: isTeamPlanStatusLoading, hasTeamPlan } = useHasTeamPlan();
66-
67-
useEffect(() => {
68-
const el = proProtectionElementRef.current;
69-
if (!el) {
70-
return;
71-
}
72-
el.addEventListener(
73-
"click",
74-
(e) => {
75-
if (!user) {
76-
router.push(
77-
`${WEBAPP_URL}/auth/login?callbackUrl=${WEBAPP_URL + location.pathname + location.search}`
78-
);
79-
e.stopPropagation();
80-
return;
81-
}
82-
83-
if (props.teamsPlanRequired && !hasTeamPlan) {
84-
// TODO: I think we should show the UpgradeTip in a Dialog here. This would solve the problem of no way to go back to the App page from the UpgradeTip page(except browser's back button)
85-
router.push(props.teamsPlanRequired.upgradeUrl);
86-
e.stopPropagation();
87-
return;
88-
}
89-
},
90-
true
91-
);
92-
}, [isUserLoading, user, router, hasTeamPlan, props.teamsPlanRequired]);
93-
94-
if (isUserLoading || isTeamPlanStatusLoading) {
95-
return null;
96-
}
97-
9858
return (
99-
<div ref={proProtectionElementRef} className={props.wrapperClassName}>
59+
<div className={props.wrapperClassName}>
10060
<InstallAppButtonWithoutPlanCheck {...props} />
10161
</div>
10262
);

0 commit comments

Comments
 (0)