Skip to content

Commit cae89da

Browse files
committed
fix(blocks): drop the dead copies of a block's colour
Sweeping the surfaces above turned up colour data nothing reads and colour data two surfaces disagreed on. Dead: `BLOCK_COLORS.DEFAULT/LOOP/PARALLEL` in the tag dropdown (only `VARIABLE` was ever referenced), `BlockIconInfo.color` on table columns — whose consumer documents that it deliberately ignores the colour, so the `#2F55FF` behind it could never render — and the `bgColor` threaded into the add-resource dropdown, whose row renders a bare tinted icon. Disagreeing: the Variables tile is `#2F8BFF` in the tag dropdown and `#8B5CF6` in the preview panel, for the same "V" on the same concept. Both now read `VARIABLE_TILE_COLOR`, and the preview panel's two hand-rolled squares become `BlockTile` like every other tile. Four spellings of the neutral fallback (`#6B7280`, `#6b7280`, `#666666`, and a `cancelled` status that happened to equal it) now point at `DEFAULT_BLOCK_TILE_COLOR`. The terminal and logs resolvers stay. They look like duplicates of `accent.ts` but carry behaviour it does not have — status fills for synthesized error/validation/cancelled rows, near-black contrast correction, MCP tool-id parsing, and a model-provider branch — so folding them in is a behavioural change, not a deletion.
1 parent a63b6cb commit cae89da

9 files changed

