Skip to content

Commit 054a8e9

Browse files
improvement(tables): show a tooltip on truncated column headers
1 parent 1c0e82a commit 054a8e9

3 files changed

Lines changed: 38 additions & 7 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/column-header-menu.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { WorkflowMetadata } from '@/stores/workflows/registry/types'
88
import { COL_WIDTH, SELECTION_TINT_BG } from '../constants'
99
import type { ColumnSourceInfo, DisplayColumn } from '../types'
1010
import { ColumnTypeIcon } from './column-type-icon'
11+
import { HeaderLabel } from './header-label'
1112
import { ColumnOptionsMenu } from './workflow-group-meta-cell'
1213

1314
interface ColumnHeaderMenuProps {
@@ -296,9 +297,10 @@ export const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
296297
blockIconInfo={sourceInfo?.blockIconInfo}
297298
blockMissing={blockMissing}
298299
/>
299-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap text-[var(--text-primary)] text-small'>
300-
{column.workflowGroupId ? column.headerLabel : column.name}
301-
</span>
300+
<HeaderLabel
301+
label={column.workflowGroupId ? column.headerLabel : column.name}
302+
className='ml-1.5 text-[var(--text-primary)] text-small'
303+
/>
302304
</div>
303305
) : (
304306
<div className='flex h-full w-full min-w-0 items-center'>
@@ -314,9 +316,10 @@ export const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
314316
blockIconInfo={sourceInfo?.blockIconInfo}
315317
blockMissing={blockMissing}
316318
/>
317-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap text-[var(--text-primary)] text-small'>
318-
{column.workflowGroupId ? column.headerLabel : column.name}
319-
</span>
319+
<HeaderLabel
320+
label={column.workflowGroupId ? column.headerLabel : column.name}
321+
className='ml-1.5 text-[var(--text-primary)] text-small'
322+
/>
320323
</button>
321324
<button
322325
type='button'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use client'
2+
3+
import { memo } from 'react'
4+
import { cn, FloatingTooltip, isTextClipped, useFloatingTooltip } from '@sim/emcn'
5+
6+
interface HeaderLabelProps {
7+
label: string
8+
className?: string
9+
}
10+
11+
/**
12+
* Column header text that clips with an ellipsis and reveals its full value in
13+
* a floating tooltip — but only while actually clipped, since an untruncated
14+
* header already says everything the tooltip would.
15+
*/
16+
export const HeaderLabel = memo(function HeaderLabel({ label, className }: HeaderLabelProps) {
17+
const { state, handlers } = useFloatingTooltip(isTextClipped)
18+
19+
return (
20+
<>
21+
<span className={cn('min-w-0 truncate', className)} {...handlers}>
22+
{label}
23+
</span>
24+
<FloatingTooltip label={label} state={state} />
25+
</>
26+
)
27+
})

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/workflow-group-meta-cell.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { getEnrichment } from '@/enrichments/registry'
3131
import type { WorkflowMetadata } from '@/stores/workflows/registry/types'
3232
import { SELECTION_TINT_BG } from '../constants'
3333
import type { DisplayColumn } from '../types'
34+
import { HeaderLabel } from './header-label'
3435

3536
/** Fixed row-cap presets for the "Run N empty rows" shortcuts. Shared by the
3637
* group-header options menu and the inline quick-run dropdown so the two
@@ -439,7 +440,7 @@ export function WorkflowGroupMetaCell({
439440
) : (
440441
<Workflow className='size-[12px] shrink-0 text-[var(--text-icon)]' />
441442
)}
442-
<span className='min-w-0 truncate text-[var(--text-secondary)] text-xs'>{name}</span>
443+
<HeaderLabel label={name} className='text-[var(--text-secondary)] text-xs' />
443444
{onRunColumn && (
444445
<DropdownMenu open={runMenuOpen} onOpenChange={setRunMenuOpen}>
445446
<DropdownMenuTrigger asChild>

0 commit comments

Comments
 (0)