Skip to content

Commit cc35541

Browse files
committed
lint
1 parent fe7484b commit cc35541

File tree

2 files changed

+81
-77
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input
    • components/emcn/components/combobox

2 files changed

+81
-77
lines changed

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

Lines changed: 71 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import { cn } from '@/lib/core/utils/cn'
2020
import {
2121
getIssueBadgeLabel,
2222
getIssueBadgeVariant,
23+
isToolUnavailable,
2324
getMcpServerIssue as validateMcpServer,
2425
getMcpToolIssue as validateMcpTool,
25-
isToolUnavailable,
2626
} from '@/lib/mcp/tool-validation'
2727
import type { McpToolSchema } from '@/lib/mcp/types'
2828
import { getProviderIdFromServiceId, type OAuthProvider, type OAuthService } from '@/lib/oauth'
@@ -525,7 +525,9 @@ export const ToolInput = memo(function ToolInput({
525525
)
526526
const hasRefreshedRef = useRef(false)
527527

528-
const hasMcpTools = selectedTools.some((tool) => tool.type === 'mcp' || tool.type === 'mcp-server')
528+
const hasMcpTools = selectedTools.some(
529+
(tool) => tool.type === 'mcp' || tool.type === 'mcp-server'
530+
)
529531

530532
useEffect(() => {
531533
if (isPreview) return
@@ -733,15 +735,12 @@ export const ToolInput = memo(function ToolInput({
733735
/**
734736
* Resets the MCP server drilldown when the combobox closes.
735737
*/
736-
const handleComboboxOpenChange = useCallback(
737-
(isOpen: boolean) => {
738-
setOpen(isOpen)
739-
if (!isOpen) {
740-
setMcpServerDrilldown(null)
741-
}
742-
},
743-
[]
744-
)
738+
const handleComboboxOpenChange = useCallback((isOpen: boolean) => {
739+
setOpen(isOpen)
740+
if (!isOpen) {
741+
setMcpServerDrilldown(null)
742+
}
743+
}, [])
745744

746745
const handleSelectTool = useCallback(
747746
(toolBlock: (typeof toolBlocks)[0]) => {
@@ -1272,20 +1271,15 @@ export const ToolInput = memo(function ToolInput({
12721271
if (tools && tools.length > 0) {
12731272
const server = mcpServers.find((s) => s.id === mcpServerDrilldown)
12741273
const serverName = tools[0]?.serverName || server?.name || 'Unknown Server'
1275-
const serverAlreadySelected = isMcpServerAlreadySelected(
1276-
selectedTools,
1277-
mcpServerDrilldown
1278-
)
1274+
const serverAlreadySelected = isMcpServerAlreadySelected(selectedTools, mcpServerDrilldown)
12791275
const toolCount = tools.length
12801276
const serverToolItems: ComboboxOption[] = []
12811277

12821278
// Back navigation
12831279
serverToolItems.push({
12841280
label: 'Back',
12851281
value: `mcp-server-back`,
1286-
iconElement: (
1287-
<ArrowLeft className='h-[14px] w-[14px] text-[var(--text-tertiary)]' />
1288-
),
1282+
iconElement: <ArrowLeft className='h-[14px] w-[14px] text-[var(--text-tertiary)]' />,
12891283
onSelect: () => {
12901284
setMcpServerDrilldown(null)
12911285
},
@@ -1300,8 +1294,7 @@ export const ToolInput = memo(function ToolInput({
13001294
onSelect: () => {
13011295
if (serverAlreadySelected) return
13021296
const filteredTools = selectedTools.filter(
1303-
(tool) =>
1304-
!(tool.type === 'mcp' && tool.params?.serverId === mcpServerDrilldown)
1297+
(tool) => !(tool.type === 'mcp' && tool.params?.serverId === mcpServerDrilldown)
13051298
)
13061299
const newTool: StoredTool = {
13071300
type: 'mcp-server',
@@ -1438,9 +1431,7 @@ export const ToolInput = memo(function ToolInput({
14381431
label: `${serverName} (${toolCount} tools)`,
14391432
value: `mcp-server-folder-${serverId}`,
14401433
iconElement: createToolIcon('#6366F1', ServerIcon),
1441-
suffixElement: (
1442-
<ChevronRight className='h-[12px] w-[12px] text-[var(--text-tertiary)]' />
1443-
),
1434+
suffixElement: <ChevronRight className='h-[12px] w-[12px] text-[var(--text-tertiary)]' />,
14441435
onSelect: () => {
14451436
setMcpServerDrilldown(serverId)
14461437
},
@@ -1785,61 +1776,65 @@ export const ToolInput = memo(function ToolInput({
17851776
)}
17861777
</div>
17871778
<div className='flex flex-shrink-0 items-center gap-[8px]'>
1788-
{supportsToolControl && !((isMcpTool || isMcpServer) && isMcpToolUnavailable(tool)) && (
1789-
<Popover
1790-
open={usageControlPopoverIndex === toolIndex}
1791-
onOpenChange={(open) => setUsageControlPopoverIndex(open ? toolIndex : null)}
1792-
>
1793-
<PopoverTrigger asChild>
1794-
<button
1795-
className='flex items-center justify-center font-medium text-[12px] text-[var(--text-tertiary)] transition-colors hover:text-[var(--text-primary)]'
1796-
onClick={(e: React.MouseEvent) => e.stopPropagation()}
1797-
aria-label='Tool usage control'
1798-
>
1799-
{tool.usageControl === 'auto' && 'Auto'}
1800-
{tool.usageControl === 'force' && 'Force'}
1801-
{tool.usageControl === 'none' && 'None'}
1802-
{!tool.usageControl && 'Auto'}
1803-
</button>
1804-
</PopoverTrigger>
1805-
<PopoverContent
1806-
side='bottom'
1807-
align='end'
1808-
sideOffset={8}
1809-
onClick={(e: React.MouseEvent) => e.stopPropagation()}
1810-
className='gap-[2px]'
1811-
border
1779+
{supportsToolControl &&
1780+
!((isMcpTool || isMcpServer) && isMcpToolUnavailable(tool)) && (
1781+
<Popover
1782+
open={usageControlPopoverIndex === toolIndex}
1783+
onOpenChange={(open) =>
1784+
setUsageControlPopoverIndex(open ? toolIndex : null)
1785+
}
18121786
>
1813-
<PopoverItem
1814-
active={(tool.usageControl || 'auto') === 'auto'}
1815-
onClick={() => {
1816-
handleUsageControlChange(toolIndex, 'auto')
1817-
setUsageControlPopoverIndex(null)
1818-
}}
1819-
>
1820-
Auto <span className='text-[var(--text-tertiary)]'>(model decides)</span>
1821-
</PopoverItem>
1822-
<PopoverItem
1823-
active={tool.usageControl === 'force'}
1824-
onClick={() => {
1825-
handleUsageControlChange(toolIndex, 'force')
1826-
setUsageControlPopoverIndex(null)
1827-
}}
1828-
>
1829-
Force <span className='text-[var(--text-tertiary)]'>(always use)</span>
1830-
</PopoverItem>
1831-
<PopoverItem
1832-
active={tool.usageControl === 'none'}
1833-
onClick={() => {
1834-
handleUsageControlChange(toolIndex, 'none')
1835-
setUsageControlPopoverIndex(null)
1836-
}}
1787+
<PopoverTrigger asChild>
1788+
<button
1789+
className='flex items-center justify-center font-medium text-[12px] text-[var(--text-tertiary)] transition-colors hover:text-[var(--text-primary)]'
1790+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
1791+
aria-label='Tool usage control'
1792+
>
1793+
{tool.usageControl === 'auto' && 'Auto'}
1794+
{tool.usageControl === 'force' && 'Force'}
1795+
{tool.usageControl === 'none' && 'None'}
1796+
{!tool.usageControl && 'Auto'}
1797+
</button>
1798+
</PopoverTrigger>
1799+
<PopoverContent
1800+
side='bottom'
1801+
align='end'
1802+
sideOffset={8}
1803+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
1804+
className='gap-[2px]'
1805+
border
18371806
>
1838-
None
1839-
</PopoverItem>
1840-
</PopoverContent>
1841-
</Popover>
1842-
)}
1807+
<PopoverItem
1808+
active={(tool.usageControl || 'auto') === 'auto'}
1809+
onClick={() => {
1810+
handleUsageControlChange(toolIndex, 'auto')
1811+
setUsageControlPopoverIndex(null)
1812+
}}
1813+
>
1814+
Auto{' '}
1815+
<span className='text-[var(--text-tertiary)]'>(model decides)</span>
1816+
</PopoverItem>
1817+
<PopoverItem
1818+
active={tool.usageControl === 'force'}
1819+
onClick={() => {
1820+
handleUsageControlChange(toolIndex, 'force')
1821+
setUsageControlPopoverIndex(null)
1822+
}}
1823+
>
1824+
Force <span className='text-[var(--text-tertiary)]'>(always use)</span>
1825+
</PopoverItem>
1826+
<PopoverItem
1827+
active={tool.usageControl === 'none'}
1828+
onClick={() => {
1829+
handleUsageControlChange(toolIndex, 'none')
1830+
setUsageControlPopoverIndex(null)
1831+
}}
1832+
>
1833+
None
1834+
</PopoverItem>
1835+
</PopoverContent>
1836+
</Popover>
1837+
)}
18431838
<button
18441839
onClick={(e) => {
18451840
e.stopPropagation()

apps/sim/components/emcn/components/combobox/combobox.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,16 @@ const Combobox = memo(
409409
}
410410
}
411411
},
412-
[disabled, open, highlightedIndex, filteredOptions, handleSelect, editable, inputRef, onArrowLeft]
412+
[
413+
disabled,
414+
open,
415+
highlightedIndex,
416+
filteredOptions,
417+
handleSelect,
418+
editable,
419+
inputRef,
420+
onArrowLeft,
421+
]
413422
)
414423

415424
/**

0 commit comments

Comments
 (0)