mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
use one getUserColor func
This commit is contained in:
@ -4,15 +4,7 @@ import { useCollaboration } from '../collaboration/hooks/use-collaboration'
|
||||
import { useStore } from '../store'
|
||||
import cn from '@/utils/classnames'
|
||||
import { ChevronDown } from '@/app/components/base/icons/src/vender/solid/arrows'
|
||||
|
||||
const getUserColor = (id: string) => {
|
||||
const colors = ['#3B82F6', '#EF4444', '#10B981', '#F59E0B', '#8B5CF6', '#EC4899', '#06B6D4', '#84CC16']
|
||||
const hash = id.split('').reduce((a, b) => {
|
||||
a = ((a << 5) - a) + b.charCodeAt(0)
|
||||
return a & a
|
||||
}, 0)
|
||||
return colors[Math.abs(hash) % colors.length]
|
||||
}
|
||||
import { getUserColor } from '../collaboration/utils/user-color'
|
||||
|
||||
const OnlineUsers = () => {
|
||||
const appId = useStore(s => s.appId)
|
||||
|
||||
Reference in New Issue
Block a user