"use client"; import { useRouter } from "next/navigation"; import Shell from "@calcom/features/shell/Shell"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { RouterOutputs } from "@calcom/trpc/react"; import { trpc } from "@calcom/trpc/react"; import { Button, EmptyScreen } from "@calcom/ui"; import { showToast } from "@calcom/ui"; import PageWrapper from "@components/PageWrapper"; export type OrgUpgradeBannerProps = { data: RouterOutputs["viewer"]["getUserTopBanners"]["orgUpgradeBanner"]; }; export default function UpgradePage() { const { t } = useLocale(); const router = useRouter(); const publishOrgMutation = trpc.viewer.organizations.publish.useMutation({ onSuccess(data) { router.push(data.url); }, onError: (error) => { showToast(error.message, "error"); }, }); const doesUserHaveOrgToUpgrade = trpc.viewer.organizations.checkIfOrgNeedsUpgrade.useQuery(); return (
{doesUserHaveOrgToUpgrade.data ? ( { publishOrgMutation.mutate(); }}> {t("upgrade")} } /> ) : ( {t("contact_support")}} /> )}
); } UpgradePage.PageWrapper = PageWrapper;