Skip to content

Commit 7ea4a19

Browse files
committed
removed empty placeholder images for drag, removed redundant local sanitization helper
1 parent 83ec55b commit 7ea4a19

File tree

4 files changed

+4
-34
lines changed

4 files changed

+4
-34
lines changed

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ import { generateCreativeWorkflowName } from '@/stores/workflows/registry/utils'
2929

3030
const logger = createLogger('FolderItem')
3131

32-
let EMPTY_DRAG_IMAGE: HTMLImageElement | null = null
33-
function getEmptyDragImage(): HTMLImageElement {
34-
if (!EMPTY_DRAG_IMAGE && typeof window !== 'undefined') {
35-
EMPTY_DRAG_IMAGE = new Image(1, 1)
36-
EMPTY_DRAG_IMAGE.src =
37-
'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
38-
}
39-
return EMPTY_DRAG_IMAGE!
40-
}
41-
4232
interface FolderItemProps {
4333
folder: FolderTreeNode
4434
level: number
@@ -160,11 +150,6 @@ export function FolderItem({
160150
return
161151
}
162152

163-
const emptyImg = getEmptyDragImage()
164-
if (emptyImg?.complete) {
165-
e.dataTransfer.setDragImage(emptyImg, 0, 0)
166-
}
167-
168153
e.dataTransfer.setData('folder-id', folder.id)
169154
e.dataTransfer.effectAllowed = 'move'
170155
onDragStartProp?.()

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ import { useFolderStore } from '@/stores/folders/store'
2424
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
2525
import type { WorkflowMetadata } from '@/stores/workflows/registry/types'
2626

27-
let EMPTY_DRAG_IMAGE: HTMLImageElement | null = null
28-
function getEmptyDragImage(): HTMLImageElement {
29-
if (!EMPTY_DRAG_IMAGE && typeof window !== 'undefined') {
30-
EMPTY_DRAG_IMAGE = new Image(1, 1)
31-
EMPTY_DRAG_IMAGE.src =
32-
'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
33-
}
34-
return EMPTY_DRAG_IMAGE!
35-
}
36-
3727
interface WorkflowItemProps {
3828
workflow: WorkflowMetadata
3929
active: boolean
@@ -237,11 +227,6 @@ export function WorkflowItem({
237227
return
238228
}
239229

240-
const emptyImg = getEmptyDragImage()
241-
if (emptyImg?.complete) {
242-
e.dataTransfer.setDragImage(emptyImg, 0, 0)
243-
}
244-
245230
const currentSelection = useFolderStore.getState().selectedWorkflows
246231
const isCurrentlySelected = currentSelection.has(workflow.id)
247232
const workflowIds =

apps/sim/app/workspace/[workspaceId]/w/hooks/use-import-workflow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
extractWorkflowsFromFiles,
88
extractWorkflowsFromZip,
99
parseWorkflowJson,
10+
sanitizePathSegment,
1011
} from '@/lib/workflows/operations/import-export'
1112
import { folderKeys, useCreateFolder } from '@/hooks/queries/folders'
1213
import { useCreateWorkflow, workflowKeys } from '@/hooks/queries/workflows'
@@ -140,7 +141,6 @@ export function useImportWorkflow({ workspaceId }: UseImportWorkflowProps) {
140141
workspaceId,
141142
})
142143
const folderMap = new Map<string, string>()
143-
const sanitizeName = (name: string) => name.replace(/[^a-z0-9-_]/gi, '-')
144144

145145
if (metadata?.folders && metadata.folders.length > 0) {
146146
type ExportedFolder = {
@@ -159,7 +159,7 @@ export function useImportWorkflow({ workspaceId }: UseImportWorkflowProps) {
159159
let currentId: string | null = folderId
160160
while (currentId && foldersById.has(currentId)) {
161161
const folder: ExportedFolder = foldersById.get(currentId)!
162-
pathParts.unshift(sanitizeName(folder.name))
162+
pathParts.unshift(sanitizePathSegment(folder.name))
163163
currentId = folder.parentId
164164
}
165165
return pathParts.join('/')

apps/sim/app/workspace/[workspaceId]/w/hooks/use-import-workspace.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
extractWorkflowName,
66
extractWorkflowsFromZip,
77
parseWorkflowJson,
8+
sanitizePathSegment,
89
} from '@/lib/workflows/operations/import-export'
910
import { useCreateFolder } from '@/hooks/queries/folders'
1011
import { useWorkflowDiffStore } from '@/stores/workflow-diff/store'
@@ -70,7 +71,6 @@ export function useImportWorkspace({ onSuccess }: UseImportWorkspaceProps = {})
7071
logger.info('Created new workspace:', newWorkspace)
7172

7273
const folderMap = new Map<string, string>()
73-
const sanitizeName = (name: string) => name.replace(/[^a-z0-9-_]/gi, '-')
7474

7575
if (metadata?.folders && metadata.folders.length > 0) {
7676
type ExportedFolder = {
@@ -89,7 +89,7 @@ export function useImportWorkspace({ onSuccess }: UseImportWorkspaceProps = {})
8989
let currentId: string | null = folderId
9090
while (currentId && foldersById.has(currentId)) {
9191
const folder: ExportedFolder = foldersById.get(currentId)!
92-
pathParts.unshift(sanitizeName(folder.name))
92+
pathParts.unshift(sanitizePathSegment(folder.name))
9393
currentId = folder.parentId
9494
}
9595
return pathParts.join('/')

0 commit comments

Comments
 (0)