From a03abbde4e7e2ae83955829366b85a0f0adb28e8 Mon Sep 17 00:00:00 2001 From: ppc Date: Tue, 30 Dec 2025 12:32:19 +0000 Subject: [PATCH] fix codemod changes --- amnet-web/src/components/ui/alert-dialog.tsx | 170 +++++------ amnet-web/src/components/ui/alert.tsx | 74 +++-- amnet-web/src/components/ui/button.tsx | 20 +- amnet-web/src/components/ui/card.tsx | 149 +++++----- amnet-web/src/components/ui/context-menu.tsx | 294 +++++++++---------- amnet-web/src/components/ui/dialog.tsx | 134 ++++----- amnet-web/src/components/ui/drawer.tsx | 122 ++++---- amnet-web/src/components/ui/form.tsx | 71 ++--- amnet-web/src/components/ui/input.tsx | 16 +- amnet-web/src/components/ui/label.tsx | 22 +- amnet-web/src/components/ui/separator.tsx | 40 ++- amnet-web/src/components/ui/toast.tsx | 158 +++++----- amnet-web/src/components/ui/tooltip.tsx | 34 +-- 13 files changed, 599 insertions(+), 705 deletions(-) diff --git a/amnet-web/src/components/ui/alert-dialog.tsx b/amnet-web/src/components/ui/alert-dialog.tsx index c744f9c..bdbe924 100644 --- a/amnet-web/src/components/ui/alert-dialog.tsx +++ b/amnet-web/src/components/ui/alert-dialog.tsx @@ -10,43 +10,39 @@ const AlertDialogTrigger = AlertDialogPrimitive.Trigger const AlertDialogPortal = AlertDialogPrimitive.Portal -const AlertDialogOverlay = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function AlertDialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName -const AlertDialogContent = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => ( - - -) +function AlertDialogContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + + + + ) +} AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName const AlertDialogHeader = ({ @@ -77,69 +73,61 @@ const AlertDialogFooter = ({ ) AlertDialogFooter.displayName = "AlertDialogFooter" -const AlertDialogTitle = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName -const AlertDialogDescription = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName -const AlertDialogAction = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function AlertDialogAction({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName -const AlertDialogCancel = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function AlertDialogCancel({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName export { diff --git a/amnet-web/src/components/ui/alert.tsx b/amnet-web/src/components/ui/alert.tsx index 564886f..71e143a 100644 --- a/amnet-web/src/components/ui/alert.tsx +++ b/amnet-web/src/components/ui/alert.tsx @@ -19,49 +19,45 @@ const alertVariants = cva( } ) -const Alert = ( - { - ref, - className, - variant, - ...props - } -) => (
) +function Alert({ + className, + variant, + ...props +}: React.HTMLAttributes & VariantProps) { + return ( +
+ ) +} Alert.displayName = "Alert" -const AlertTitle = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref?: React.RefObject; - } -) => (
) +function AlertTitle({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} AlertTitle.displayName = "AlertTitle" -const AlertDescription = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref?: React.RefObject; - } -) => (
) +function AlertDescription({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} AlertDescription.displayName = "AlertDescription" export { Alert, AlertTitle, AlertDescription } diff --git a/amnet-web/src/components/ui/button.tsx b/amnet-web/src/components/ui/button.tsx index 4d19d71..462dd28 100644 --- a/amnet-web/src/components/ui/button.tsx +++ b/amnet-web/src/components/ui/button.tsx @@ -39,23 +39,17 @@ export interface ButtonProps asChild?: boolean } -const Button = ( - { - ref, - className, - variant, - size, - asChild = false, - ...props - }: ButtonProps & { - ref?: React.RefObject; - } -) => { +function Button({ + className, + variant, + size, + asChild = false, + ...props +}: ButtonProps) { const Comp = asChild ? Slot : "button" return ( ) diff --git a/amnet-web/src/components/ui/card.tsx b/amnet-web/src/components/ui/card.tsx index 2445422..e2e2383 100644 --- a/amnet-web/src/components/ui/card.tsx +++ b/amnet-web/src/components/ui/card.tsx @@ -2,96 +2,85 @@ import * as React from "react" import { cn } from "@/lib/utils" -const Card = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref: React.RefObject; - } -) => (
) +function Card({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} Card.displayName = "Card" -const CardHeader = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref: React.RefObject; - } -) => (
) +function CardHeader({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} CardHeader.displayName = "CardHeader" -const CardTitle = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref?: React.RefObject; - } -) => (

) +function CardTitle({ + className, + ...props +}: React.HTMLAttributes) { + return ( +

+ ) +} CardTitle.displayName = "CardTitle" -const CardDescription = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref?: React.RefObject; - } -) => (

) +function CardDescription({ + className, + ...props +}: React.HTMLAttributes) { + return ( +

+ ) +} CardDescription.displayName = "CardDescription" -const CardContent = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref: React.RefObject; - } -) => (

) +function CardContent({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} CardContent.displayName = "CardContent" -const CardFooter = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref: React.RefObject; - } -) => (
) +function CardFooter({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} CardFooter.displayName = "CardFooter" export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/amnet-web/src/components/ui/context-menu.tsx b/amnet-web/src/components/ui/context-menu.tsx index 9c5f668..f5ba19e 100644 --- a/amnet-web/src/components/ui/context-menu.tsx +++ b/amnet-web/src/components/ui/context-menu.tsx @@ -16,170 +16,166 @@ const ContextMenuSub = ContextMenuPrimitive.Sub const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup -const ContextMenuSubTrigger = ( - { - ref, - className, - inset, - children, - ...props - } -) => ( - {children} - -) +function ContextMenuSubTrigger({ + className, + inset, + children, + ...props +}: React.ComponentProps & { + inset?: boolean +}) { + return ( + + {children} + + + ) +} ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName -const ContextMenuSubContent = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function ContextMenuSubContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName -const ContextMenuContent = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => ( - -) +function ContextMenuContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + + + ) +} ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName -const ContextMenuItem = ( - { - ref, - className, - inset, - ...props - } -) => () +function ContextMenuItem({ + className, + inset, + ...props +}: React.ComponentProps & { + inset?: boolean +}) { + return ( + + ) +} ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName -const ContextMenuCheckboxItem = ( - { - ref, - className, - children, - checked, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => ( - - - - - - {children} -) +function ContextMenuCheckboxItem({ + className, + children, + checked, + ...props +}: React.ComponentProps) { + return ( + + + + + + + {children} + + ) +} ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName -const ContextMenuRadioItem = ( - { - ref, - className, - children, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => ( - - - - - - {children} -) +function ContextMenuRadioItem({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + + + + + {children} + + ) +} ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName -const ContextMenuLabel = ( - { - ref, - className, - inset, - ...props - } -) => () +function ContextMenuLabel({ + className, + inset, + ...props +}: React.ComponentProps & { + inset?: boolean +}) { + return ( + + ) +} ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName -const ContextMenuSeparator = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function ContextMenuSeparator({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName const ContextMenuShortcut = ({ diff --git a/amnet-web/src/components/ui/dialog.tsx b/amnet-web/src/components/ui/dialog.tsx index 65468c9..624ffc9 100644 --- a/amnet-web/src/components/ui/dialog.tsx +++ b/amnet-web/src/components/ui/dialog.tsx @@ -12,50 +12,46 @@ const DialogPortal = DialogPrimitive.Portal const DialogClose = DialogPrimitive.Close -const DialogOverlay = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function DialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} DialogOverlay.displayName = DialogPrimitive.Overlay.displayName -const DialogContent = ( - { - ref, - className, - children, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => ( - - - {children} - - - Close - - -) +function DialogContent({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + + {children} + + + Close + + + + ) +} DialogContent.displayName = DialogPrimitive.Content.displayName const DialogHeader = ({ @@ -86,37 +82,33 @@ const DialogFooter = ({ ) DialogFooter.displayName = "DialogFooter" -const DialogTitle = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function DialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} DialogTitle.displayName = DialogPrimitive.Title.displayName -const DialogDescription = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function DialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} DialogDescription.displayName = DialogPrimitive.Description.displayName export { diff --git a/amnet-web/src/components/ui/drawer.tsx b/amnet-web/src/components/ui/drawer.tsx index 9ca8224..1798e4a 100644 --- a/amnet-web/src/components/ui/drawer.tsx +++ b/amnet-web/src/components/ui/drawer.tsx @@ -20,44 +20,40 @@ const DrawerPortal = DrawerPrimitive.Portal const DrawerClose = DrawerPrimitive.Close -const DrawerOverlay = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function DrawerOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName -const DrawerContent = ( - { - ref, - className, - children, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => ( - - -
- {children} - -) +function DrawerContent({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + +
+ {children} + + + ) +} DrawerContent.displayName = "DrawerContent" const DrawerHeader = ({ @@ -82,37 +78,33 @@ const DrawerFooter = ({ ) DrawerFooter.displayName = "DrawerFooter" -const DrawerTitle = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function DrawerTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} DrawerTitle.displayName = DrawerPrimitive.Title.displayName -const DrawerDescription = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => () +function DrawerDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} DrawerDescription.displayName = DrawerPrimitive.Description.displayName export { diff --git a/amnet-web/src/components/ui/form.tsx b/amnet-web/src/components/ui/form.tsx index d5bb07b..ef1c1fb 100644 --- a/amnet-web/src/components/ui/form.tsx +++ b/amnet-web/src/components/ui/form.tsx @@ -70,39 +70,28 @@ const FormItemContext = React.createContext( {} as FormItemContextValue ) -const FormItem = ( - { - ref, - className, - ...props - }: React.HTMLAttributes & { - ref: React.RefObject; - } -) => { +function FormItem({ + className, + ...props +}: React.HTMLAttributes) { const id = React.useId() return ( -
+
) } FormItem.displayName = "FormItem" -const FormLabel = ( - { - ref, - className, - ...props - }: React.ComponentPropsWithoutRef & { - ref: React.RefObject>; - } -) => { +function FormLabel({ + className, + ...props +}: React.ComponentProps) { const { error, formItemId } = useFormField() return (