Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
84804a63
Commit
84804a63
authored
Jul 13, 2023
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: copy to clipboard
parent
e80ee32f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
invitation-link.tsx
...nt-setting/members-page/invited-modal/invitation-link.tsx
+11
-10
No files found.
web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx
View file @
84804a63
'use client'
'use client'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
React
,
{
use
Callback
,
use
Effect
,
useState
}
from
'react'
import
copy
from
'copy-to-clipboard'
//
import copy from 'copy-to-clipboard'
import
{
t
}
from
'i18next'
import
{
t
}
from
'i18next'
import
s
from
'./index.module.css'
import
s
from
'./index.module.css'
import
Tooltip
from
'@/app/components/base/tooltip'
import
Tooltip
from
'@/app/components/base/tooltip'
import
useCopyToClipboard
from
'@/hooks/use-copy-to-clipboard'
type
IInvitationLinkProps
=
{
type
IInvitationLinkProps
=
{
value
?:
string
value
?:
string
...
@@ -13,6 +14,12 @@ const InvitationLink = ({
...
@@ -13,6 +14,12 @@ const InvitationLink = ({
value
=
''
,
value
=
''
,
}:
IInvitationLinkProps
)
=>
{
}:
IInvitationLinkProps
)
=>
{
const
[
isCopied
,
setIsCopied
]
=
useState
(
false
)
const
[
isCopied
,
setIsCopied
]
=
useState
(
false
)
const
[
_
,
copy
]
=
useCopyToClipboard
()
const
copyHandle
=
useCallback
(()
=>
{
copy
(
value
)
setIsCopied
(
true
)
},
[
value
,
copy
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isCopied
)
{
if
(
isCopied
)
{
...
@@ -35,10 +42,7 @@ const InvitationLink = ({
...
@@ -35,10 +42,7 @@ const InvitationLink = ({
content=
{
isCopied
?
`${t('appApi.copied')}`
:
`${t('appApi.copy')}`
}
content=
{
isCopied
?
`${t('appApi.copied')}`
:
`${t('appApi.copy')}`
}
className=
'z-10'
className=
'z-10'
>
>
<
div
className=
'absolute top-0 left-0 w-full pl-2 pr-2 truncate cursor-pointer r-0'
onClick=
{
()
=>
{
<
div
className=
'absolute top-0 left-0 w-full pl-2 pr-2 truncate cursor-pointer r-0'
onClick=
{
copyHandle
}
>
{
value
}
</
div
>
copy
(
value
)
setIsCopied
(
true
)
}
}
>
{
value
}
</
div
>
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
<
div
className=
"flex-shrink-0 h-4 bg-gray-200 border"
/>
<
div
className=
"flex-shrink-0 h-4 bg-gray-200 border"
/>
...
@@ -48,10 +52,7 @@ const InvitationLink = ({
...
@@ -48,10 +52,7 @@ const InvitationLink = ({
className=
'z-10'
className=
'z-10'
>
>
<
div
className=
"px-0.5 flex-shrink-0"
>
<
div
className=
"px-0.5 flex-shrink-0"
>
<
div
className=
{
`box-border w-[30px] h-[30px] flex items-center justify-center rounded-lg hover:bg-gray-100 cursor-pointer ${s.copyIcon} ${isCopied ? s.copied : ''}`
}
onClick=
{
()
=>
{
<
div
className=
{
`box-border w-[30px] h-[30px] flex items-center justify-center rounded-lg hover:bg-gray-100 cursor-pointer ${s.copyIcon} ${isCopied ? s.copied : ''}`
}
onClick=
{
copyHandle
}
>
copy
(
value
)
setIsCopied
(
true
)
}
}
>
</
div
>
</
div
>
</
div
>
</
div
>
</
Tooltip
>
</
Tooltip
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment