mirror of
https://github.com/langgenius/dify.git
synced 2026-08-28 18:56:29 +08:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { cn } from '@langgenius/dify-ui/cn'
|
|
import { RiCheckLine } from '@remixicon/react'
|
|
import * as React from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
type MemberItemProps = {
|
|
leftIcon: React.ReactNode
|
|
name: string
|
|
email: string
|
|
isSelected: boolean
|
|
isMe?: boolean
|
|
onClick?: () => void
|
|
i18nNamespace?: 'datasetSettings'
|
|
}
|
|
|
|
const MemberItem = ({
|
|
leftIcon,
|
|
name,
|
|
email,
|
|
isSelected,
|
|
isMe = false,
|
|
onClick,
|
|
i18nNamespace = 'datasetSettings',
|
|
}: MemberItemProps) => {
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<div
|
|
className="flex cursor-pointer items-center gap-2 rounded-lg py-1 pr-[10px] pl-2 hover:bg-state-base-hover"
|
|
onClick={onClick}
|
|
>
|
|
{leftIcon}
|
|
<div className="grow">
|
|
<div className="truncate system-sm-medium text-text-secondary">
|
|
{name}
|
|
{isMe && (
|
|
<span className="system-xs-regular text-text-tertiary">
|
|
{t(($) => $['form.me'], { ns: i18nNamespace })}
|
|
</span>
|
|
)}
|
|
</div>
|
|
<div className="truncate system-xs-regular text-text-tertiary">{email}</div>
|
|
</div>
|
|
{isSelected && (
|
|
<RiCheckLine className={cn('size-4 shrink-0 text-text-accent', isMe && 'opacity-30')} />
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default React.memo(MemberItem)
|