Feat/support to invite multiple users (#1011)
This commit is contained in:
parent
7df56ed617
commit
d3f8ea2df0
12 changed files with 222 additions and 70 deletions
|
|
@ -3,21 +3,22 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|||
import { t } from 'i18next'
|
||||
import copy from 'copy-to-clipboard'
|
||||
import s from './index.module.css'
|
||||
import type { SuccessInvationResult } from '.'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import { randomString } from '@/utils'
|
||||
|
||||
type IInvitationLinkProps = {
|
||||
value?: string
|
||||
value: SuccessInvationResult
|
||||
}
|
||||
|
||||
const InvitationLink = ({
|
||||
value = '',
|
||||
value,
|
||||
}: IInvitationLinkProps) => {
|
||||
const [isCopied, setIsCopied] = useState(false)
|
||||
const selector = useRef(`invite-link-${randomString(4)}`)
|
||||
|
||||
const copyHandle = useCallback(() => {
|
||||
copy(value)
|
||||
copy(value.url)
|
||||
setIsCopied(true)
|
||||
}, [value])
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ const InvitationLink = ({
|
|||
content={isCopied ? `${t('appApi.copied')}` : `${t('appApi.copy')}`}
|
||||
className='z-10'
|
||||
>
|
||||
<div className='absolute top-0 left-0 w-full pl-2 pr-2 truncate cursor-pointer r-0' onClick={copyHandle}>{value}</div>
|
||||
<div className='absolute top-0 left-0 w-full pl-2 pr-2 truncate cursor-pointer r-0' onClick={copyHandle}>{value.url}</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="flex-shrink-0 h-4 bg-gray-200 border" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue