|
|
|
|
@ -3,12 +3,12 @@ import { useTranslation } from 'react-i18next'
|
|
|
|
|
import { Fragment } from 'react'
|
|
|
|
|
import { useContext } from 'use-context-selector'
|
|
|
|
|
import { Menu, Transition } from '@headlessui/react'
|
|
|
|
|
import cn from 'classnames'
|
|
|
|
|
import { CheckIcon, ChevronDownIcon } from '@heroicons/react/24/outline'
|
|
|
|
|
import s from './index.module.css'
|
|
|
|
|
import type { Member } from '@/models/common'
|
|
|
|
|
import { deleteMemberOrCancelInvitation, updateMemberRole } from '@/service/common'
|
|
|
|
|
import { ToastContext } from '@/app/components/base/toast'
|
|
|
|
|
import s from './index.module.css'
|
|
|
|
|
import cn from 'classnames'
|
|
|
|
|
import { ChevronDownIcon, CheckIcon } from '@heroicons/react/24/outline'
|
|
|
|
|
|
|
|
|
|
const itemClassName = `
|
|
|
|
|
flex px-3 py-2 cursor-pointer hover:bg-gray-50 rounded-lg
|
|
|
|
|
@ -23,14 +23,14 @@ const itemDescClassName = `
|
|
|
|
|
leading-[18px] text-xs text-gray-500 whitespace-nowrap
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
interface IOperationProps {
|
|
|
|
|
type IOperationProps = {
|
|
|
|
|
member: Member
|
|
|
|
|
onOperate: () => void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Operation = ({
|
|
|
|
|
member,
|
|
|
|
|
onOperate
|
|
|
|
|
onOperate,
|
|
|
|
|
}: IOperationProps) => {
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
const RoleMap = {
|
|
|
|
|
@ -44,7 +44,8 @@ const Operation = ({
|
|
|
|
|
await deleteMemberOrCancelInvitation({ url: `/workspaces/current/members/${member.id}` })
|
|
|
|
|
onOperate()
|
|
|
|
|
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
|
|
|
|
} catch (e) {
|
|
|
|
|
}
|
|
|
|
|
catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -52,11 +53,12 @@ const Operation = ({
|
|
|
|
|
try {
|
|
|
|
|
await updateMemberRole({
|
|
|
|
|
url: `/workspaces/current/members/${member.id}/update-role`,
|
|
|
|
|
body: { role }
|
|
|
|
|
body: { role },
|
|
|
|
|
})
|
|
|
|
|
onOperate()
|
|
|
|
|
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
|
|
|
|
} catch (e) {
|
|
|
|
|
}
|
|
|
|
|
catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -68,10 +70,10 @@ const Operation = ({
|
|
|
|
|
<>
|
|
|
|
|
<Menu.Button className={cn(
|
|
|
|
|
`
|
|
|
|
|
group flex items-center justify-between w-full h-full justify-center
|
|
|
|
|
group flex items-center justify-between w-full h-full
|
|
|
|
|
hover:bg-gray-100 cursor-pointer ${open && 'bg-gray-100'}
|
|
|
|
|
text-[13px] text-gray-700 px-3
|
|
|
|
|
`
|
|
|
|
|
`,
|
|
|
|
|
)}>
|
|
|
|
|
{RoleMap[member.role] || RoleMap.normal}
|
|
|
|
|
<ChevronDownIcon className={`w-4 h-4 group-hover:block ${open ? 'block' : 'hidden'}`} />
|
|
|
|
|
@ -91,7 +93,7 @@ const Operation = ({
|
|
|
|
|
absolute right-0 top-[52px] z-10 bg-white border-[0.5px] border-gray-200
|
|
|
|
|
divide-y divide-gray-100 origin-top-right rounded-lg
|
|
|
|
|
`,
|
|
|
|
|
s.popup
|
|
|
|
|
s.popup,
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div className="px-1 py-1">
|
|
|
|
|
|