Skip to content

Commit 35bda23

Browse files
committed
improvement(workflows): final polish on the reference viewer
- drop the vestigial isOpen prop (conditional mount owns visibility) - unify on the emcn Workflow icon in tree rows - inline the static className and derive nodes without an annotation - remove one restating test comment
1 parent 65aa1a1 commit 35bda23

4 files changed

Lines changed: 5 additions & 14 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/references-modal/components/reference-tree/reference-tree.tsx

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

3-
import { cn } from '@sim/emcn'
4-
import { WorkflowIcon } from '@/components/icons'
3+
import { Workflow } from '@sim/emcn/icons'
54
import type { ReferenceNode } from '@/lib/api/contracts/workflow-references'
65

76
const CONFIG = {
@@ -30,12 +29,9 @@ function ReferenceTreeItem({ node, depth, onNavigate }: ReferenceTreeItemProps)
3029
type='button'
3130
onClick={() => onNavigate(node.id)}
3231
style={{ paddingLeft: CONFIG.BASE_INDENT + depth * CONFIG.INDENT_PER_LEVEL }}
33-
className={cn(
34-
'flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors',
35-
'hover:bg-[var(--surface-hover)]'
36-
)}
32+
className='flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-[var(--surface-hover)]'
3733
>
38-
<WorkflowIcon className='size-[14px] shrink-0 text-[var(--text-icon)]' />
34+
<Workflow className='size-[14px] shrink-0 text-[var(--text-icon)]' />
3935
<span className='min-w-0 truncate text-[var(--text-body)] text-sm'>{node.name}</span>
4036
{node.cycle && (
4137
<span className='shrink-0 text-[var(--text-muted)] text-caption'>(cycle)</span>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/references-modal/references-modal.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { useState } from 'react'
44
import { ChipModal, ChipModalBody, ChipModalHeader, ChipModalTabs } from '@sim/emcn'
55
import { useRouter } from 'next/navigation'
6-
import type { ReferenceNode } from '@/lib/api/contracts/workflow-references'
76
import { ReferenceTree } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/references-modal/components/reference-tree/reference-tree'
87
import { useWorkflowReferences } from '@/hooks/queries/workflow-references'
98

@@ -20,7 +19,6 @@ const EMPTY_MESSAGE: Record<ReferencesTab, string> = {
2019
}
2120

2221
interface ReferencesModalProps {
23-
isOpen: boolean
2422
onClose: () => void
2523
workspaceId: string
2624
workflowId: string
@@ -34,7 +32,6 @@ interface ReferencesModalProps {
3432
* demand by the owning row, so state initializes fresh per open.
3533
*/
3634
export function ReferencesModal({
37-
isOpen,
3835
onClose,
3936
workspaceId,
4037
workflowId,
@@ -50,10 +47,10 @@ export function ReferencesModal({
5047
onClose()
5148
}
5249

53-
const nodes: ReferenceNode[] = data ? data[activeTab] : []
50+
const nodes = data?.[activeTab] ?? []
5451

5552
return (
56-
<ChipModal open={isOpen} onOpenChange={(next) => !next && onClose()} srTitle='References'>
53+
<ChipModal open onOpenChange={(next) => !next && onClose()} srTitle='References'>
5754
<ChipModalHeader onClose={onClose}>References · {workflowName}</ChipModalHeader>
5855
<ChipModalBody>
5956
<ChipModalTabs

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ export const WorkflowItem = memo(function WorkflowItem({
525525

526526
{isReferencesOpen && (
527527
<ReferencesModal
528-
isOpen
529528
onClose={() => setIsReferencesOpen(false)}
530529
workspaceId={workspaceId}
531530
workflowId={workflow.id}

apps/sim/lib/workflows/references/operations.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ describe('resolveWorkflowReferences', () => {
125125
})
126126

127127
it('resolves references made through custom blocks', () => {
128-
// D places custom_block_x, which is bound to source workflow C.
129128
const blocks: ReferenceBlockRow[] = [
130129
{
131130
parentId: 'd',

0 commit comments

Comments
 (0)