From 0095fa048f9517228726779d71f9194dfd5289e1 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Fri, 10 Jul 2026 09:25:05 +0800 Subject: [PATCH] fix: Show full text on hover when text overflows the cards on the list page. (#16787) --- web/src/components/home-card.tsx | 65 +++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/web/src/components/home-card.tsx b/web/src/components/home-card.tsx index 12bb6427e1..fa72fb9342 100644 --- a/web/src/components/home-card.tsx +++ b/web/src/components/home-card.tsx @@ -1,7 +1,12 @@ import { RAGFlowAvatar } from '@/components/ragflow-avatar'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip'; import { formatDate } from '@/utils/date'; -import { ReactNode } from 'react'; +import { ElementType, ReactNode, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; interface IProps { @@ -24,6 +29,49 @@ interface IProps { function Time({ time }: { time: string | number | undefined }) { return
{formatDate(time)}
; } + +function TruncatedText({ + as: Tag = 'div', + className, + children, + tooltip, + testId, +}: { + as?: ElementType; + className?: string; + children?: ReactNode; + tooltip?: ReactNode; + testId?: string; +}) { + const ref = useRef