diff --git a/actions/form.ts b/actions/form.ts index 537fa5e..44206ce 100644 --- a/actions/form.ts +++ b/actions/form.ts @@ -1,8 +1,8 @@ -"use server"; +'use server'; -import prisma from "@/lib/prisma"; -import { formSchema, formSchemaType } from "@/schemas/form"; -import { currentUser } from "@clerk/nextjs"; +import prisma from '@/lib/prisma'; +import { formSchema, formSchemaType } from '@/schemas/form'; +import { currentUser } from '@clerk/nextjs'; class UserNotFoundErr extends Error {} @@ -44,7 +44,7 @@ export async function GetFormStats() { export async function CreateForm(data: formSchemaType) { const validation = formSchema.safeParse(data); if (!validation.success) { - throw new Error("form not valid"); + throw new Error('form not valid'); } const user = await currentUser(); @@ -63,7 +63,7 @@ export async function CreateForm(data: formSchemaType) { }); if (!form) { - throw new Error("something went wrong"); + throw new Error('something went wrong'); } return form.id; @@ -80,7 +80,7 @@ export async function GetForms() { userId: user.id, }, orderBy: { - createdAt: "desc", + createdAt: 'desc', }, }); } diff --git a/app/(auth)/sign-in/[[...sign-in]]/page.tsx b/app/(auth)/sign-in/[[...sign-in]]/page.tsx index a5b8cdd..9fe2bb4 100755 --- a/app/(auth)/sign-in/[[...sign-in]]/page.tsx +++ b/app/(auth)/sign-in/[[...sign-in]]/page.tsx @@ -1,5 +1,5 @@ -import { SignIn } from "@clerk/nextjs"; - +import { SignIn } from '@clerk/nextjs'; + export default function Page() { return ; -} \ No newline at end of file +} diff --git a/app/(auth)/sign-up/[[...sign-up]]/page.tsx b/app/(auth)/sign-up/[[...sign-up]]/page.tsx index fce1573..0d02dd1 100755 --- a/app/(auth)/sign-up/[[...sign-up]]/page.tsx +++ b/app/(auth)/sign-up/[[...sign-up]]/page.tsx @@ -1,5 +1,5 @@ -import { SignUp } from "@clerk/nextjs"; - +import { SignUp } from '@clerk/nextjs'; + export default function Page() { return ; -} \ No newline at end of file +} diff --git a/app/(dashboard)/builder/[id]/erorr.tsx b/app/(dashboard)/builder/[id]/erorr.tsx index 7847646..78f822d 100644 --- a/app/(dashboard)/builder/[id]/erorr.tsx +++ b/app/(dashboard)/builder/[id]/erorr.tsx @@ -1,8 +1,8 @@ -"use client"; +'use client'; -import { Button } from "@/components/ui/button"; -import Link from "next/link"; -import { useEffect } from "react"; +import { Button } from '@/components/ui/button'; +import Link from 'next/link'; +import { useEffect } from 'react'; function ErrorPage({ error }: { error: Error }) { useEffect(() => { @@ -12,7 +12,7 @@ function ErrorPage({ error }: { error: Error }) {

Something went wrong!

); diff --git a/app/(dashboard)/builder/[id]/layout.tsx b/app/(dashboard)/builder/[id]/layout.tsx index 7946478..ec55331 100644 --- a/app/(dashboard)/builder/[id]/layout.tsx +++ b/app/(dashboard)/builder/[id]/layout.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from "react"; +import { ReactNode } from 'react'; function layout({ children }: { children: ReactNode }) { return
{children}
; diff --git a/app/(dashboard)/builder/[id]/loading.tsx b/app/(dashboard)/builder/[id]/loading.tsx index 99a3d84..58b8ecf 100644 --- a/app/(dashboard)/builder/[id]/loading.tsx +++ b/app/(dashboard)/builder/[id]/loading.tsx @@ -1,4 +1,4 @@ -import { ImSpinner2 } from "react-icons/im"; +import { ImSpinner2 } from 'react-icons/im'; function Loading() { return ( diff --git a/app/(dashboard)/builder/[id]/page.tsx b/app/(dashboard)/builder/[id]/page.tsx index 1692ac7..4cb53b0 100644 --- a/app/(dashboard)/builder/[id]/page.tsx +++ b/app/(dashboard)/builder/[id]/page.tsx @@ -1,5 +1,5 @@ -import { GetFormById } from "@/actions/form"; -import FormBuilder from "@/components/FormBuilder"; +import { GetFormById } from '@/actions/form'; +import FormBuilder from '@/components/FormBuilder'; async function BuilderPage({ params, @@ -12,7 +12,7 @@ async function BuilderPage({ const form = await GetFormById(Number(id)); if (!form) { - throw new Error("form not found"); + throw new Error('form not found'); } return ; } diff --git a/app/(dashboard)/layout.tsx b/app/(dashboard)/layout.tsx index 9ebba1a..1639e31 100644 --- a/app/(dashboard)/layout.tsx +++ b/app/(dashboard)/layout.tsx @@ -1,19 +1,21 @@ -import Logo from "@/components/Logo"; -import ThemeSwitcher from "@/components/ThemeSwitcher"; -import { UserButton } from "@clerk/nextjs"; -import { ReactNode } from "react"; +import Logo from '@/components/Logo'; +import ThemeSwitcher from '@/components/ThemeSwitcher'; +import { UserButton } from '@clerk/nextjs'; +import { ReactNode } from 'react'; function Layout({ children }: { children: ReactNode }) { - return
- -
{children}
-
+ return ( +
+ +
{children}
+
+ ); } export default Layout; diff --git a/app/(dashboard)/page.tsx b/app/(dashboard)/page.tsx index 4ee9dff..9a316e0 100644 --- a/app/(dashboard)/page.tsx +++ b/app/(dashboard)/page.tsx @@ -1,4 +1,4 @@ -import { GetFormStats, GetForms } from "@/actions/form"; +import { GetFormStats, GetForms } from '@/actions/form'; import { Card, CardContent, @@ -6,21 +6,21 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card"; -import { Skeleton } from "@/components/ui/skeleton"; -import { ReactNode, Suspense } from "react"; -import { LuView } from "react-icons/lu"; -import { FaEdit, FaWpforms } from "react-icons/fa"; -import { HiCursorClick } from "react-icons/hi"; -import { TbArrowBounce } from "react-icons/tb"; -import { BiRightArrowAlt } from "react-icons/bi"; -import { Separator } from "@/components/ui/separator"; -import CreateFormBtn from "@/components/CreateFormBtn"; -import { Form } from "@prisma/client"; -import { Badge } from "@/components/ui/badge"; -import { formatDistance } from "date-fns"; -import { Button } from "@/components/ui/button"; -import Link from "next/link"; +} from '@/components/ui/card'; +import { Skeleton } from '@/components/ui/skeleton'; +import { ReactNode, Suspense } from 'react'; +import { LuView } from 'react-icons/lu'; +import { FaEdit, FaWpforms } from 'react-icons/fa'; +import { HiCursorClick } from 'react-icons/hi'; +import { TbArrowBounce } from 'react-icons/tb'; +import { BiRightArrowAlt } from 'react-icons/bi'; +import { Separator } from '@/components/ui/separator'; +import CreateFormBtn from '@/components/CreateFormBtn'; +import { Form } from '@prisma/client'; +import { Badge } from '@/components/ui/badge'; +import { formatDistance } from 'date-fns'; +import { Button } from '@/components/ui/button'; +import Link from 'next/link'; export default function Home() { return ( @@ -64,7 +64,7 @@ function StatsCards(props: StatsCardsProps) { title="Total visits" icon={} helperText="All time form visits" - value={data?.visits.toLocaleString() || ""} + value={data?.visits.toLocaleString() || ''} loading={loading} className="shadow-md shadow-blue-600" /> @@ -72,7 +72,7 @@ function StatsCards(props: StatsCardsProps) { title="Total submission" icon={} helperText="All time form submission" - value={data?.submissions.toLocaleString() || ""} + value={data?.submissions.toLocaleString() || ''} loading={loading} className="shadow-md shadow-yellow-600" /> @@ -80,7 +80,7 @@ function StatsCards(props: StatsCardsProps) { title="Submission rate" icon={} helperText="Visits that result in form submission" - value={data?.submissionRate.toLocaleString() + "%" || ""} + value={data?.submissionRate.toLocaleString() + '%' || ''} loading={loading} className="shadow-md shadow-green-600" /> @@ -88,7 +88,7 @@ function StatsCards(props: StatsCardsProps) { title="Bounce Rate" icon={} helperText="Visits that leaves without interacting" - value={data?.bounceRate.toLocaleString() + "%" || ""} + value={data?.bounceRate.toLocaleString() + '%' || ''} loading={loading} className="shadow-md shadow-red-600" /> @@ -156,7 +156,7 @@ function FormCard({ form }: { form: Form }) { {form.name} {form.published && Published} - {!form.published && Draft} + {!form.published && Draft} {formatDistance(form.createdAt, new Date(), { @@ -173,20 +173,24 @@ function FormCard({ form }: { form: Form }) { - {form.description || "No description"} + {form.description || 'No description'} {form.published && ( )} {!form.published && ( - )} diff --git a/app/globals.css b/app/globals.css index 090d587..ca249f6 100755 --- a/app/globals.css +++ b/app/globals.css @@ -1,7 +1,6 @@ @tailwind base; @tailwind components; @tailwind utilities; - @layer base { :root { @@ -26,7 +25,7 @@ --ring: 224 71.4% 4.1%; --radius: 0.5rem; } - + .dark { --background: 224 71.4% 4.1%; --foreground: 210 20% 98%; @@ -50,7 +49,6 @@ } } - @layer base { * { @apply border-border; @@ -58,4 +56,4 @@ body { @apply bg-background text-foreground; } -} \ No newline at end of file +} diff --git a/app/layout.tsx b/app/layout.tsx index 5fef926..623f3d1 100755 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,17 +1,17 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import { ClerkProvider } from "@clerk/nextjs"; +import type { Metadata } from 'next'; +import { Inter } from 'next/font/google'; +import { ClerkProvider } from '@clerk/nextjs'; -import "./globals.css"; -import { ThemeProvider } from "@/components/providers/theme-providers"; -import { Toaster } from "@/components/ui/toaster"; -import DesignerContextProvider from "@/components/context/DesignerContext"; +import './globals.css'; +import { ThemeProvider } from '@/components/providers/theme-providers'; +import { Toaster } from '@/components/ui/toaster'; +import DesignerContextProvider from '@/components/context/DesignerContext'; -const inter = Inter({ subsets: ["latin"] }); +const inter = Inter({ subsets: ['latin'] }); export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: 'Create Next App', + description: 'Generated by create next app', }; export default function RootLayout({ diff --git a/components.json b/components.json index 7681c2f..fe9dede 100755 --- a/components.json +++ b/components.json @@ -13,4 +13,4 @@ "components": "@/components", "utils": "@/lib/utils" } -} \ No newline at end of file +} diff --git a/components/CreateFormBtn.tsx b/components/CreateFormBtn.tsx index 5c8b452..d23336c 100644 --- a/components/CreateFormBtn.tsx +++ b/components/CreateFormBtn.tsx @@ -1,9 +1,9 @@ -"use client"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { Button } from "./ui/button"; -import { ImSpinner2 } from "react-icons/im"; -import { BsFileEarmarkPlus } from "react-icons/bs"; +'use client'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useForm } from 'react-hook-form'; +import { Button } from './ui/button'; +import { ImSpinner2 } from 'react-icons/im'; +import { BsFileEarmarkPlus } from 'react-icons/bs'; import { Dialog, DialogContent, @@ -12,7 +12,7 @@ import { DialogHeader, DialogTitle, DialogTrigger, -} from "./ui/dialog"; +} from './ui/dialog'; import { Form, FormControl, @@ -20,13 +20,13 @@ import { FormItem, FormLabel, FormMessage, -} from "./ui/form"; -import { Input } from "./ui/input"; -import { Textarea } from "./ui/textarea"; -import { toast } from "./ui/use-toast"; -import { formSchema, formSchemaType } from "@/schemas/form"; -import { CreateForm } from "@/actions/form"; -import { useRouter } from "next/navigation"; +} from './ui/form'; +import { Input } from './ui/input'; +import { Textarea } from './ui/textarea'; +import { toast } from './ui/use-toast'; +import { formSchema, formSchemaType } from '@/schemas/form'; +import { CreateForm } from '@/actions/form'; +import { useRouter } from 'next/navigation'; function CreateFormBtn() { const router = useRouter(); @@ -38,15 +38,15 @@ function CreateFormBtn() { try { const formId = await CreateForm(values); toast({ - title: "Success", - description: "Form created successfully", + title: 'Success', + description: 'Form created successfully', }); router.push(`/builder/${formId}`); } catch (error) { toast({ - title: "Error", - description: "Something went wrong, please try again later", - variant: "destructive", + title: 'Error', + description: 'Something went wrong, please try again later', + variant: 'destructive', }); } } @@ -55,7 +55,7 @@ function CreateFormBtn() { ); diff --git a/components/PublishFormBtn.tsx b/components/PublishFormBtn.tsx index 67a83f5..a705b33 100644 --- a/components/PublishFormBtn.tsx +++ b/components/PublishFormBtn.tsx @@ -1,5 +1,5 @@ -import { MdOutlinePublish } from "react-icons/md"; -import { Button } from "./ui/button"; +import { MdOutlinePublish } from 'react-icons/md'; +import { Button } from './ui/button'; function PublishFormBtn() { return ( diff --git a/components/SaveFormBtn.tsx b/components/SaveFormBtn.tsx index b98dd87..3f6d58f 100644 --- a/components/SaveFormBtn.tsx +++ b/components/SaveFormBtn.tsx @@ -1,9 +1,9 @@ -import { Button } from "./ui/button"; -import { HiSaveAs } from "react-icons/hi"; +import { Button } from './ui/button'; +import { HiSaveAs } from 'react-icons/hi'; function SaveFormBtn() { return ( - diff --git a/components/SidebarBtnElement.tsx b/components/SidebarBtnElement.tsx index 5f88d3b..b9eb564 100644 --- a/components/SidebarBtnElement.tsx +++ b/components/SidebarBtnElement.tsx @@ -1,7 +1,7 @@ -import { useDraggable } from "@dnd-kit/core"; -import { FormElement } from "./FormElements"; -import { Button } from "./ui/button"; -import { cn } from "@/lib/utils"; +import { useDraggable } from '@dnd-kit/core'; +import { FormElement } from './FormElements'; +import { Button } from './ui/button'; +import { cn } from '@/lib/utils'; function SidebarBtnElement({ formElement }: { formElement: FormElement }) { const { label, icon: Icon } = formElement.designerBtnElement; @@ -16,10 +16,10 @@ function SidebarBtnElement({ formElement }: { formElement: FormElement }) { return ( - ) -} + ); +}; const CommandInput = React.forwardRef< React.ElementRef, @@ -46,15 +46,15 @@ const CommandInput = React.forwardRef< -)) +)); -CommandInput.displayName = CommandPrimitive.Input.displayName +CommandInput.displayName = CommandPrimitive.Input.displayName; const CommandList = React.forwardRef< React.ElementRef, @@ -62,12 +62,12 @@ const CommandList = React.forwardRef< >(({ className, ...props }, ref) => ( -)) +)); -CommandList.displayName = CommandPrimitive.List.displayName +CommandList.displayName = CommandPrimitive.List.displayName; const CommandEmpty = React.forwardRef< React.ElementRef, @@ -78,9 +78,9 @@ const CommandEmpty = React.forwardRef< className="py-6 text-center text-sm" {...props} /> -)) +)); -CommandEmpty.displayName = CommandPrimitive.Empty.displayName +CommandEmpty.displayName = CommandPrimitive.Empty.displayName; const CommandGroup = React.forwardRef< React.ElementRef, @@ -89,14 +89,14 @@ const CommandGroup = React.forwardRef< -)) +)); -CommandGroup.displayName = CommandPrimitive.Group.displayName +CommandGroup.displayName = CommandPrimitive.Group.displayName; const CommandSeparator = React.forwardRef< React.ElementRef, @@ -104,11 +104,11 @@ const CommandSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( -)) -CommandSeparator.displayName = CommandPrimitive.Separator.displayName +)); +CommandSeparator.displayName = CommandPrimitive.Separator.displayName; const CommandItem = React.forwardRef< React.ElementRef, @@ -117,14 +117,14 @@ const CommandItem = React.forwardRef< -)) +)); -CommandItem.displayName = CommandPrimitive.Item.displayName +CommandItem.displayName = CommandPrimitive.Item.displayName; const CommandShortcut = ({ className, @@ -133,14 +133,14 @@ const CommandShortcut = ({ return ( - ) -} -CommandShortcut.displayName = "CommandShortcut" + ); +}; +CommandShortcut.displayName = 'CommandShortcut'; export { Command, @@ -152,4 +152,4 @@ export { CommandItem, CommandShortcut, CommandSeparator, -} +}; diff --git a/components/ui/context-menu.tsx b/components/ui/context-menu.tsx index 654810a..b6b2334 100755 --- a/components/ui/context-menu.tsx +++ b/components/ui/context-menu.tsx @@ -1,38 +1,38 @@ -"use client" +'use client'; -import * as React from "react" -import * as ContextMenuPrimitive from "@radix-ui/react-context-menu" +import * as React from 'react'; +import * as ContextMenuPrimitive from '@radix-ui/react-context-menu'; import { CheckIcon, ChevronRightIcon, DotFilledIcon, -} from "@radix-ui/react-icons" +} from '@radix-ui/react-icons'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; -const ContextMenu = ContextMenuPrimitive.Root +const ContextMenu = ContextMenuPrimitive.Root; -const ContextMenuTrigger = ContextMenuPrimitive.Trigger +const ContextMenuTrigger = ContextMenuPrimitive.Trigger; -const ContextMenuGroup = ContextMenuPrimitive.Group +const ContextMenuGroup = ContextMenuPrimitive.Group; -const ContextMenuPortal = ContextMenuPrimitive.Portal +const ContextMenuPortal = ContextMenuPrimitive.Portal; -const ContextMenuSub = ContextMenuPrimitive.Sub +const ContextMenuSub = ContextMenuPrimitive.Sub; -const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup +const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup; const ContextMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, children, ...props }, ref) => ( -)) -ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName +)); +ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName; const ContextMenuSubContent = React.forwardRef< React.ElementRef, @@ -50,13 +50,13 @@ const ContextMenuSubContent = React.forwardRef< -)) -ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName +)); +ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName; const ContextMenuContent = React.forwardRef< React.ElementRef, @@ -66,32 +66,32 @@ const ContextMenuContent = React.forwardRef< -)) -ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName +)); +ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName; const ContextMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, ...props }, ref) => ( -)) -ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName +)); +ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName; const ContextMenuCheckboxItem = React.forwardRef< React.ElementRef, @@ -100,7 +100,7 @@ const ContextMenuCheckboxItem = React.forwardRef< {children} -)) +)); ContextMenuCheckboxItem.displayName = - ContextMenuPrimitive.CheckboxItem.displayName + ContextMenuPrimitive.CheckboxItem.displayName; const ContextMenuRadioItem = React.forwardRef< React.ElementRef, @@ -124,7 +124,7 @@ const ContextMenuRadioItem = React.forwardRef< {children} -)) -ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName +)); +ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName; const ContextMenuLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, ...props }, ref) => ( -)) -ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName +)); +ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName; const ContextMenuSeparator = React.forwardRef< React.ElementRef, @@ -163,11 +163,11 @@ const ContextMenuSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( -)) -ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName +)); +ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName; const ContextMenuShortcut = ({ className, @@ -176,14 +176,14 @@ const ContextMenuShortcut = ({ return ( - ) -} -ContextMenuShortcut.displayName = "ContextMenuShortcut" + ); +}; +ContextMenuShortcut.displayName = 'ContextMenuShortcut'; export { ContextMenu, @@ -201,4 +201,4 @@ export { ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, -} +}; diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 5e7c095..cb76be3 100755 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -1,18 +1,18 @@ -"use client" +'use client'; -import * as React from "react" -import * as DialogPrimitive from "@radix-ui/react-dialog" -import { Cross2Icon } from "@radix-ui/react-icons" +import * as React from 'react'; +import * as DialogPrimitive from '@radix-ui/react-dialog'; +import { Cross2Icon } from '@radix-ui/react-icons'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; -const Dialog = DialogPrimitive.Root +const Dialog = DialogPrimitive.Root; -const DialogTrigger = DialogPrimitive.Trigger +const DialogTrigger = DialogPrimitive.Trigger; -const DialogPortal = DialogPrimitive.Portal +const DialogPortal = DialogPrimitive.Portal; -const DialogClose = DialogPrimitive.Close +const DialogClose = DialogPrimitive.Close; const DialogOverlay = React.forwardRef< React.ElementRef, @@ -21,13 +21,13 @@ const DialogOverlay = React.forwardRef< -)) -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName +)); +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; const DialogContent = React.forwardRef< React.ElementRef, @@ -38,7 +38,7 @@ const DialogContent = React.forwardRef< -)) -DialogContent.displayName = DialogPrimitive.Content.displayName +)); +DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ className, @@ -59,13 +59,13 @@ const DialogHeader = ({ }: React.HTMLAttributes) => (
-) -DialogHeader.displayName = "DialogHeader" +); +DialogHeader.displayName = 'DialogHeader'; const DialogFooter = ({ className, @@ -73,13 +73,13 @@ const DialogFooter = ({ }: React.HTMLAttributes) => (
-) -DialogFooter.displayName = "DialogFooter" +); +DialogFooter.displayName = 'DialogFooter'; const DialogTitle = React.forwardRef< React.ElementRef, @@ -88,13 +88,13 @@ const DialogTitle = React.forwardRef< -)) -DialogTitle.displayName = DialogPrimitive.Title.displayName +)); +DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef, @@ -102,11 +102,11 @@ const DialogDescription = React.forwardRef< >(({ className, ...props }, ref) => ( -)) -DialogDescription.displayName = DialogPrimitive.Description.displayName +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, @@ -119,4 +119,4 @@ export { DialogFooter, DialogTitle, DialogDescription, -} +}; diff --git a/components/ui/dropdown-menu.tsx b/components/ui/dropdown-menu.tsx index 242b07a..925e680 100755 --- a/components/ui/dropdown-menu.tsx +++ b/components/ui/dropdown-menu.tsx @@ -1,38 +1,38 @@ -"use client" +'use client'; -import * as React from "react" -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" +import * as React from 'react'; +import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; import { CheckIcon, ChevronRightIcon, DotFilledIcon, -} from "@radix-ui/react-icons" +} from '@radix-ui/react-icons'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; -const DropdownMenu = DropdownMenuPrimitive.Root +const DropdownMenu = DropdownMenuPrimitive.Root; -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger +const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; -const DropdownMenuGroup = DropdownMenuPrimitive.Group +const DropdownMenuGroup = DropdownMenuPrimitive.Group; -const DropdownMenuPortal = DropdownMenuPrimitive.Portal +const DropdownMenuPortal = DropdownMenuPrimitive.Portal; -const DropdownMenuSub = DropdownMenuPrimitive.Sub +const DropdownMenuSub = DropdownMenuPrimitive.Sub; -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup +const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; const DropdownMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, children, ...props }, ref) => ( -)) +)); DropdownMenuSubTrigger.displayName = - DropdownMenuPrimitive.SubTrigger.displayName + DropdownMenuPrimitive.SubTrigger.displayName; const DropdownMenuSubContent = React.forwardRef< React.ElementRef, @@ -51,14 +51,14 @@ const DropdownMenuSubContent = React.forwardRef< -)) +)); DropdownMenuSubContent.displayName = - DropdownMenuPrimitive.SubContent.displayName + DropdownMenuPrimitive.SubContent.displayName; const DropdownMenuContent = React.forwardRef< React.ElementRef, @@ -69,33 +69,33 @@ const DropdownMenuContent = React.forwardRef< ref={ref} sideOffset={sideOffset} className={cn( - "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", - "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", + 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md', + 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className )} {...props} /> -)) -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName +)); +DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; const DropdownMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, ...props }, ref) => ( -)) -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName +)); +DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; const DropdownMenuCheckboxItem = React.forwardRef< React.ElementRef, @@ -104,7 +104,7 @@ const DropdownMenuCheckboxItem = React.forwardRef< {children} -)) +)); DropdownMenuCheckboxItem.displayName = - DropdownMenuPrimitive.CheckboxItem.displayName + DropdownMenuPrimitive.CheckboxItem.displayName; const DropdownMenuRadioItem = React.forwardRef< React.ElementRef, @@ -128,7 +128,7 @@ const DropdownMenuRadioItem = React.forwardRef< {children} -)) -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName +)); +DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName; const DropdownMenuLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, ...props }, ref) => ( -)) -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName +)); +DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; const DropdownMenuSeparator = React.forwardRef< React.ElementRef, @@ -167,11 +167,11 @@ const DropdownMenuSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( -)) -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName +)); +DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; const DropdownMenuShortcut = ({ className, @@ -179,12 +179,12 @@ const DropdownMenuShortcut = ({ }: React.HTMLAttributes) => { return ( - ) -} -DropdownMenuShortcut.displayName = "DropdownMenuShortcut" + ); +}; +DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'; export { DropdownMenu, @@ -202,4 +202,4 @@ export { DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, -} +}; diff --git a/components/ui/form.tsx b/components/ui/form.tsx index f6afdaf..c661c54 100755 --- a/components/ui/form.tsx +++ b/components/ui/form.tsx @@ -1,6 +1,6 @@ -import * as React from "react" -import * as LabelPrimitive from "@radix-ui/react-label" -import { Slot } from "@radix-ui/react-slot" +import * as React from 'react'; +import * as LabelPrimitive from '@radix-ui/react-label'; +import { Slot } from '@radix-ui/react-slot'; import { Controller, ControllerProps, @@ -8,27 +8,27 @@ import { FieldValues, FormProvider, useFormContext, -} from "react-hook-form" +} from 'react-hook-form'; -import { cn } from "@/lib/utils" -import { Label } from "@/components/ui/label" +import { cn } from '@/lib/utils'; +import { Label } from '@/components/ui/label'; -const Form = FormProvider +const Form = FormProvider; type FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath + TName extends FieldPath = FieldPath, > = { - name: TName -} + name: TName; +}; const FormFieldContext = React.createContext( {} as FormFieldContextValue -) +); const FormField = < TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath + TName extends FieldPath = FieldPath, >({ ...props }: ControllerProps) => { @@ -36,21 +36,21 @@ const FormField = < - ) -} + ); +}; const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState, formState } = useFormContext() + const fieldContext = React.useContext(FormFieldContext); + const itemContext = React.useContext(FormItemContext); + const { getFieldState, formState } = useFormContext(); - const fieldState = getFieldState(fieldContext.name, formState) + const fieldState = getFieldState(fieldContext.name, formState); if (!fieldContext) { - throw new Error("useFormField should be used within ") + throw new Error('useFormField should be used within '); } - const { id } = itemContext + const { id } = itemContext; return { id, @@ -59,53 +59,54 @@ const useFormField = () => { formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState, - } -} + }; +}; type FormItemContextValue = { - id: string -} + id: string; +}; const FormItemContext = React.createContext( {} as FormItemContextValue -) +); const FormItem = React.forwardRef< HTMLDivElement, React.HTMLAttributes >(({ className, ...props }, ref) => { - const id = React.useId() + const id = React.useId(); return ( -
+
- ) -}) -FormItem.displayName = "FormItem" + ); +}); +FormItem.displayName = 'FormItem'; const FormLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField() + const { error, formItemId } = useFormField(); return (