mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 11:56:55 +08:00
add mouse over avatar display username
This commit is contained in:
parent
81638c248e
commit
6ec8bfdfee
@ -5,6 +5,7 @@ import { useStore } from '../store'
|
|||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import { ChevronDown } from '@/app/components/base/icons/src/vender/solid/arrows'
|
import { ChevronDown } from '@/app/components/base/icons/src/vender/solid/arrows'
|
||||||
import { getUserColor } from '../collaboration/utils/user-color'
|
import { getUserColor } from '../collaboration/utils/user-color'
|
||||||
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
|
|
||||||
const OnlineUsers = () => {
|
const OnlineUsers = () => {
|
||||||
const appId = useStore(s => s.appId)
|
const appId = useStore(s => s.appId)
|
||||||
@ -28,32 +29,56 @@ const OnlineUsers = () => {
|
|||||||
{visibleUsers.map((user, index) => {
|
{visibleUsers.map((user, index) => {
|
||||||
const userColor = getUserColor(user.user_id)
|
const userColor = getUserColor(user.user_id)
|
||||||
return (
|
return (
|
||||||
<div
|
<Tooltip
|
||||||
key={`${user.sid}-${index}`}
|
key={`${user.sid}-${index}`}
|
||||||
className="relative"
|
popupContent={user.username || 'User'}
|
||||||
style={{ zIndex: visibleUsers.length - index }}
|
position="bottom"
|
||||||
|
triggerMethod="hover"
|
||||||
|
needsDelay={false}
|
||||||
|
asChild
|
||||||
>
|
>
|
||||||
<Avatar
|
<div
|
||||||
name={user.username || 'User'}
|
className="relative cursor-pointer"
|
||||||
avatar={user.avatar}
|
style={{ zIndex: visibleUsers.length - index }}
|
||||||
size={28}
|
>
|
||||||
className="ring-2 ring-white"
|
<Avatar
|
||||||
backgroundColor={userColor}
|
name={user.username || 'User'}
|
||||||
/>
|
avatar={user.avatar}
|
||||||
</div>
|
size={28}
|
||||||
|
className="ring-2 ring-white"
|
||||||
|
backgroundColor={userColor}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{remainingCount > 0 && (
|
{remainingCount > 0 && (
|
||||||
<div
|
<Tooltip
|
||||||
className={cn(
|
popupContent={
|
||||||
'flex h-7 w-7 items-center justify-center',
|
<div className="flex flex-col gap-1">
|
||||||
'rounded-full bg-gray-300',
|
{onlineUsers.slice(maxVisible).map((user, index) => (
|
||||||
'text-xs font-medium text-gray-700',
|
<div key={`${user.sid}-tooltip-${index}`}>
|
||||||
'ring-2 ring-white',
|
{user.username || 'User'}
|
||||||
)}
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
position="bottom"
|
||||||
|
triggerMethod="hover"
|
||||||
|
needsDelay={false}
|
||||||
|
asChild
|
||||||
>
|
>
|
||||||
+{remainingCount}
|
<div
|
||||||
</div>
|
className={cn(
|
||||||
|
'flex h-7 w-7 items-center justify-center',
|
||||||
|
'cursor-pointer rounded-full bg-gray-300',
|
||||||
|
'text-xs font-medium text-gray-700',
|
||||||
|
'ring-2 ring-white',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
+{remainingCount}
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{remainingCount > 0 && (
|
{remainingCount > 0 && (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user