"use client"; import { Loading } from "@/components/dashboard/loading"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTrigger, } from "@/components/ui/dialog"; import { toast } from "@/components/ui/toaster"; // import { trpc } from "@/lib/trpc/client"; // import { PostHogEvent } from "@/providers/PostHogProvider"; // import { type Workspace } from "@aigxion/db"; import { useRouter } from "next/navigation"; import React, { useState } from "react"; type Props = { newPlan: "free" | "pro"; // workspace: Workspace; label: string; }; export const ChangePlanButton: React.FC = ({ newPlan, label }) => { const router = useRouter(); const [open, setOpen] = useState(false); // const changePlan = trpc.workspace.changePlan.useMutation({ // onSuccess: (data, variables, _context) => { // toast.success(data.title, { // description: data.message, // }); // PostHogEvent({ // name: "plan_changed", // properties: { plan: variables.plan, workspace: variables.workspaceId }, // }); // setOpen(false); // router.refresh(); // }, // onError: (error) => { // toast.error(error.message); // }, // }); const isSamePlan = true; return ( {/* Do you want to {workspace.planDowngradeRequest ? "resubscribe" : "switch"} to the{" "} */} {newPlan} plan? {/* {workspace.planDowngradeRequest ? null : ( Warning {newPlan === "free" ? "Your workspace will downgraded at the end of the month, you have access to all features of your current plan until then" : newPlan === "pro" ? `You are about to switch to the ${newPlan} plan. Please note that you can not change your plan in the current cycle, contact support@unkey.dev if you need to.` : ""} )} */} ); };