'use client'
import { useRef, useState, useCallback } from 'react'
import { cn } from '../../../utils/cn'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '../tooltip'
import type { QueryReportTableRowProps } from './types'
export function QueryReportTableRow({
row,
columns,
columnWidth,
variant = 'default',
className
}: QueryReportTableRowProps) {
const isCompact = variant === 'compact'
return (
{columns.map((column) => {
const value = row[column]
const displayValue = value === null || value === undefined ? '-' : String(value)
return (
)
})}
)
}
function TruncatedCell({ value, className }: { value: string; className?: string }) {
const textRef = useRef(null)
const [isTruncated, setIsTruncated] = useState(false)
const checkTruncation = useCallback(() => {
const el = textRef.current
if (el) {
setIsTruncated(el.scrollWidth > el.clientWidth)
}
}, [])
return (
{value}
{value}
)
}