Fix username line break in SharedBadge component (#13794)

## Summary
- Added Tailwind truncation classes (`inline-block max-w-[120px]
truncate align-middle`) to the username `<span>` in `SharedBadge` to
prevent long usernames from wrapping onto multiple lines
- Added `title` attribute to show the full username on hover when
truncated


![ragflow](https://github.com/user-attachments/assets/8b3d8c03-d605-4957-bcf0-8b4d81fc4e70)


## Test plan
- [x] Verify long usernames display truncated with ellipsis (`...`)
- [x] Verify hovering over a truncated username shows the full name as a
tooltip
- [x] Verify short usernames display normally without truncation

Closes #13748
This commit is contained in:
Renzo
2026-03-27 02:31:08 +01:00
committed by GitHub
parent 6e309f9d0a
commit f3aa3381a2

View File

@@ -8,5 +8,12 @@ export function SharedBadge({ children }: PropsWithChildren) {
return null;
}
return <span className="bg-bg-card rounded-sm px-1 text-xs inline-block max-w-[120px] truncate align-middle">{children}</span>;
return (
<span
title={typeof children === 'string' ? children : undefined}
className="inline-block max-w-[120px] truncate align-middle bg-bg-card rounded-sm px-1 text-xs"
>
{children}
</span>
);
}