Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/workflow-renderer/src/lib/overflow-span.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { FloatingTooltip, isTextClipped, useFloatingTooltip } from '@sim/emcn'

interface OverflowSpanProps {
value: string
className: string
}

/**
* Truncated span that reveals its full value in a floating tooltip when — and
* only when — the text is actually clipped. Never use a native `title`
* attribute here: on the canvas it pops the browser's raw, unstyled tooltip
* with the full untruncated value (including raw code/JSON) over the graph.
*/
export function OverflowSpan({ value, className }: OverflowSpanProps) {
const { state, handlers } = useFloatingTooltip(isTextClipped)

return (
<>
<span className={className} {...handlers}>
{value}
</span>
<FloatingTooltip label={value} state={state} />
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cn } from '@sim/emcn'
import { OverflowSpan } from '../lib/overflow-span'

/**
* Props for the pure subblock summary row. The container resolves the value —
Expand All @@ -22,22 +23,18 @@ export interface SubBlockRowViewProps {
export function SubBlockRowView({ title, displayValue, isMonospace }: SubBlockRowViewProps) {
return (
<div className='flex items-center gap-2'>
<span
<OverflowSpan
value={title}
className='min-w-0 truncate text-[var(--text-tertiary)] text-sm capitalize'
title={title}
>
{title}
</span>
/>
{displayValue !== undefined && (
<span
<OverflowSpan
value={displayValue}
className={cn(
'flex-1 truncate text-right text-[var(--text-primary)] text-sm',
isMonospace && 'font-mono'
)}
title={displayValue}
>
{displayValue}
</span>
/>
)}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ComponentType, ReactNode, Ref } from 'react'
import { Badge, cn, handleKeyboardActivation, Tooltip } from '@sim/emcn'
import { Handle, Position } from 'reactflow'
import { HANDLE_POSITIONS } from '../dimensions'
import { OverflowSpan } from '../lib/overflow-span'
import { tileIconColorClass } from '../lib/tile-icon-color'
import type { BlockRunStatus } from '../types'
import { SubBlockRowView } from './sub-block-row-view'
Expand Down Expand Up @@ -212,15 +213,13 @@ export function WorkflowBlockView({
)}
/>
</div>
<span
<OverflowSpan
value={name}
className={cn(
'truncate font-medium text-md',
!isEnabled && runPathStatus !== 'success' && 'text-[var(--text-muted)]'
)}
title={name}
>
{name}
</span>
/>
</div>
<div className='relative z-10 flex flex-shrink-0 items-center gap-1'>
{isWorkflowSelector &&
Expand Down
Loading