diff --git a/src/app/[orgId]/resources/[resourceId]/components/ClientLayout.tsx b/src/app/[orgId]/resources/[resourceId]/components/ClientLayout.tsx deleted file mode 100644 index 831743e1..00000000 --- a/src/app/[orgId]/resources/[resourceId]/components/ClientLayout.tsx +++ /dev/null @@ -1,50 +0,0 @@ -"use client"; - -import { SidebarNav } from "@app/components/sidebar-nav"; -import { useResourceContext } from "@app/hooks/useResourceContext"; - -const sidebarNavItems = [ - { - title: "General", - href: "/{orgId}/resources/{resourceId}", - }, - { - title: "Targets", - href: "/{orgId}/resources/{resourceId}/targets", - }, - // { - // title: "Notifications", - // href: "/{orgId}/resources/{resourceId}/notifications", - // }, -] - -export function ClientLayout({ isCreate, children }: { isCreate: boolean; children: React.ReactNode }) { - const { resource } = useResourceContext(); - return (
-
-

- {isCreate - ? "New Resource" - : resource?.name + " Settings"} -

-

- {isCreate - ? "Create a new resource" - : "Configure the settings on your resource: " + - resource?.name || ""} - . -

-
-
- -
- {children} -
-
-
); -} \ No newline at end of file diff --git a/src/app/[orgId]/resources/[resourceId]/components/GeneralForm.tsx b/src/app/[orgId]/resources/[resourceId]/components/GeneralForm.tsx deleted file mode 100644 index c53e7b5e..00000000 --- a/src/app/[orgId]/resources/[resourceId]/components/GeneralForm.tsx +++ /dev/null @@ -1,259 +0,0 @@ -"use client" - -import Link from "next/link" -import { zodResolver } from "@hookform/resolvers/zod" -import { useFieldArray, useForm } from "react-hook-form" -import { z } from "zod" - -import { cn } from "@/lib/utils" -import { toast } from "@/hooks/use-toast" - -import { Button } from "@/components/ui/button" -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/ui/form" -import { CalendarIcon, CaretSortIcon, CheckIcon, ChevronDownIcon } from "@radix-ui/react-icons" - -import { Input } from "@/components/ui/input" -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select" -import { Textarea } from "@/components/ui/textarea" -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, -} from "@/components/ui/command" - -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover" -import { useResourceContext } from "@app/hooks/useResourceContext" -import { ListSitesResponse } from "@server/routers/site" -import { useEffect, useState } from "react" -import { AxiosResponse } from "axios" -import api from "@app/api" -import { useParams } from "next/navigation"; - -const GeneralFormSchema = z.object({ - name: z.string(), - siteId: z.number() -}) - -type GeneralFormValues = z.infer - -export function GeneralForm() { - const params = useParams(); - const orgId = params.orgId; - const { resource, updateResource } = useResourceContext(); - const [sites, setSites] = useState([]); - - const form = useForm({ - resolver: zodResolver(GeneralFormSchema), - defaultValues: { - name: resource?.name, - siteId: resource?.siteId - }, - mode: "onChange", - }) - - useEffect(() => { - if (typeof window !== "undefined") { - const fetchSites = async () => { - const res = await api.get>(`/org/${orgId}/sites/`); - setSites(res.data.data.sites); - }; - fetchSites(); - } - }, []); - - // const { fields, append } = useFieldArray({ - // name: "urls", - // control: form.control, - // }) - - async function onSubmit(data: GeneralFormValues) { - await updateResource({ name: data.name, siteId: data.siteId }); - } - - return ( -
- - ( - - Name - - - - - This is the display name of the resource. - - - - )} - /> - ( - - Site - - - - - - - - - - - No site found. - - {sites.map((site) => ( - { - form.setValue("siteId", site.siteId) - }} - > - - {site.name} - - ))} - - - - - - - This is the site that will be used in the dashboard. - - - - )} - /> - {/* ( - - Email - - - You can manage verified email addresses in your{" "} - email settings. - - - - )} - /> - ( - - Bio - -