Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
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
LuckySwap
interface
Commits
21594343
Unverified
Commit
21594343
authored
Nov 28, 2022
by
Jordan Frankfurt
Committed by
GitHub
Nov 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(polling): correct gas price color (#5413)
* fix(polling): correct gas price color * pr feedback
parent
f29c9f84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
52 deletions
+67
-52
index.tsx
src/components/Polling/index.tsx
+67
-52
No files found.
src/components/Polling/index.tsx
View file @
21594343
...
@@ -9,29 +9,42 @@ import useMachineTimeMs from 'hooks/useMachineTime'
...
@@ -9,29 +9,42 @@ import useMachineTimeMs from 'hooks/useMachineTime'
import
JSBI
from
'
jsbi
'
import
JSBI
from
'
jsbi
'
import
useBlockNumber
from
'
lib/hooks/useBlockNumber
'
import
useBlockNumber
from
'
lib/hooks/useBlockNumber
'
import
ms
from
'
ms.macro
'
import
ms
from
'
ms.macro
'
import
{
useEffect
,
useState
}
from
'
react
'
import
{
useEffect
,
use
Memo
,
use
State
}
from
'
react
'
import
styled
,
{
keyframes
,
useTheme
}
from
'
styled-components/macro
'
import
styled
,
{
keyframes
}
from
'
styled-components/macro
'
import
{
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
ExplorerDataType
,
getExplorerLink
}
from
'
utils/getExplorerLink
'
import
{
ExplorerDataType
,
getExplorerLink
}
from
'
utils/getExplorerLink
'
import
{
MouseoverTooltip
}
from
'
../Tooltip
'
import
{
MouseoverTooltip
}
from
'
../Tooltip
'
import
{
ChainConnectivityWarning
}
from
'
./ChainConnectivityWarning
'
import
{
ChainConnectivityWarning
}
from
'
./ChainConnectivityWarning
'
const
StyledPolling
=
styled
.
div
<
{
warning
:
boolean
}
>
`
const
StyledPolling
=
styled
.
div
`
position: fixed;
display: flex;
align-items: center;
align-items: center;
right: 0;
bottom: 0;
bottom: 0;
color:
${({
theme
})
=>
theme
.
textTertiary
}
;
display: none;
padding: 1rem;
padding: 1rem;
color:
${({
theme
,
warning
})
=>
(
warning
?
theme
.
deprecated_yellow3
:
theme
.
deprecated_green1
)}
;
position: fixed;
right: 0;
transition: 250ms ease color;
transition: 250ms ease color;
${({
theme
})
=>
theme
.
deprecated_mediaWidth
.
deprecated_upToMedium
`
a {
display: none;
color: unset;
`
}
}
a:hover {
color: unset;
text-decoration: none;
}
@media screen and (min-width:
${({
theme
})
=>
theme
.
breakpoint
.
md
}
px) {
display: flex;
}
`
`
const
StyledPollingNumber
=
styled
(
ThemedText
.
DeprecatedSmall
)
<
{
breathe
:
boolean
;
hovering
:
boolean
}
>
`
const
StyledPollingBlockNumber
=
styled
(
ThemedText
.
DeprecatedSmall
)
<
{
breathe
:
boolean
hovering
:
boolean
warning
:
boolean
}
>
`
color:
${({
theme
,
warning
})
=>
(
warning
?
theme
.
deprecated_yellow3
:
theme
.
deprecated_green1
)}
;
transition: opacity 0.25s ease;
transition: opacity 0.25s ease;
opacity:
${({
breathe
,
hovering
})
=>
(
hovering
?
0.7
:
breathe
?
1
:
0.5
)}
;
opacity:
${({
breathe
,
hovering
})
=>
(
hovering
?
0.7
:
breathe
?
1
:
0.5
)}
;
:hover {
:hover {
...
@@ -106,7 +119,6 @@ export default function Polling() {
...
@@ -106,7 +119,6 @@ export default function Polling() {
const
[
isHover
,
setIsHover
]
=
useState
(
false
)
const
[
isHover
,
setIsHover
]
=
useState
(
false
)
const
machineTime
=
useMachineTimeMs
(
NETWORK_HEALTH_CHECK_MS
)
const
machineTime
=
useMachineTimeMs
(
NETWORK_HEALTH_CHECK_MS
)
const
blockTime
=
useCurrentBlockTimestamp
()
const
blockTime
=
useCurrentBlockTimestamp
()
const
theme
=
useTheme
()
const
isNftPage
=
useIsNftPage
()
const
isNftPage
=
useIsNftPage
()
const
ethGasPrice
=
useGasPrice
()
const
ethGasPrice
=
useGasPrice
()
...
@@ -137,46 +149,49 @@ export default function Polling() {
...
@@ -137,46 +149,49 @@ export default function Polling() {
//TODO - chainlink gas oracle is really slow. Can we get a better data source?
//TODO - chainlink gas oracle is really slow. Can we get a better data source?
return
isNftPage
?
null
:
(
const
blockExternalLinkHref
=
useMemo
(()
=>
{
<>
if
(
!
chainId
||
!
blockNumber
)
return
''
<
RowFixed
>
return
getExplorerLink
(
chainId
,
blockNumber
.
toString
(),
ExplorerDataType
.
BLOCK
)
<
StyledPolling
onMouseEnter=
{
()
=>
setIsHover
(
true
)
}
onMouseLeave=
{
()
=>
setIsHover
(
false
)
}
warning=
{
warning
}
>
},
[
blockNumber
,
chainId
])
<
ExternalLink
href=
"https://etherscan.io/gastracker"
>
{
priceGwei
?
(
if
(
isNftPage
)
{
<
RowFixed
style=
{
{
marginRight
:
'
8px
'
}
}
>
return
null
<
ThemedText
.
DeprecatedMain
fontSize=
"11px"
mr=
"8px"
color=
{
theme
.
deprecated_text3
}
>
}
<
MouseoverTooltip
text=
{
return
(
<
Trans
>
<
RowFixed
>
The current fast gas amount for sending a transaction on L1. Gas fees are paid in
<
StyledPolling
onMouseEnter=
{
()
=>
setIsHover
(
true
)
}
onMouseLeave=
{
()
=>
setIsHover
(
false
)
}
>
Ethereum
'
s native currency Ether (ETH) and denominated in GWEI.
<
ExternalLink
href=
"https://etherscan.io/gastracker"
>
</
Trans
>
{
!!
priceGwei
&&
(
}
<
RowFixed
style=
{
{
marginRight
:
'
8px
'
}
}
>
>
<
ThemedText
.
DeprecatedMain
fontSize=
"11px"
mr=
"8px"
>
{
priceGwei
.
toString
()
}
<
Trans
>
gwei
</
Trans
>
<
MouseoverTooltip
</
MouseoverTooltip
>
text=
{
</
ThemedText
.
DeprecatedMain
>
<
Trans
>
<
StyledGasDot
/>
The current fast gas amount for sending a transaction on L1. Gas fees are paid in Ethereum
'
s
</
RowFixed
>
native currency Ether (ETH) and denominated in GWEI.
)
:
null
}
</
Trans
>
</
ExternalLink
>
}
<
StyledPollingNumber
breathe=
{
isMounting
}
hovering=
{
isHover
}
>
>
<
ExternalLink
{
priceGwei
.
toString
()
}
<
Trans
>
gwei
</
Trans
>
href=
{
</
MouseoverTooltip
>
chainId
&&
blockNumber
?
getExplorerLink
(
chainId
,
blockNumber
.
toString
(),
ExplorerDataType
.
BLOCK
)
:
''
</
ThemedText
.
DeprecatedMain
>
}
<
StyledGasDot
/>
</
RowFixed
>
)
}
</
ExternalLink
>
<
StyledPollingBlockNumber
breathe=
{
isMounting
}
hovering=
{
isHover
}
warning=
{
warning
}
>
<
ExternalLink
href=
{
blockExternalLinkHref
}
>
<
MouseoverTooltip
text=
{
<
Trans
>
The most recent block number on this network. Prices update on every block.
</
Trans
>
}
>
>
<
MouseoverTooltip
{
blockNumber
}
 
text=
{
<
Trans
>
The most recent block number on this network. Prices update on every block.
</
Trans
>
}
</
MouseoverTooltip
>
>
</
ExternalLink
>
{
blockNumber
}
 
</
StyledPollingBlockNumber
>
</
MouseoverTooltip
>
<
StyledPollingDot
warning=
{
warning
}
>
{
isMounting
&&
<
Spinner
warning=
{
warning
}
/>
}
</
StyledPollingDot
>
{
'
'
}
</
ExternalLink
>
</
StyledPolling
>
</
StyledPollingNumber
>
{
warning
&&
<
ChainConnectivityWarning
/>
}
<
StyledPollingDot
warning=
{
warning
}
>
{
isMounting
&&
<
Spinner
warning=
{
warning
}
/>
}
</
StyledPollingDot
>
{
'
'
}
</
RowFixed
>
</
StyledPolling
>
{
warning
&&
<
ChainConnectivityWarning
/>
}
</
RowFixed
>
</>
)
)
}
}
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