Skip to content

Commit 3554d7f

Browse files
committed
cleanup
1 parent 5088074 commit 3554d7f

File tree

5 files changed

+1
-82
lines changed

5 files changed

+1
-82
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const SCOPE_DESCRIPTIONS: Record<string, string> = {
3838
'https://www.googleapis.com/auth/gmail.modify': 'View and manage email messages',
3939
'https://www.googleapis.com/auth/drive.file': 'View and manage Google Drive files',
4040
'https://www.googleapis.com/auth/drive': 'Access all Google Drive files',
41-
'https://www.googleapis.com/auth/drive.readonly': 'View Google Drive files',
4241
'https://www.googleapis.com/auth/calendar': 'View and manage calendar',
4342
'https://www.googleapis.com/auth/userinfo.email': 'View email address',
4443
'https://www.googleapis.com/auth/userinfo.profile': 'View basic profile info',

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const findFolderInNested = (
2929
if (folderId === targetFolderId) {
3030
return nestedTag
3131
}
32-
// Recursively search in nested children
3332
if (nestedTag.nestedChildren) {
3433
const found = findFolderInNested(nestedTag.nestedChildren, blockId, targetFolderId)
3534
if (found) return found
@@ -67,7 +66,6 @@ const findFolderInfoForTag = (
6766
nestedTag,
6867
}
6968
}
70-
// Recursively search in nested children
7169
if (nestedTag.nestedChildren) {
7270
const found = findFolderInfoForTag(nestedTag.nestedChildren, targetTag, group)
7371
if (found) return found
@@ -82,22 +80,19 @@ const findFolderInfoForTag = (
8280
*/
8381
const isChildOfAnyFolder = (nestedTags: NestedTag[], tag: string): boolean => {
8482
for (const nestedTag of nestedTags) {
85-
// Check in leaf children
8683
if (nestedTag.children) {
8784
for (const child of nestedTag.children) {
8885
if (child.fullTag === tag) {
8986
return true
9087
}
9188
}
9289
}
93-
// Check if this is a nested folder's parent tag (should be hidden at root)
9490
if (nestedTag.nestedChildren) {
9591
for (const nestedChild of nestedTag.nestedChildren) {
9692
if (nestedChild.parentTag === tag) {
9793
return true
9894
}
9995
}
100-
// Recursively check deeper nested children
10196
if (isChildOfAnyFolder(nestedTag.nestedChildren, tag)) {
10297
return true
10398
}
@@ -122,14 +117,11 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
122117
const nestedPath = nestedNav?.nestedPath ?? []
123118

124119
if (isInFolder && currentFolder) {
125-
// Determine the current folder to show based on nested navigation
126120
let currentNestedTag: NestedTag | null = null
127121

128122
if (nestedPath.length > 0) {
129-
// We're in nested navigation - use the deepest nested tag
130123
currentNestedTag = nestedPath[nestedPath.length - 1]
131124
} else {
132-
// At base folder level - find the folder from currentFolder ID
133125
for (const group of nestedBlockTagGroups) {
134126
const folder = findFolderInNested(group.nestedTags, group.blockId, currentFolder)
135127
if (folder) {
@@ -140,7 +132,6 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
140132
}
141133

142134
if (currentNestedTag) {
143-
// First, add the parent tag itself (so it's navigable as the first item)
144135
if (currentNestedTag.parentTag) {
145136
const parentIdx = flatTagList.findIndex(
146137
(item) => item.tag === currentNestedTag!.parentTag
@@ -149,7 +140,6 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
149140
indices.push(parentIdx)
150141
}
151142
}
152-
// Add all leaf children
153143
if (currentNestedTag.children) {
154144
for (const child of currentNestedTag.children) {
155145
const idx = flatTagList.findIndex((item) => item.tag === child.fullTag)
@@ -158,7 +148,6 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
158148
}
159149
}
160150
}
161-
// Add nested children parent tags (for subfolder navigation)
162151
if (currentNestedTag.nestedChildren) {
163152
for (const nestedChild of currentNestedTag.nestedChildren) {
164153
if (nestedChild.parentTag) {
@@ -171,12 +160,9 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
171160
}
172161
}
173162
} else {
174-
// We're at root level, show all non-child items
175-
// (variables and parent tags, but not their children)
176163
for (let i = 0; i < flatTagList.length; i++) {
177164
const tag = flatTagList[i].tag
178165

179-
// Check if this is a child of a parent folder
180166
let isChild = false
181167
for (const group of nestedBlockTagGroups) {
182168
if (isChildOfAnyFolder(group.nestedTags, tag)) {
@@ -194,15 +180,11 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
194180
return indices
195181
}, [isInFolder, currentFolder, flatTagList, nestedBlockTagGroups, nestedNav])
196182

197-
// Track nested path length for dependency
198183
const nestedPathLength = nestedNav?.nestedPath.length ?? 0
199184

200-
// Auto-select first visible item when entering/exiting folders or navigating nested
201-
// This effect only runs when folder navigation state changes, not on every render
202185
useEffect(() => {
203186
if (!visible || visibleIndices.length === 0) return
204187

205-
// Select first visible item when entering a folder or navigating nested
206188
setSelectedIndex(visibleIndices[0])
207189
// eslint-disable-next-line react-hooks/exhaustive-deps
208190
}, [visible, isInFolder, currentFolder, nestedPathLength])
@@ -237,7 +219,6 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
237219
} | null = null
238220

239221
if (selected) {
240-
// Find if selected tag can be expanded (is a folder)
241222
for (const group of nestedBlockTagGroups) {
242223
const folderInfo = findFolderInfoForTag(group.nestedTags, selected.tag, group)
243224
if (folderInfo) {
@@ -278,8 +259,6 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
278259
e.preventDefault()
279260
e.stopPropagation()
280261
if (selected && selectedIndex >= 0 && selectedIndex < flatTagList.length) {
281-
// Always select the tag, even for folders
282-
// Use Arrow Right to navigate into folders
283262
handleTagSelect(selected.tag, selected.group)
284263
}
285264
break
@@ -288,10 +267,8 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
288267
e.preventDefault()
289268
e.stopPropagation()
290269
if (isInFolder && nestedNav) {
291-
// Already in a folder - use nested navigation to go deeper
292270
nestedNav.navigateIn(currentFolderInfo.nestedTag, currentFolderInfo.group)
293271
} else {
294-
// At root level - open the folder normally
295272
openFolderWithSelection(
296273
currentFolderInfo.id,
297274
currentFolderInfo.title,
@@ -305,13 +282,9 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
305282
if (isInFolder) {
306283
e.preventDefault()
307284
e.stopPropagation()
308-
// Try to navigate back in nested path first
309285
if (nestedNav?.navigateBack()) {
310-
// Successfully navigated back one level in nested navigation
311-
// Selection will be handled by the auto-select effect
312286
return
313287
}
314-
// At root folder level, close the folder entirely
315288
closeFolder()
316289
let firstRootIndex = 0
317290
for (let i = 0; i < flatTagList.length; i++) {

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

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,10 @@ interface TagTreeNode {
340340
const buildNestedTagTree = (tags: string[], blockName: string): NestedTag[] => {
341341
const root: TagTreeNode = { key: 'root', children: new Map() }
342342

343-
// Build tree from tags
344343
for (const tag of tags) {
345344
const parts = tag.split('.')
346-
if (parts.length < 2) continue // Skip root-only tags
345+
if (parts.length < 2) continue
347346

348-
// Skip the blockname part, start from the first property
349347
const pathParts = parts.slice(1)
350348
let current = root
351349

@@ -359,15 +357,13 @@ const buildNestedTagTree = (tags: string[], blockName: string): NestedTag[] => {
359357
}
360358
const node = current.children.get(part)!
361359

362-
// If this is the last part, store the full tag
363360
if (i === pathParts.length - 1) {
364361
node.fullTag = tag
365362
}
366363
current = node
367364
}
368365
}
369366

370-
// Convert tree to NestedTag array
371367
const convertToNestedTags = (
372368
node: TagTreeNode,
373369
parentPath: string,
@@ -380,17 +376,14 @@ const buildNestedTagTree = (tags: string[], blockName: string): NestedTag[] => {
380376
const parentTag = `${blockPrefix}.${currentPath}`
381377

382378
if (child.children.size === 0) {
383-
// Leaf node
384379
result.push({
385380
key: currentPath,
386381
display: key,
387382
fullTag: child.fullTag || parentTag,
388383
})
389384
} else {
390-
// Folder node - may have both leaf value and children
391385
const nestedChildren = convertToNestedTags(child, currentPath, blockPrefix)
392386

393-
// Separate leaf children from nested folders
394387
const leafChildren: NestedTagChild[] = []
395388
const folders: NestedTag[] = []
396389

@@ -483,10 +476,8 @@ const FolderContentsInner: React.FC<FolderContentsProps> = ({
483476
nestedTag,
484477
onNavigateIn,
485478
}) => {
486-
// Get the current folder based on nested path
487479
const currentNestedTag = nestedPath.length > 0 ? nestedPath[nestedPath.length - 1] : nestedTag
488480

489-
// Find parent tag index for highlighting
490481
const parentTagIndex = currentNestedTag.parentTag
491482
? flatTagList.findIndex((item) => item.tag === currentNestedTag.parentTag)
492483
: -1
@@ -609,7 +600,6 @@ const FolderContents: React.FC<NestedTagRendererProps> = (props) => {
609600

610601
const nestedPath = nestedNav?.nestedPath ?? []
611602

612-
// Register this folder when it becomes active
613603
useEffect(() => {
614604
if (nestedNav && currentFolder) {
615605
const folderId = `${props.group.blockId}-${props.nestedTag.key}`
@@ -647,7 +637,6 @@ const NestedTagRenderer: React.FC<NestedTagRendererProps> = ({
647637
const hasChildren = nestedTag.children && nestedTag.children.length > 0
648638
const hasNestedChildren = nestedTag.nestedChildren && nestedTag.nestedChildren.length > 0
649639

650-
// If this tag has children (leaf or nested), render as a folder
651640
if (hasChildren || hasNestedChildren) {
652641
const folderId = `${group.blockId}-${nestedTag.key}`
653642

@@ -863,7 +852,6 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
863852
const [selectedIndex, setSelectedIndex] = useState(0)
864853
const itemRefs = useRef<Map<number, HTMLElement>>(new Map())
865854

866-
// Nested navigation state - supports unlimited nesting depth
867855
const [nestedPath, setNestedPath] = useState<NestedTag[]>([])
868856
const baseFolderRef = useRef<{
869857
id: string
@@ -1578,31 +1566,25 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
15781566
list.push({ tag })
15791567
})
15801568

1581-
// Recursively flatten nested tags
15821569
const flattenNestedTag = (nestedTag: NestedTag, group: BlockTagGroup, rootTag: string) => {
1583-
// Skip if this is the root tag (already added)
15841570
if (nestedTag.fullTag === rootTag) {
15851571
return
15861572
}
15871573

1588-
// Add parent tag for folders
15891574
if (nestedTag.parentTag) {
15901575
list.push({ tag: nestedTag.parentTag, group })
15911576
}
15921577

1593-
// Add the tag itself if it's a leaf
15941578
if (nestedTag.fullTag && !nestedTag.children && !nestedTag.nestedChildren) {
15951579
list.push({ tag: nestedTag.fullTag, group })
15961580
}
15971581

1598-
// Add leaf children
15991582
if (nestedTag.children) {
16001583
nestedTag.children.forEach((child) => {
16011584
list.push({ tag: child.fullTag, group })
16021585
})
16031586
}
16041587

1605-
// Recursively process nested children
16061588
if (nestedTag.nestedChildren) {
16071589
nestedTag.nestedChildren.forEach((nestedChild) => {
16081590
flattenNestedTag(nestedChild, group, rootTag)
@@ -1727,15 +1709,12 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
17271709
[inputValue, cursorPosition, workflowVariables, onSelect, onClose, getMergedSubBlocks]
17281710
)
17291711

1730-
// Keep ref updated for nested navigation
17311712
handleTagSelectRef.current = handleTagSelect
17321713

1733-
// Get popover context for nested navigation (will be available inside Popover)
17341714
const popoverContextRef = useRef<{
17351715
openFolder: (id: string, title: string, onLoad?: () => void, onSelect?: () => void) => void
17361716
} | null>(null)
17371717

1738-
// Create nested navigation context value
17391718
const nestedNavigationValue = useMemo<NestedNavigationContextValue>(
17401719
() => ({
17411720
nestedPath,
@@ -1745,12 +1724,10 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
17451724

17461725
setNestedPath((prev) => [...prev, tag])
17471726

1748-
// Reset scroll to top when navigating into a folder
17491727
if (scrollAreaRef.current) {
17501728
scrollAreaRef.current.scrollTop = 0
17511729
}
17521730

1753-
// Update popover's folder title to show current nested folder
17541731
const selectionCallback = () => {
17551732
if (tag.parentTag && handleTagSelectRef.current) {
17561733
handleTagSelectRef.current(tag.parentTag, group)
@@ -1772,7 +1749,6 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
17721749
setNestedPath(newPath)
17731750

17741751
if (newPath.length === 0) {
1775-
// Going back to root folder level
17761752
const selectionCallback = () => {
17771753
if (baseFolder.baseTag.parentTag && handleTagSelectRef.current) {
17781754
handleTagSelectRef.current(baseFolder.baseTag.parentTag, baseFolder.group)
@@ -1785,7 +1761,6 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
17851761
selectionCallback
17861762
)
17871763
} else {
1788-
// Going back to a nested folder
17891764
const parentTag = newPath[newPath.length - 1]
17901765
const selectionCallback = () => {
17911766
if (parentTag.parentTag && handleTagSelectRef.current) {
@@ -1803,7 +1778,6 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
18031778
},
18041779
registerFolder: (folderId, folderTitle, baseTag, group) => {
18051780
baseFolderRef.current = { id: folderId, title: folderTitle, baseTag, group }
1806-
// Reset scroll to top when entering a folder
18071781
if (scrollAreaRef.current) {
18081782
scrollAreaRef.current.scrollTop = 0
18091783
}
@@ -1812,7 +1786,6 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
18121786
[nestedPath]
18131787
)
18141788

1815-
// Reset nested path when popover closes
18161789
useEffect(() => {
18171790
if (!visible) {
18181791
setNestedPath([])

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ function ColorGrid({
3434
const gridRef = useRef<HTMLDivElement>(null)
3535
const buttonRefs = useRef<(HTMLButtonElement | null)[]>([])
3636

37-
// Focus the grid when entering the folder
3837
useEffect(() => {
3938
if (isInFolder && gridRef.current) {
40-
// Find the currently selected color or default to first
4139
const selectedIndex = WORKFLOW_COLORS.findIndex(
4240
({ color }) => color.toLowerCase() === hexInput.toLowerCase()
4341
)
4442
const initialIndex = selectedIndex >= 0 ? selectedIndex : 0
4543
setFocusedIndex(initialIndex)
46-
// Small delay to let the folder animation complete
4744
setTimeout(() => {
4845
buttonRefs.current[initialIndex]?.focus()
4946
}, 50)

0 commit comments

Comments
 (0)