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
1cf91f6a
Commit
1cf91f6a
authored
Jul 25, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move get gas button to top bar
parent
fdf70b1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
GetGasButton.tsx
ui/snippets/topBar/GetGasButton.tsx
+9
-9
TopBarStats.tsx
ui/snippets/topBar/TopBarStats.tsx
+13
-8
No files found.
ui/
address/details
/GetGasButton.tsx
→
ui/
snippets/topBar
/GetGasButton.tsx
View file @
1cf91f6a
import
{
Image
}
from
'
@chakra-ui/react
'
;
import
{
Image
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
LinkExternal
from
'
ui/shared/links/LinkExternal
'
;
import
LinkExternal
from
'
ui/shared/links/LinkExternal
'
;
import
LinkInternal
from
'
ui/shared/links/LinkInternal
'
;
import
LinkInternal
from
'
ui/shared/links/LinkInternal
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
const
getGasFeature
=
config
.
features
.
getGasButton
;
const
getGasFeature
=
config
.
features
.
getGasButton
;
const
GetGasButton
=
()
=>
{
const
GetGasButton
=
()
=>
{
const
isMobile
=
useIsMobile
(
false
);
const
onGetGasClick
=
React
.
useCallback
(()
=>
{
const
onGetGasClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Get gas
'
,
Source
:
'
address
'
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Get gas
'
,
Source
:
'
address
'
});
},
[]);
},
[]);
if
(
getGasFeature
.
isEnabled
)
{
if
(
getGasFeature
.
isEnabled
&&
!
isMobile
)
{
try
{
try
{
const
dappId
=
getGasFeature
.
dappId
;
const
dappId
=
getGasFeature
.
dappId
;
const
urlObj
=
new
URL
(
getGasFeature
.
url
);
const
urlObj
=
new
URL
(
getGasFeature
.
url
);
...
@@ -32,12 +34,12 @@ const GetGasButton = () => {
...
@@ -32,12 +34,12 @@ const GetGasButton = () => {
return
(
return
(
<>
<>
<
TextSeparator
mx=
{
2
}
color=
"gray.500"
/>
<
Box
h=
"1px"
w=
"8px"
bg=
"divider"
mx=
{
1
}
/>
<
Link
<
Link
href=
{
href
}
href=
{
href
}
display=
"flex"
display=
"flex"
alignItems=
"center"
alignItems=
"center"
fontSize=
"
sm
"
fontSize=
"
xs
"
lineHeight=
{
5
}
lineHeight=
{
5
}
onClick=
{
onGetGasClick
}
onClick=
{
onGetGasClick
}
>
>
...
@@ -45,10 +47,8 @@ const GetGasButton = () => {
...
@@ -45,10 +47,8 @@ const GetGasButton = () => {
<
Image
<
Image
src=
{
getGasFeature
.
logoUrl
}
src=
{
getGasFeature
.
logoUrl
}
alt=
{
getGasFeature
.
name
}
alt=
{
getGasFeature
.
name
}
boxSize=
{
5
}
boxSize=
"14px"
mr=
{
2
}
mr=
{
1
}
borderRadius=
"4px"
overflow=
"hidden"
/>
/>
)
}
)
}
{
getGasFeature
.
name
}
{
getGasFeature
.
name
}
...
...
ui/snippets/topBar/TopBarStats.tsx
View file @
1cf91f6a
...
@@ -10,6 +10,8 @@ import GasInfoTooltip from 'ui/shared/gas/GasInfoTooltip';
...
@@ -10,6 +10,8 @@ import GasInfoTooltip from 'ui/shared/gas/GasInfoTooltip';
import
GasPrice
from
'
ui/shared/gas/GasPrice
'
;
import
GasPrice
from
'
ui/shared/gas/GasPrice
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
GetGasButton
from
'
./GetGasButton
'
;
const
TopBarStats
=
()
=>
{
const
TopBarStats
=
()
=>
{
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
...
@@ -76,14 +78,17 @@ const TopBarStats = () => {
...
@@ -76,14 +78,17 @@ const TopBarStats = () => {
)
}
)
}
{
data
?.
coin_price
&&
config
.
features
.
gasTracker
.
isEnabled
&&
<
TextSeparator
color=
"divider"
/>
}
{
data
?.
coin_price
&&
config
.
features
.
gasTracker
.
isEnabled
&&
<
TextSeparator
color=
"divider"
/>
}
{
data
?.
gas_prices
&&
data
.
gas_prices
.
average
!==
null
&&
config
.
features
.
gasTracker
.
isEnabled
&&
(
{
data
?.
gas_prices
&&
data
.
gas_prices
.
average
!==
null
&&
config
.
features
.
gasTracker
.
isEnabled
&&
(
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
>
<>
<
chakra
.
span
color=
"text_secondary"
>
Gas
</
chakra
.
span
>
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
>
<
GasInfoTooltip
data=
{
data
}
dataUpdatedAt=
{
dataUpdatedAt
}
placement=
{
!
data
?.
coin_price
?
'
bottom-start
'
:
undefined
}
>
<
chakra
.
span
color=
"text_secondary"
>
Gas
</
chakra
.
span
>
<
Link
>
<
GasInfoTooltip
data=
{
data
}
dataUpdatedAt=
{
dataUpdatedAt
}
placement=
{
!
data
?.
coin_price
?
'
bottom-start
'
:
undefined
}
>
<
GasPrice
data=
{
data
.
gas_prices
.
average
}
/>
<
Link
>
</
Link
>
<
GasPrice
data=
{
data
.
gas_prices
.
average
}
/>
</
GasInfoTooltip
>
</
Link
>
</
Skeleton
>
</
GasInfoTooltip
>
</
Skeleton
>
{
!
isPlaceholderData
&&
<
GetGasButton
/>
}
</>
)
}
)
}
</
Flex
>
</
Flex
>
);
);
...
...
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