diff --git a/dashboard/src/components/confirmation-dialog-wrapper.tsx b/dashboard/src/components/confirmation-dialog-wrapper.tsx new file mode 100644 index 0000000..dbd8c83 --- /dev/null +++ b/dashboard/src/components/confirmation-dialog-wrapper.tsx @@ -0,0 +1,81 @@ +'use client'; + +import { Button, ButtonProps } from '@/components/ui/button'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from '@/components/ui/alert-dialog'; +import { ReactNode } from 'react'; +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; + +interface ButtonWithConfirmDialogProps { + buttonProps?: ButtonProps, + onCancel?: () => any + onSubmit: () => any + tooltipContent?: string + dialogTitle: string + dialogDescription: string + dialogButtonCancel?: string + dialogButtonCancelProps?: ButtonProps + dialogButtonSubmit?: string + dialogButtonSubmitProps?: ButtonProps + children: ReactNode +} + +export function ConfirmationDialogWrapper( + { + onCancel, + onSubmit, + tooltipContent, + dialogTitle, + dialogDescription, + dialogButtonCancel, + dialogButtonCancelProps, + dialogButtonSubmit, + dialogButtonSubmitProps, + children, + }: ButtonWithConfirmDialogProps) { + return ( + + + {tooltipContent} + + + + + {children} + + + + + {dialogTitle} + {dialogDescription} + + + + + + + + + + + + + ); +} \ No newline at end of file diff --git a/dashboard/src/components/ui/alert-dialog.tsx b/dashboard/src/components/ui/alert-dialog.tsx index d65d9d1..0fce158 100644 --- a/dashboard/src/components/ui/alert-dialog.tsx +++ b/dashboard/src/components/ui/alert-dialog.tsx @@ -104,7 +104,7 @@ const AlertDialogAction = React.forwardRef< >(({ className, ...props }, ref) => ( ));