Skip to content

Commit 5756195

Browse files
committed
improvement(modal): ui, transition
1 parent 6199813 commit 5756195

File tree

2 files changed

+45
-25
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot
    • components/emcn/components/modal-new

2 files changed

+45
-25
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ export const Copilot = forwardRef<CopilotRef, CopilotProps>(({ panelWidth }, ref
460460
{!isInitialized ? (
461461
<div className='flex h-full w-full items-center justify-center'>
462462
<div className='flex flex-col items-center gap-3'>
463-
<p className='text-muted-foreground text-sm'>Loading chat history...</p>
463+
<p className='text-muted-foreground text-sm'>Loading copilot</p>
464464
</div>
465465
</div>
466466
) : (

apps/sim/components/emcn/components/modal-new/modal.tsx

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ import { X } from 'lucide-react'
4343
import { cn } from '@/lib/utils'
4444
import { Button } from '../button/button'
4545

46+
/**
47+
* Shared animation classes for modal transitions.
48+
* Mirrors the legacy `Modal` component to ensure consistent behavior.
49+
*/
50+
const ANIMATION_CLASSES =
51+
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=open]:animate-in'
52+
53+
/**
54+
* Modal content animation classes.
55+
* We keep only the slide animations (no zoom) to stabilize positioning while avoiding scale effects.
56+
*/
57+
const CONTENT_ANIMATION_CLASSES =
58+
'data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[50%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[50%]'
59+
4660
/**
4761
* Root modal component. Manages open state.
4862
*/
@@ -64,7 +78,7 @@ const ModalPortal = DialogPrimitive.Portal
6478
const ModalClose = DialogPrimitive.Close
6579

6680
/**
67-
* Modal overlay component with stability handling.
81+
* Modal overlay component with stability handling and fade transition.
6882
*/
6983
const ModalOverlay = React.forwardRef<
7084
React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -80,7 +94,11 @@ const ModalOverlay = React.forwardRef<
8094
return (
8195
<DialogPrimitive.Overlay
8296
ref={ref}
83-
className={cn('fixed inset-0 z-50', className)}
97+
className={cn(
98+
'fixed inset-0 z-50 light:bg-[#E4E4E4]/50 backdrop-blur-[0.75px] dark:bg-[#0D0D0D]/50',
99+
ANIMATION_CLASSES,
100+
className
101+
)}
84102
style={style}
85103
onPointerDown={(e) => {
86104
if (!isStable) {
@@ -128,7 +146,9 @@ const ModalContent = React.forwardRef<
128146
<DialogPrimitive.Content
129147
ref={ref}
130148
className={cn(
131-
'-translate-x-1/2 -translate-y-1/2 fixed top-1/2 left-1/2 z-50 flex max-h-[80vh] min-w-[30vw] flex-col rounded-[8px] border bg-[#1E1E1E]',
149+
ANIMATION_CLASSES,
150+
CONTENT_ANIMATION_CLASSES,
151+
'fixed top-[50%] left-[50%] z-50 flex max-h-[80vh] min-w-[30vw] translate-x-[-50%] translate-y-[-50%] flex-col rounded-[8px] border bg-[var(--bg)] shadow-sm duration-200',
132152
className
133153
)}
134154
style={style}
@@ -223,24 +243,6 @@ const ModalDescription = React.forwardRef<
223243

224244
ModalDescription.displayName = 'ModalDescription'
225245

226-
/**
227-
* Modal body/content area with background and padding.
228-
*/
229-
const ModalBody = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
230-
({ className, ...props }, ref) => (
231-
<div
232-
ref={ref}
233-
className={cn(
234-
'flex-1 overflow-y-auto rounded-t-[8px] border-t bg-[#232323] px-[14px] pt-[10px] pb-[20px]',
235-
className
236-
)}
237-
{...props}
238-
/>
239-
)
240-
)
241-
242-
ModalBody.displayName = 'ModalBody'
243-
244246
/**
245247
* Modal tabs root component. Wraps tab list and content panels.
246248
*/
@@ -291,6 +293,24 @@ const ModalTabsContent = React.forwardRef<
291293

292294
ModalTabsContent.displayName = 'ModalTabsContent'
293295

296+
/**
297+
* Modal body/content area with background and padding.
298+
*/
299+
const ModalBody = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
300+
({ className, ...props }, ref) => (
301+
<div
302+
ref={ref}
303+
className={cn(
304+
'flex-1 overflow-y-auto rounded-t-[8px] border-t bg-[#232323] px-[14px] pt-[10px] pb-[20px]',
305+
className
306+
)}
307+
{...props}
308+
/>
309+
)
310+
)
311+
312+
ModalBody.displayName = 'ModalBody'
313+
294314
/**
295315
* Modal footer component for action buttons.
296316
*/
@@ -311,10 +331,7 @@ ModalFooter.displayName = 'ModalFooter'
311331

312332
export {
313333
Modal,
314-
ModalPortal,
315-
ModalOverlay,
316334
ModalTrigger,
317-
ModalClose,
318335
ModalContent,
319336
ModalSidebar,
320337
ModalHeader,
@@ -326,4 +343,7 @@ export {
326343
ModalTabsTrigger,
327344
ModalTabsContent,
328345
ModalFooter,
346+
ModalPortal,
347+
ModalOverlay,
348+
ModalClose,
329349
}

0 commit comments

Comments
 (0)