Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
frontend
Commits
a53eae04
Unverified
Commit
a53eae04
authored
Mar 27, 2023
by
Igor Stuev
Committed by
GitHub
Mar 27, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #704 from blockscout/copy-tooltip-fix
copy to clipboard tooltip fix
parents
9dfd4a93
419edea8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
13 deletions
+8
-13
Deposits.tsx
ui/pages/Deposits.tsx
+3
-3
Withdrawals.tsx
ui/pages/Withdrawals.tsx
+1
-1
CopyToClipboard.tsx
ui/shared/CopyToClipboard.tsx
+4
-9
No files found.
ui/pages/Deposits.tsx
View file @
a53eae04
...
@@ -35,8 +35,8 @@ const Deposits = () => {
...
@@ -35,8 +35,8 @@ const Deposits = () => {
<
Skeleton
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
320px
'
}
}
w=
{
{
base
:
'
100%
'
,
lg
:
'
320px
'
}
}
h=
"24px"
h=
"24px"
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
7
}
}
mb=
{
{
base
:
7
,
lg
:
isPaginationVisible
?
0
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
isPaginationVisible
?
0
:
7
}
}
mt=
{
{
base
:
1
,
lg
:
isPaginationVisible
?
0
:
7
}
}
/>
/>
);
);
}
}
...
@@ -46,7 +46,7 @@ const Deposits = () => {
...
@@ -46,7 +46,7 @@ const Deposits = () => {
}
}
return
(
return
(
<
Text
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
6
}
}
lineHeight=
"32px"
>
<
Text
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
6
}
}
lineHeight=
{
{
base
:
'
24px
'
,
lg
:
'
32px
'
}
}
>
A total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
deposits found
A total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
deposits found
</
Text
>
</
Text
>
);
);
...
...
ui/pages/Withdrawals.tsx
View file @
a53eae04
...
@@ -46,7 +46,7 @@ const Withdrawals = () => {
...
@@ -46,7 +46,7 @@ const Withdrawals = () => {
}
}
return
(
return
(
<
Text
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
6
}
}
lineHeight=
"32px"
>
<
Text
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
6
}
}
lineHeight=
{
{
base
:
'
24px
'
,
lg
:
'
32px
'
}
}
>
A total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
withdrawals found
A total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
withdrawals found
</
Text
>
</
Text
>
);
);
...
...
ui/shared/CopyToClipboard.tsx
View file @
a53eae04
...
@@ -4,10 +4,10 @@ import React, { useEffect, useState } from 'react';
...
@@ -4,10 +4,10 @@ import React, { useEffect, useState } from 'react';
import
CopyIcon
from
'
icons/copy.svg
'
;
import
CopyIcon
from
'
icons/copy.svg
'
;
const
CopyToClipboard
=
({
text
,
className
}:
{
text
:
string
;
className
?:
string
})
=>
{
const
CopyToClipboard
=
({
text
,
className
}:
{
text
:
string
;
className
?:
string
})
=>
{
const
{
hasCopied
,
onCopy
}
=
useClipboard
(
text
,
3
000
);
const
{
hasCopied
,
onCopy
}
=
useClipboard
(
text
,
1
000
);
const
[
copied
,
setCopied
]
=
useState
(
false
);
const
[
copied
,
setCopied
]
=
useState
(
false
);
// have to implement controlled tooltip because of the issue - https://github.com/chakra-ui/chakra-ui/issues/7107
// have to implement controlled tooltip because of the issue - https://github.com/chakra-ui/chakra-ui/issues/7107
const
{
isOpen
,
onOpen
,
on
Toggle
,
on
Close
}
=
useDisclosure
();
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
hasCopied
)
{
if
(
hasCopied
)
{
...
@@ -17,13 +17,8 @@ const CopyToClipboard = ({ text, className }: {text: string; className?: string}
...
@@ -17,13 +17,8 @@ const CopyToClipboard = ({ text, className }: {text: string; className?: string}
}
}
},
[
hasCopied
]);
},
[
hasCopied
]);
const
handleClick
=
React
.
useCallback
(()
=>
{
onToggle
();
onCopy
();
},
[
onCopy
,
onToggle
]);
return
(
return
(
<
Tooltip
label=
{
copied
?
'
Copied
'
:
'
Copy to clipboard
'
}
isOpen=
{
isOpen
}
>
<
Tooltip
label=
{
copied
?
'
Copied
'
:
'
Copy to clipboard
'
}
isOpen=
{
isOpen
||
copied
}
>
<
IconButton
<
IconButton
aria
-
label=
"copy"
aria
-
label=
"copy"
icon=
{
<
CopyIcon
/>
}
icon=
{
<
CopyIcon
/>
}
...
@@ -32,7 +27,7 @@ const CopyToClipboard = ({ text, className }: {text: string; className?: string}
...
@@ -32,7 +27,7 @@ const CopyToClipboard = ({ text, className }: {text: string; className?: string}
variant=
"simple"
variant=
"simple"
display=
"inline-block"
display=
"inline-block"
flexShrink=
{
0
}
flexShrink=
{
0
}
onClick=
{
handleClick
}
onClick=
{
onCopy
}
className=
{
className
}
className=
{
className
}
onMouseEnter=
{
onOpen
}
onMouseEnter=
{
onOpen
}
onMouseLeave=
{
onClose
}
onMouseLeave=
{
onClose
}
...
...
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