From 94829daf1579202797fd1088d74f97b81bf82339 Mon Sep 17 00:00:00 2001 From: Jhon Date: Sun, 13 Jul 2025 13:35:26 -0300 Subject: [PATCH] fix(ui): code formatting and DialogHeader improvements - Apply consistent code formatting across dialog components - Add bottom padding to DialogHeader for better visual separation - Clean up DialogHeader usage in swarm settings (remove duplicate padding) - Improve schedule dialog layout and add proper description - Fix indentation and formatting inconsistencies Final cleanup of dialog component formatting and spacing. --- .../cluster/modify-swarm-settings.tsx | 2 +- .../schedules/handle-schedules.tsx | 144 +++++++++--------- apps/dokploy/components/ui/dialog.tsx | 73 +++++---- 3 files changed, 119 insertions(+), 100 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx index 1e120322d..b8a272e15 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx @@ -271,7 +271,7 @@ export const AddSwarmSettings = ({ applicationId }: Props) => { - + Swarm Settings Update certain settings using a json object. diff --git a/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx b/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx index 24e71bc70..2d3e9f931 100644 --- a/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx +++ b/apps/dokploy/components/dashboard/application/schedules/handle-schedules.tsx @@ -4,6 +4,7 @@ import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, + DialogDescription, DialogHeader, DialogTitle, DialogTrigger, @@ -232,14 +233,17 @@ export const HandleSchedules = ({ id, scheduleId, scheduleType }: Props) => { {scheduleId ? "Edit" : "Create"} Schedule + + {scheduleId ? "Manage" : "Create"} a schedule to run a task at a + specific time or interval. +
@@ -434,82 +438,82 @@ export const HandleSchedules = ({ id, scheduleId, scheduleType }: Props) => { {(scheduleTypeForm === "application" || scheduleTypeForm === "compose") && ( - <> - ( - - - Shell Type - - + + + + + + + Bash + Sh + + + + Choose the shell to execute your command + + + + )} + /> + ( + + + Command + - - - + - - Bash - Sh - - - - Choose the shell to execute your command - - - - )} - /> - ( - - - Command - - - - - - The command to execute in your container - - - - )} - /> - - )} + + The command to execute in your container + + + + )} + /> + + )} {(scheduleTypeForm === "dokploy-server" || scheduleTypeForm === "server") && ( - ( - - Script - + ( + + Script - + + className="h-96 font-mono" + {...field} + /> + - - - - )} - /> - )} + + + )} + /> + )} void; open?: boolean; }>({}); -const Dialog = ({ onOpenChange, open, ...props }: React.ComponentPropsWithoutRef) => ( +const Dialog = ({ + onOpenChange, + open, + ...props +}: React.ComponentPropsWithoutRef) => ( - + ); Dialog.displayName = DialogPrimitive.Root.displayName; @@ -44,18 +53,19 @@ const DialogContent = React.forwardRef< const { onOpenChange, open } = React.useContext(DialogContext); React.useEffect(() => { - if (!open) return; - - const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; + if (!open) return; + + const scrollbarWidth = + window.innerWidth - document.documentElement.clientWidth; const body = document.body; const originalPaddingRight = body.style.paddingRight; const originalOverflow = body.style.overflow; - - body.style.overflow = 'hidden'; + + body.style.overflow = "hidden"; if (scrollbarWidth > 0) { body.style.paddingRight = `${scrollbarWidth}px`; } - + return () => { body.style.overflow = originalOverflow; body.style.paddingRight = originalPaddingRight; @@ -63,23 +73,26 @@ const DialogContent = React.forwardRef< }, [open]); // Handle outside interactions properly with Command components - const handleInteractOutside = React.useCallback((e: Event) => { - if (onOpenChange) { - onOpenChange(false); - } - }, [onOpenChange]); + const handleInteractOutside = React.useCallback( + (_e: Event) => { + if (onOpenChange) { + onOpenChange(false); + } + }, + [onOpenChange], + ); const hasPaddingOverride = className?.includes("p-0"); - + // Separate DialogFooter from other children for proper layout const childrenArray = React.Children.toArray(children); - const dialogFooter = childrenArray.find((child) => - React.isValidElement(child) && child.type === DialogFooter + const dialogFooter = childrenArray.find( + (child) => React.isValidElement(child) && child.type === DialogFooter, ); - const otherChildren = childrenArray.filter((child) => - !(React.isValidElement(child) && child.type === DialogFooter) + const otherChildren = childrenArray.filter( + (child) => !(React.isValidElement(child) && child.type === DialogFooter), ); - + return ( {/* Custom overlay for modal=false - no click handler to avoid Command conflicts */} @@ -94,9 +107,11 @@ const DialogContent = React.forwardRef< onInteractOutside={(e) => { const target = e.target as HTMLElement; // Don't close when clicking inside popovers, dropdowns, or command components - if (target.closest('[data-radix-popper-content-wrapper]') || - target.closest('[cmdk-root]') || - target.closest('[data-radix-command-root]')) { + if ( + target.closest("[data-radix-popper-content-wrapper]") || + target.closest("[cmdk-root]") || + target.closest("[data-radix-command-root]") + ) { e.preventDefault(); return; } @@ -105,23 +120,23 @@ const DialogContent = React.forwardRef< }} {...props} > -
{otherChildren}
- + {/* DialogFooter outside scrollable area with proper spacing */} {dialogFooter && (
{dialogFooter}
)} - + Close @@ -138,7 +153,7 @@ const DialogHeader = ({ }: React.HTMLAttributes) => (