Reusable Upgrade component for teams only features (#6473)

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2023-01-14 01:48:19 +01:00
1 parent 443329b99f
commit 1376f0991f
8 files changed
+80 -72

No files matched your search

@@ -7,7 +7,6 @@ import { APP_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import {
Badge,
Button,
ColorPicker,
Form,
@@ -17,6 +16,7 @@ import {
SkeletonContainer,
SkeletonText,
Switch,
UpgradeTeamsBadge,
} from "@calcom/ui";
import { ssrInit } from "@server/lib/ssr";
@@ -49,6 +49,7 @@ const AppearanceView = () => {
const session = useSession();
const utils = trpc.useContext();
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { data: dataHasTeamPlan, isLoading: isLoadingHasTeamPlan } = trpc.viewer.teams.hasTeamPlan.useQuery();
const formMethods = useForm({
defaultValues: {
@@ -73,7 +74,8 @@ const AppearanceView = () => {
},
});
if (isLoading) return <SkeletonLoader title={t("appearance")} description={t("appearance_description")} />;
if (isLoading || isLoadingHasTeamPlan)
return <SkeletonLoader title={t("appearance")} description={t("appearance_description")} />;
if (!user) return null;
@@ -180,18 +182,18 @@ const AppearanceView = () => {
<p className="font-semibold ltr:mr-2 rtl:ml-2">
{t("disable_cal_branding", { appName: APP_NAME })}
</p>
<Badge variant="gray">{t("pro")}</Badge>
{!dataHasTeamPlan?.hasTeamPlan && <UpgradeTeamsBadge />}
</div>
<p className="mt-0.5 text-gray-600">{t("removes_cal_branding", { appName: APP_NAME })}</p>
</div>
<div className="flex-none">
<Switch
id="hideBranding"
disabled={!session.data?.user.belongsToActiveTeam}
disabled={!dataHasTeamPlan?.hasTeamPlan}
onCheckedChange={(checked) =>
formMethods.setValue("hideBranding", checked, { shouldDirty: true })
}
checked={!session.data?.user.belongsToActiveTeam ? false : value}
checked={!dataHasTeamPlan?.hasTeamPlan ? false : value}
/>
</div>
</div>
@@ -1509,5 +1509,6 @@
"using_meet_requires_calendar": "Using Google Meet requires a connected Google Calendar",
"continue_to_install_google_calendar": "Continue to install Google Calendar",
"install_google_meet": "Install Google Meet",
"install_google_calendar": "Install Google Calendar"
"install_google_calendar": "Install Google Calendar",
"no_recordings_found": "No recordings found"
}