onOpenChange(false)}
+ onClick={handleOverlayClick}
aria-hidden={!open}
/>
@@ -363,201 +442,40 @@ export function SearchModal({
'-translate-x-1/2 fixed top-[15%] z-50 w-[500px] rounded-xl border-[4px] border-black/[0.06] bg-[var(--bg)] shadow-[0_24px_80px_-16px_rgba(0,0,0,0.15)] dark:border-white/[0.06] dark:shadow-[0_24px_80px_-16px_rgba(0,0,0,0.4)]',
open ? 'visible opacity-100' : 'invisible opacity-0'
)}
- style={{ left: '50%' }}
+ style={{
+ left: isOnWorkflowPage
+ ? 'calc(50% + (var(--sidebar-width) - var(--panel-width)) / 2)'
+ : 'calc(var(--sidebar-width) / 2 + 50%)',
+ }}
>
-
+
-
-
+
+
No results found.
- {filteredBlocks.length > 0 && (
-
- {filteredBlocks.map((block) => (
- handleBlockSelect(block, 'block')}
- icon={block.icon}
- bgColor={block.bgColor}
- showColoredIcon
- >
- {block.name}
-
- ))}
-
- )}
-
- {filteredTools.length > 0 && (
-
- {filteredTools.map((tool) => (
- handleBlockSelect(tool, 'tool')}
- icon={tool.icon}
- bgColor={tool.bgColor}
- showColoredIcon
- >
- {tool.name}
-
- ))}
-
- )}
-
- {filteredTriggers.length > 0 && (
-
- {filteredTriggers.map((trigger) => (
- handleBlockSelect(trigger, 'trigger')}
- icon={trigger.icon}
- bgColor={trigger.bgColor}
- showColoredIcon
- >
- {trigger.name}
-
- ))}
-
- )}
-
- {filteredWorkflows.length > 0 && open && (
-
- {filteredWorkflows.map((workflow) => (
- handleWorkflowSelect(workflow)}
- className='group flex h-[30px] w-full cursor-pointer items-center gap-[8px] rounded-[8px] border border-transparent px-[8px] text-left text-[14px] aria-selected:border-[var(--border-1)] aria-selected:bg-[var(--surface-5)] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 dark:aria-selected:bg-[var(--surface-4)]'
- >
-
-
- {workflow.name}
- {workflow.isCurrent && ' (current)'}
-
-
- ))}
-
- )}
-
- {filteredTasks.length > 0 && open && (
-
- {filteredTasks.map((task) => (
- {
- router.push(task.href)
- onOpenChange(false)
- }}
- className='group flex h-[30px] w-full cursor-pointer items-center gap-[8px] rounded-[8px] border border-transparent px-[8px] text-left text-[14px] aria-selected:border-[var(--border-1)] aria-selected:bg-[var(--surface-5)] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 dark:aria-selected:bg-[var(--surface-4)]'
- >
-
-
-
- {task.name}
-
- ))}
-
- )}
-
- {filteredToolOps.length > 0 && (
-
- {filteredToolOps.map((op) => (
- handleToolOperationSelect(op)}
- icon={op.icon}
- bgColor={op.bgColor}
- showColoredIcon
- >
- {op.name}
-
- ))}
-
- )}
-
- {filteredWorkspaces.length > 0 && open && (
-
- {filteredWorkspaces.map((workspace) => (
- handleWorkspaceSelect(workspace)}
- className='group flex h-[30px] w-full cursor-pointer items-center gap-[8px] rounded-[8px] border border-transparent px-[8px] text-left text-[14px] aria-selected:border-[var(--border-1)] aria-selected:bg-[var(--surface-5)] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 dark:aria-selected:bg-[var(--surface-4)]'
- >
-
- {workspace.name}
- {workspace.isCurrent && ' (current)'}
-
-
- ))}
-
- )}
-
- {filteredDocs.length > 0 && (
-
- {filteredDocs.map((doc) => (
- handleDocSelect(doc)}
- icon={doc.icon}
- bgColor='#6B7280'
- showColoredIcon
- >
- {doc.name}
-
- ))}
-
- )}
-
- {filteredPages.length > 0 && open && (
-
- {filteredPages.map((page) => {
- const Icon = page.icon
- return (
- handlePageSelect(page)}
- className='group flex h-[30px] w-full cursor-pointer items-center gap-[8px] rounded-[8px] border border-transparent px-[8px] text-left text-[14px] aria-selected:border-[var(--border-1)] aria-selected:bg-[var(--surface-5)] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 dark:aria-selected:bg-[var(--surface-4)]'
- >
-
-
-
-
- {page.name}
-
- {page.shortcut && (
-
- {page.shortcut}
-
- )}
-
- )
- })}
-
- )}
+
+
+
+
+
+
+
+
+
+
+
+
@@ -565,57 +483,3 @@ export function SearchModal({
document.body
)
}
-
-const groupHeadingClassName =
- '[&_[cmdk-group-heading]]:px-[8px] [&_[cmdk-group-heading]]:pt-[2px] [&_[cmdk-group-heading]]:pb-[6px] [&_[cmdk-group-heading]]:font-base [&_[cmdk-group-heading]]:text-[12px] [&_[cmdk-group-heading]]:text-[var(--text-icon)]'
-
-interface CommandItemProps {
- value: string
- onSelect: () => void
- icon: React.ComponentType<{ className?: string }>
- bgColor: string
- showColoredIcon?: boolean
- children: React.ReactNode
-}
-
-// onSelect is safe to exclude: cmdk stores it in a ref (useAsRef) internally,
-// so the latest closure is always invoked regardless of whether React re-renders.
-const MemoizedCommandItem = memo(
- function CommandItem({
- value,
- onSelect,
- icon: Icon,
- bgColor,
- showColoredIcon,
- children,
- }: CommandItemProps) {
- return (
-
-
-
-
- {children}
-
- )
- },
- (prev, next) =>
- prev.value === next.value &&
- prev.icon === next.icon &&
- prev.bgColor === next.bgColor &&
- prev.showColoredIcon === next.showColoredIcon &&
- prev.children === next.children
-)
diff --git a/apps/sim/components/emcn/components/modal/modal.tsx b/apps/sim/components/emcn/components/modal/modal.tsx
index d4f92699640..60ba90ed96e 100644
--- a/apps/sim/components/emcn/components/modal/modal.tsx
+++ b/apps/sim/components/emcn/components/modal/modal.tsx
@@ -40,6 +40,7 @@ import * as React from 'react'
import * as DialogPrimitive from '@radix-ui/react-dialog'
import * as TabsPrimitive from '@radix-ui/react-tabs'
import { X } from 'lucide-react'
+import { usePathname } from 'next/navigation'
import { cn } from '@/lib/core/utils/cn'
import { Button } from '../button/button'
@@ -48,14 +49,14 @@ import { Button } from '../button/button'
* Mirrors the legacy `Modal` component to ensure consistent behavior.
*/
const ANIMATION_CLASSES =
- 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=open]:animate-in'
+ 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none'
/**
* Modal content animation classes.
* We keep only the slide animations (no zoom) to stabilize positioning while avoiding scale effects.
*/
const CONTENT_ANIMATION_CLASSES =
- '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%]'
+ 'data-[state=closed]:slide-out-to-top-[50%] data-[state=open]:slide-in-from-top-[50%] motion-reduce:animate-none'
/**
* Root modal component. Manages open state.
@@ -90,7 +91,7 @@ const ModalOverlay = React.forwardRef<
(({ className, children, showClose = true, size = 'md', style, ...props }, ref) => {
const [isInteractionReady, setIsInteractionReady] = React.useState(false)
+ const pathname = usePathname()
+ const isWorkflowPage = pathname?.includes('/w/') ?? false
React.useEffect(() => {
const timer = setTimeout(() => setIsInteractionReady(true), 100)
@@ -159,12 +162,14 @@ const ModalContent = React.forwardRef<
className={cn(
ANIMATION_CLASSES,
CONTENT_ANIMATION_CLASSES,
- 'fixed top-[50%] z-[500] flex max-h-[84vh] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl bg-[var(--bg)] text-[13px] ring-1 ring-foreground/10 duration-200',
+ 'fixed top-[50%] z-[var(--z-modal)] flex max-h-[84vh] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl bg-[var(--bg)] text-small ring-1 ring-foreground/10 duration-200',
MODAL_SIZES[size],
className
)}
style={{
- left: '50%',
+ left: isWorkflowPage
+ ? 'calc(50% + (var(--sidebar-width) - var(--panel-width)) / 2)'
+ : 'calc(var(--sidebar-width) / 2 + 50%)',
...style,
}}
onEscapeKeyDown={(e) => {
@@ -204,7 +209,10 @@ const ModalHeader = React.forwardRef
-