Skip to content

Commit 1dbd161

Browse files
authored
feat(sidebar): context menu for nav items in sidebar, toolbar blocks, added missing docs for various blocks and triggers (#2754)
* feat(sidebar): context menu for nav items in sidebar * added toolbar context menu, fixed incorrect access pattern in old context menus and added docs for missing blocks * fixed links
1 parent 38e827b commit 1dbd161

File tree

33 files changed

+388
-25
lines changed

33 files changed

+388
-25
lines changed

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-context-menu/chunk-context-menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ export function ChunkContextMenu({
9595
}
9696

9797
return (
98-
<Popover open={isOpen} onOpenChange={onClose} variant='secondary' size='sm'>
98+
<Popover
99+
open={isOpen}
100+
onOpenChange={(open) => !open && onClose()}
101+
variant='secondary'
102+
size='sm'
103+
>
99104
<PopoverAnchor
100105
style={{
101106
position: 'fixed',

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/document-context-menu/document-context-menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ export function DocumentContextMenu({
100100
}
101101

102102
return (
103-
<Popover open={isOpen} onOpenChange={onClose} variant='secondary' size='sm'>
103+
<Popover
104+
open={isOpen}
105+
onOpenChange={(open) => !open && onClose()}
106+
variant='secondary'
107+
size='sm'
108+
>
104109
<PopoverAnchor
105110
style={{
106111
position: 'fixed',

apps/sim/app/workspace/[workspaceId]/knowledge/components/knowledge-base-context-menu/knowledge-base-context-menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ export function KnowledgeBaseContextMenu({
9999
disableDelete = false,
100100
}: KnowledgeBaseContextMenuProps) {
101101
return (
102-
<Popover open={isOpen} onOpenChange={onClose} variant='secondary' size='sm'>
102+
<Popover
103+
open={isOpen}
104+
onOpenChange={(open) => !open && onClose()}
105+
variant='secondary'
106+
size='sm'
107+
>
103108
<PopoverAnchor
104109
style={{
105110
position: 'fixed',

apps/sim/app/workspace/[workspaceId]/knowledge/components/knowledge-list-context-menu/knowledge-list-context-menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ export function KnowledgeListContextMenu({
4343
disableAdd = false,
4444
}: KnowledgeListContextMenuProps) {
4545
return (
46-
<Popover open={isOpen} onOpenChange={onClose} variant='secondary' size='sm'>
46+
<Popover
47+
open={isOpen}
48+
onOpenChange={(open) => !open && onClose()}
49+
variant='secondary'
50+
size='sm'
51+
>
4752
<PopoverAnchor
4853
style={{
4954
position: 'fixed',

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/components/snapshot-context-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function SnapshotContextMenu({
4444
return createPortal(
4545
<Popover
4646
open={isOpen}
47-
onOpenChange={onClose}
47+
onOpenChange={(open) => !open && onClose()}
4848
variant='secondary'
4949
size='sm'
5050
colorScheme='inverted'

apps/sim/app/workspace/[workspaceId]/logs/components/log-row-context-menu/log-row-context-menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ export function LogRowContextMenu({
4747
const hasWorkflow = Boolean(log?.workflow?.id || log?.workflowId)
4848

4949
return (
50-
<Popover open={isOpen} onOpenChange={onClose} variant='secondary' size='sm'>
50+
<Popover
51+
open={isOpen}
52+
onOpenChange={(open) => !open && onClose()}
53+
variant='secondary'
54+
size='sm'
55+
>
5156
<PopoverAnchor
5257
style={{
5358
position: 'fixed',

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/context-menu/block-context-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function BlockContextMenu({
5656
return (
5757
<Popover
5858
open={isOpen}
59-
onOpenChange={onClose}
59+
onOpenChange={(open) => !open && onClose()}
6060
variant='secondary'
6161
size='sm'
6262
colorScheme='inverted'

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/context-menu/pane-context-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function PaneContextMenu({
3838
return (
3939
<Popover
4040
open={isOpen}
41-
onOpenChange={onClose}
41+
onOpenChange={(open) => !open && onClose()}
4242
variant='secondary'
4343
size='sm'
4444
colorScheme='inverted'

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,23 +673,23 @@ function WorkflowInputMapperSyncWrapper({
673673

674674
if (!workflowId) {
675675
return (
676-
<div className='rounded-md border border-gray-600/50 bg-gray-900/20 p-4 text-center text-gray-400 text-sm'>
676+
<div className='rounded-md border border-[var(--border-1)] border-dashed bg-[var(--surface-3)] p-4 text-center text-[var(--text-muted)] text-sm'>
677677
Select a workflow to configure its inputs
678678
</div>
679679
)
680680
}
681681

682682
if (isLoading) {
683683
return (
684-
<div className='flex items-center justify-center rounded-md border border-gray-600/50 bg-gray-900/20 p-8'>
685-
<Loader2 className='h-5 w-5 animate-spin text-gray-400' />
684+
<div className='flex items-center justify-center rounded-md border border-[var(--border-1)] border-dashed bg-[var(--surface-3)] p-8'>
685+
<Loader2 className='h-5 w-5 animate-spin text-[var(--text-muted)]' />
686686
</div>
687687
)
688688
}
689689

690690
if (inputFields.length === 0) {
691691
return (
692-
<div className='rounded-md border border-gray-600/50 bg-gray-900/20 p-4 text-center text-gray-400 text-sm'>
692+
<div className='rounded-md border border-[var(--border-1)] border-dashed bg-[var(--surface-3)] p-4 text-center text-[var(--text-muted)] text-sm'>
693693
This workflow has no custom input fields
694694
</div>
695695
)

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useCallback, useEffect, useRef, useState } from 'react'
4-
import { BookOpen, Check, ChevronUp, Pencil, RepeatIcon, Settings, SplitIcon } from 'lucide-react'
4+
import { BookOpen, Check, ChevronUp, Pencil, Settings } from 'lucide-react'
55
import { Button, Tooltip } from '@/components/emcn'
66
import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
77
import {
@@ -15,6 +15,8 @@ import {
1515
useEditorBlockProperties,
1616
useEditorSubblockLayout,
1717
} from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks'
18+
import { LoopTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/loop/loop-config'
19+
import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/parallel/parallel-config'
1820
import { getSubBlockStableKey } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/utils'
1921
import { useCurrentWorkflow } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks'
2022
import { getBlock } from '@/blocks/registry'
@@ -58,9 +60,8 @@ export function Editor() {
5860
const isSubflow =
5961
currentBlock && (currentBlock.type === 'loop' || currentBlock.type === 'parallel')
6062

61-
// Get subflow display properties
62-
const subflowIcon = isSubflow && currentBlock.type === 'loop' ? RepeatIcon : SplitIcon
63-
const subflowBgColor = isSubflow && currentBlock.type === 'loop' ? '#2FB3FF' : '#FEE12B'
63+
// Get subflow display properties from configs
64+
const subflowConfig = isSubflow ? (currentBlock.type === 'loop' ? LoopTool : ParallelTool) : null
6465

6566
// Refs for resize functionality
6667
const subBlocksRef = useRef<HTMLDivElement>(null)
@@ -176,8 +177,9 @@ export function Editor() {
176177
* Handles opening documentation link in a new secure tab.
177178
*/
178179
const handleOpenDocs = () => {
179-
if (blockConfig?.docsLink) {
180-
window.open(blockConfig.docsLink, '_blank', 'noopener,noreferrer')
180+
const docsLink = isSubflow ? subflowConfig?.docsLink : blockConfig?.docsLink
181+
if (docsLink) {
182+
window.open(docsLink, '_blank', 'noopener,noreferrer')
181183
}
182184
}
183185

@@ -195,10 +197,10 @@ export function Editor() {
195197
{(blockConfig || isSubflow) && currentBlock?.type !== 'note' && (
196198
<div
197199
className='flex h-[18px] w-[18px] items-center justify-center rounded-[4px]'
198-
style={{ background: isSubflow ? subflowBgColor : blockConfig?.bgColor }}
200+
style={{ background: isSubflow ? subflowConfig?.bgColor : blockConfig?.bgColor }}
199201
>
200202
<IconComponent
201-
icon={isSubflow ? subflowIcon : blockConfig?.icon}
203+
icon={isSubflow ? subflowConfig?.icon : blockConfig?.icon}
202204
className='h-[12px] w-[12px] text-[var(--white)]'
203205
/>
204206
</div>
@@ -295,7 +297,7 @@ export function Editor() {
295297
</Tooltip.Content>
296298
</Tooltip.Root>
297299
)}
298-
{currentBlock && !isSubflow && blockConfig?.docsLink && (
300+
{currentBlock && (isSubflow ? subflowConfig?.docsLink : blockConfig?.docsLink) && (
299301
<Tooltip.Root>
300302
<Tooltip.Trigger asChild>
301303
<Button

0 commit comments

Comments
 (0)