From fd17f3f25cc4909c9f30b9f5cda04eaaa2066e8e Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Thu, 5 Sep 2024 01:25:37 -0600 Subject: [PATCH] remove --- .../components/layouts/settings-layout.tsx | 6 - .../pages/dashboard/settings/license.tsx | 143 ------------------ 2 files changed, 149 deletions(-) delete mode 100644 apps/dokploy/pages/dashboard/settings/license.tsx diff --git a/apps/dokploy/components/layouts/settings-layout.tsx b/apps/dokploy/components/layouts/settings-layout.tsx index d81e472a..0c0c6ecf 100644 --- a/apps/dokploy/components/layouts/settings-layout.tsx +++ b/apps/dokploy/components/layouts/settings-layout.tsx @@ -83,12 +83,6 @@ export const SettingsLayout = ({ children }: Props) => { icon: Bell, href: "/dashboard/settings/notifications", }, - { - title: "License", - label: "", - icon: KeyIcon, - href: "/dashboard/settings/license", - }, ] : []), ...(user?.canAccessToSSHKeys diff --git a/apps/dokploy/pages/dashboard/settings/license.tsx b/apps/dokploy/pages/dashboard/settings/license.tsx deleted file mode 100644 index 4633c6a3..00000000 --- a/apps/dokploy/pages/dashboard/settings/license.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { DashboardLayout } from "@/components/layouts/dashboard-layout"; -import { SettingsLayout } from "@/components/layouts/settings-layout"; -import { Button } from "@/components/ui/button"; -import { - Card, - CardHeader, - CardTitle, - CardDescription, - CardContent, -} from "@/components/ui/card"; -import { - FormField, - FormItem, - FormLabel, - FormControl, - FormMessage, - Form, -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { validateRequest } from "@/server/auth/auth"; -import { api } from "@/utils/api"; -import { zodResolver } from "@hookform/resolvers/zod"; -import type { GetServerSidePropsContext } from "next"; -import Link from "next/link"; -import { useEffect, type ReactElement } from "react"; -import { useForm } from "react-hook-form"; -import { toast } from "sonner"; -import { z } from "zod"; - -const schema = z.object({ - licenseKey: z.string(), -}); - -type Schema = z.infer; - -export default function License() { - const { data } = api.admin.one.useQuery(); - const { mutateAsync, isLoading } = api.license.setLicense.useMutation(); - const form = useForm({ - defaultValues: { - licenseKey: data?.licenseKey || "", - }, - resolver: zodResolver(schema), - }); - - useEffect(() => { - if (data?.licenseKey) { - form.reset({ - licenseKey: data.licenseKey, - }); - } - }, [data]); - - const onSubmit = async (data: Schema) => { - await mutateAsync(data.licenseKey) - .then(async () => { - toast.success("License Key Saved"); - }) - .catch(() => { - toast.error("Error to save the license key"); - }); - }; - return ( - <> -
- - - License - - Set your license key to unlock the features - - See pricing - - - - -
- - { - return ( - - License Key - - - - - - ); - }} - /> - -
- -
- - -
-
-
- - ); -} - -License.getLayout = (page: ReactElement) => { - return ( - - {page} - - ); -}; -export async function getServerSideProps( - ctx: GetServerSidePropsContext<{ serviceId: string }>, -) { - const { user, session } = await validateRequest(ctx.req, ctx.res); - if (!user || user.rol === "user") { - return { - redirect: { - permanent: true, - destination: "/", - }, - }; - } - - return { - props: {}, - }; -}