Skip to content

Commit 37b50cb

Browse files
committed
dedupe
1 parent 7ca628d commit 37b50cb

File tree

1 file changed

+5
-18
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block

1 file changed

+5
-18
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { cn } from '@/lib/core/utils/cn'
88
import { getBaseUrl } from '@/lib/core/utils/urls'
99
import { createMcpToolId } from '@/lib/mcp/utils'
1010
import { getProviderIdFromServiceId } from '@/lib/oauth'
11+
import type { FilterRule, SortRule } from '@/lib/table/types'
1112
import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
1213
import {
1314
ActionBar,
@@ -187,15 +188,7 @@ const isDocumentTagArray = (value: unknown): value is DocumentTagItem[] => {
187188
/**
188189
* Type guard for filter condition array (used in table block filter builder)
189190
*/
190-
interface FilterConditionItem {
191-
id: string
192-
logicalOperator: 'and' | 'or'
193-
column: string
194-
operator: string
195-
value: string
196-
}
197-
198-
const isFilterConditionArray = (value: unknown): value is FilterConditionItem[] => {
191+
const isFilterConditionArray = (value: unknown): value is FilterRule[] => {
199192
if (!Array.isArray(value) || value.length === 0) return false
200193
const firstItem = value[0]
201194
return (
@@ -211,13 +204,7 @@ const isFilterConditionArray = (value: unknown): value is FilterConditionItem[]
211204
/**
212205
* Type guard for sort condition array (used in table block sort builder)
213206
*/
214-
interface SortConditionItem {
215-
id: string
216-
column: string
217-
direction: 'asc' | 'desc'
218-
}
219-
220-
const isSortConditionArray = (value: unknown): value is SortConditionItem[] => {
207+
const isSortConditionArray = (value: unknown): value is SortRule[] => {
221208
if (!Array.isArray(value) || value.length === 0) return false
222209
const firstItem = value[0]
223210
return (
@@ -299,7 +286,7 @@ export const getDisplayValue = (value: unknown): string => {
299286
(c) => typeof c.column === 'string' && c.column.trim() !== ''
300287
)
301288
if (validConditions.length === 0) return '-'
302-
const formatCondition = (c: FilterConditionItem) => {
289+
const formatCondition = (c: FilterRule) => {
303290
const opLabels: Record<string, string> = {
304291
eq: '=',
305292
ne: '≠',
@@ -325,7 +312,7 @@ export const getDisplayValue = (value: unknown): string => {
325312
(c) => typeof c.column === 'string' && c.column.trim() !== ''
326313
)
327314
if (validConditions.length === 0) return '-'
328-
const formatSort = (c: SortConditionItem) => `${c.column} ${c.direction === 'desc' ? '↓' : '↑'}`
315+
const formatSort = (c: SortRule) => `${c.column} ${c.direction === 'desc' ? '↓' : '↑'}`
329316
if (validConditions.length === 1) return formatSort(validConditions[0])
330317
if (validConditions.length === 2) {
331318
return `${formatSort(validConditions[0])}, ${formatSort(validConditions[1])}`

0 commit comments

Comments
 (0)