Lines changed: 29 additions & 28 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown/add-resource-dropdown.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ export function useAvailableResources(
258258
id: integration.blockType,
259259
name: integration.name,
260260
iconComponent: integration.icon,
261-
bgColor: integration.bgColor,
262261
})),
263262
},
264263
{

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/utils.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { TraceSpan } from '@/lib/logs/types'
77
import { LoopTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/loop/loop-config'
88
import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/parallel/parallel-config'
99
import { getBlock, getBlockByToolName } from '@/blocks'
10+
import { DEFAULT_BLOCK_TILE_COLOR } from '@/blocks/accent'
1011
import { PROVIDER_DEFINITIONS } from '@/providers/models'
1112
import { normalizeToolId } from '@/tools/normalize'
1213

@@ -24,8 +25,6 @@ function tryParseMcpToolName(toolId: string): string | null {
2425
return toolName.length > 0 ? toolName : null
2526
}
2627

27-
export const DEFAULT_BLOCK_COLOR = '#6b7280'
28-
2928
export interface BlockIconAndColor {
3029
icon: React.ComponentType<{ className?: string }> | null
3130
bgColor: string
@@ -71,12 +70,12 @@ export function getBlockIconAndColor(
7170
if (lowerType === 'model' && provider) {
7271
const providerDef = PROVIDER_DEFINITIONS[provider]
7372
if (providerDef?.icon)
74-
return { icon: providerDef.icon, bgColor: providerDef.color ?? DEFAULT_BLOCK_COLOR }
73+
return { icon: providerDef.icon, bgColor: providerDef.color ?? DEFAULT_BLOCK_TILE_COLOR }
7574
}
7675
const blockType = lowerType === 'model' ? 'agent' : lowerType
7776
const blockConfig = getBlock(blockType)
7877
if (blockConfig) return { icon: blockConfig.icon, bgColor: blockConfig.bgColor }
79-
return { icon: null, bgColor: DEFAULT_BLOCK_COLOR }
78+
return { icon: null, bgColor: DEFAULT_BLOCK_TILE_COLOR }
8079
}
8180

8281
/**
@@ -93,7 +92,9 @@ const MAX_YIQ_SUM = 255_000
9392
*/
9493
export function adjustBgForContrast(bgColor: string): string {
9594
const brightness = perceivedBrightness(bgColor)
96-
return brightness !== null && brightness < 30_000 / MAX_YIQ_SUM ? DEFAULT_BLOCK_COLOR : bgColor
95+
return brightness !== null && brightness < 30_000 / MAX_YIQ_SUM
96+
? DEFAULT_BLOCK_TILE_COLOR
97+
: bgColor
9798
}
9899

99100
export function parseTime(value?: string | number | null): number {

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import type React from 'react'
22
import type { ColumnDefinition } from '@/lib/table'
33

4+
/**
5+
* The producing block's mark for a workflow-output column. Icon only — these
6+
* render in the plain `--text-icon` tone like every other column-type icon, so
7+
* carrying a colour here only invited a second copy of the block's `bgColor`.
8+
*/
49
export interface BlockIconInfo {
510
icon: React.ComponentType<{ className?: string }>
6-
color: string
711
}
812

913
export interface ColumnSourceInfo {

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/hooks/use-table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export function useTable({ workspaceId, tableId, queryOptions }: UseTableParams)
244244
const block = blocks?.[out.blockId]
245245
const blockConfig = block?.type ? getBlock(block.type) : undefined
246246
const blockIconInfo: BlockIconInfo | undefined = blockConfig?.icon
247-
? { icon: blockConfig.icon, color: blockConfig.bgColor || '#2F55FF' }
247+
? { icon: blockConfig.icon }
248248
: undefined
249249
const blockName = block?.name?.trim() || undefined
250250
// Flag a missing source block only once the workflow state has loaded

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import type {
2929
} from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/types'
3030
import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes'
3131
import { getBlock } from '@/blocks'
32+
import { VARIABLE_TILE_COLOR } from '@/blocks/accent'
3233
import { BlockTile } from '@/blocks/block-tile'
3334
import type { BlockConfig } from '@/blocks/types'
3435
import { normalizeName } from '@/executor/constants'
@@ -154,16 +155,6 @@ export const getTagSearchTerm = (text: string, cursorPosition: number): string =
154155
return textBeforeCursor.slice(lastOpenBracket + 1).toLowerCase()
155156
}
156157

157-
/**
158-
* Color constants for block type icons in the tag dropdown.
159-
*/
160-
const BLOCK_COLORS = {
161-
VARIABLE: '#2F8BFF',
162-
DEFAULT: '#2F55FF',
163-
LOOP: '#2FB3FF',
164-
PARALLEL: '#FEE12B',
165-
} as const
166-
167158
/**
168159
* Prefix constants for special tag types.
169160
*/
@@ -1709,7 +1700,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
17091700
<>
17101701
<PopoverSection rootOnly>
17111702
<div className='flex items-center gap-1.5'>
1712-
<BlockTile bgColor={BLOCK_COLORS.VARIABLE} fallbackLabel='V' size='sm' />
1703+
<BlockTile bgColor={VARIABLE_TILE_COLOR} fallbackLabel='V' size='sm' />
17131704
Variables
17141705
</div>
17151706
</PopoverSection>

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/toolbar/toolbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
import { useToolbarItemInteractions } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/toolbar/hooks'
3434
import { LoopTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/loop/loop-config'
3535
import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/parallel/parallel-config'
36+
import { DEFAULT_BLOCK_TILE_COLOR } from '@/blocks/accent'
3637
import { BlockTile } from '@/blocks/block-tile'
3738
import {
3839
buildCustomBlockConfig,
@@ -89,7 +90,7 @@ const ToolbarItem = memo(function ToolbarItem({
8990
const iconContainer = e.currentTarget.querySelector<HTMLElement>('[data-toolbar-item-icon]')
9091
onDragStart(e, item.type, isTriggerCapable, {
9192
name: item.name,
92-
bgColor: item.bgColor ?? '#666666',
93+
bgColor: item.bgColor ?? DEFAULT_BLOCK_TILE_COLOR,
9394
iconContainer,
9495
})
9596
},

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type React from 'react'
22
import { Ban, CircleX, Repeat, Split, TriangleAlert, Workflow } from '@sim/emcn/icons'
33
import { getBlock } from '@/blocks'
4+
import { DEFAULT_BLOCK_TILE_COLOR } from '@/blocks/accent'
45
import { isWorkflowBlockType } from '@/executor/constants'
56
import { TERMINAL_BLOCK_COLUMN_WIDTH } from '@/stores/constants'
67
import type { ConsoleEntry } from '@/stores/terminal'
@@ -20,7 +21,7 @@ const SUBFLOW_COLORS = {
2021
const SPECIAL_BLOCK_COLORS = {
2122
error: '#ef4444',
2223
validation: '#f59e0b',
23-
cancelled: '#6b7280',
24+
cancelled: DEFAULT_BLOCK_TILE_COLOR,
2425
} as const
2526

2627
/**
@@ -90,7 +91,7 @@ export function getBlockColor(blockType: string): string {
9091
if (blockType === 'cancelled') {
9192
return SPECIAL_BLOCK_COLORS.cancelled
9293
}
93-
return '#6b7280'
94+
return DEFAULT_BLOCK_TILE_COLOR
9495
}
9596

9697
/**

apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { PreviewContextMenu } from '@/app/workspace/[workspaceId]/w/components/p
4343
import { PreviewWorkflow } from '@/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow'
4444
import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks'
4545
import { getBlock } from '@/blocks'
46+
import { DEFAULT_BLOCK_TILE_COLOR, VARIABLE_TILE_COLOR } from '@/blocks/accent'
4647
import { BlockTile } from '@/blocks/block-tile'
4748
import type { BlockConfig, SubBlockConfig, SubBlockType } from '@/blocks/types'
4849
import { normalizeName } from '@/executor/constants'
@@ -436,9 +437,7 @@ function ConnectionsSection({
436437
handleKeyboardActivation(event, () => setExpandedVariables(!expandedVariables))
437438
}
438439
>
439-
<div className='relative flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm bg-[#8B5CF6]'>
440-
<span className='text-[9px] text-white'>V</span>
441-
</div>
440+
<BlockTile bgColor={VARIABLE_TILE_COLOR} fallbackLabel='V' size='sm' />
442441
<span
443442
className={cn(
444443
'truncate',
@@ -488,9 +487,7 @@ function ConnectionsSection({
488487
handleKeyboardActivation(event, () => setExpandedEnvVars(!expandedEnvVars))
489488
}
490489
>
491-
<div className='relative flex size-[14px] flex-shrink-0 items-center justify-center overflow-hidden rounded-sm bg-[#6B7280]'>
492-
<span className='text-[9px] text-white'>E</span>
493-
</div>
490+
<BlockTile bgColor={DEFAULT_BLOCK_TILE_COLOR} fallbackLabel='E' size='sm' />
494491
<span
495492
className={cn(
496493
'truncate',

apps/sim/blocks/accent.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import { getBlock } from '@/blocks/registry'
66
/** Tile fill for a block that has no config of its own to colour it. */
77
export const DEFAULT_BLOCK_TILE_COLOR = '#6B7280'
88

9+
/**
10+
* Tile fill for a workflow variable. Not a block, but it is listed beside them
11+
* — in the tag dropdown and the preview panel's reference sections — and those
12+
* two had drifted to different colours for the same "V" tile.
13+
*/
14+
export const VARIABLE_TILE_COLOR = '#2F8BFF'
15+
916
/**
1017
* Subflow tiles. Loop and Parallel are canvas blocks with no registry config,
1118
* so every surface that lists them had to special-case the pair; they resolve

0 commit comments

Comments
 (0)