Skip to content

Commit 7f905cb

Browse files
feat(ui): show folder path in search modal
1 parent eba48e8 commit 7f905cb

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/components/command-items.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ export const MemoizedWorkflowItem = memo(
5151
onSelect,
5252
color,
5353
name,
54+
folderPath,
5455
isCurrent,
5556
}: {
5657
value: string
5758
onSelect: () => void
5859
color: string
5960
name: string
61+
folderPath?: string
6062
isCurrent?: boolean
6163
}) {
6264
return (
@@ -73,13 +75,19 @@ export const MemoizedWorkflowItem = memo(
7375
{name}
7476
{isCurrent && ' (current)'}
7577
</span>
78+
{folderPath && (
79+
<span className='ml-auto flex-shrink-0 truncate pl-2 font-base text-[var(--text-subtle)] text-small'>
80+
{folderPath}
81+
</span>
82+
)}
7683
</Command.Item>
7784
)
7885
},
7986
(prev, next) =>
8087
prev.value === next.value &&
8188
prev.color === next.color &&
8289
prev.name === next.name &&
90+
prev.folderPath === next.folderPath &&
8391
prev.isCurrent === next.isCurrent
8492
)
8593

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/components/search-groups.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ export const WorkflowsGroup = memo(function WorkflowsGroup({
163163
{items.map((workflow) => (
164164
<MemoizedWorkflowItem
165165
key={workflow.id}
166-
value={`${workflow.name} workflow-${workflow.id}`}
166+
value={`${workflow.name} ${workflow.folderPath ?? ''} workflow-${workflow.id}`}
167167
onSelect={() => onSelect(workflow)}
168168
color={workflow.color}
169169
name={workflow.name}
170+
folderPath={workflow.folderPath}
170171
isCurrent={workflow.isCurrent}
171172
/>
172173
))}

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface WorkflowItem {
1111
name: string
1212
href: string
1313
color: string
14+
folderPath?: string
1415
isCurrent?: boolean
1516
}
1617

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { useSession } from '@/lib/auth/auth-client'
4040
import { SIM_RESOURCES_DRAG_TYPE } from '@/lib/copilot/resource-types'
4141
import { cn } from '@/lib/core/utils/cn'
4242
import { isMacPlatform } from '@/lib/core/utils/platform'
43-
import { buildFolderTree } from '@/lib/folders/tree'
43+
import { buildFolderTree, getFolderPath } from '@/lib/folders/tree'
4444
import { captureEvent } from '@/lib/posthog/client'
4545
import {
4646
START_NAV_TOUR_EVENT,
@@ -613,14 +613,22 @@ export const Sidebar = memo(function Sidebar() {
613613

614614
const searchModalWorkflows = useMemo(
615615
() =>
616-
regularWorkflows.map((workflow) => ({
617-
id: workflow.id,
618-
name: workflow.name,
619-
href: `/workspace/${workspaceId}/w/${workflow.id}`,
620-
color: workflow.color,
621-
isCurrent: workflow.id === workflowId,
622-
})),
623-
[regularWorkflows, workspaceId, workflowId]
616+
regularWorkflows.map((workflow) => {
617+
const folderPath = workflow.folderId
618+
? getFolderPath(folderMap, workflow.folderId)
619+
.map((folder) => folder.name)
620+
.join(' / ')
621+
: ''
622+
return {
623+
id: workflow.id,
624+
name: workflow.name,
625+
href: `/workspace/${workspaceId}/w/${workflow.id}`,
626+
color: workflow.color,
627+
folderPath: folderPath || undefined,
628+
isCurrent: workflow.id === workflowId,
629+
}
630+
}),
631+
[regularWorkflows, folderMap, workspaceId, workflowId]
624632
)
625633

626634
const searchModalWorkspaces = useMemo(

0 commit comments

Comments
 (0)