Skip to content

Commit e6a17b0

Browse files
improvement(tables): show a tooltip on truncated column headers (#6371)
* improvement(tables): show a tooltip on truncated column headers * chore(tables): use absolute import for HeaderLabel
1 parent 69e3e17 commit e6a17b0

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
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
44
import { cn } from '@sim/emcn'
55
import { ChevronDown } from '@sim/emcn/icons'
66
import type { WorkflowGroup } from '@/lib/table'
7+
import { HeaderLabel } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/header-label'
78
import type { WorkflowMetadata } from '@/stores/workflows/registry/types'
89
import { COL_WIDTH, SELECTION_TINT_BG } from '../constants'
910
import type { ColumnSourceInfo, DisplayColumn } from '../types'
@@ -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
@@ -27,6 +27,7 @@ import {
2727
} from '@sim/emcn/icons'
2828
import type { RunLimit, RunMode } from '@/lib/api/contracts/tables'
2929
import type { WorkflowGroupType } from '@/lib/table'
30+
import { HeaderLabel } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/header-label'
3031
import { getEnrichment } from '@/enrichments/registry'
3132
import type { WorkflowMetadata } from '@/stores/workflows/registry/types'
3233
import { SELECTION_TINT_BG } from '../constants'
@@ -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)