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
be5b304d
Commit
be5b304d
authored
Jan 09, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gas info tooltip
parent
ff73835e
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
287 additions
and
74 deletions
+287
-74
progress-circle.tsx
toolkit/chakra/progress-circle.tsx
+37
-0
skeleton.tsx
toolkit/chakra/skeleton.tsx
+2
-2
animations.ts
toolkit/theme/foundations/animations.ts
+10
-0
semanticTokens.ts
toolkit/theme/foundations/semanticTokens.ts
+11
-0
index.ts
toolkit/theme/recipes/index.ts
+4
-0
popover.recipe.ts
toolkit/theme/recipes/popover.recipe.ts
+0
-1
progress-circle.recipe.ts
toolkit/theme/recipes/progress-circle.recipe.ts
+65
-0
skeleton.recipe.ts
toolkit/theme/recipes/skeleton.recipe.ts
+52
-0
theme.ts
toolkit/theme/theme.ts
+2
-0
Chakra.tsx
ui/pages/Chakra.tsx
+26
-0
ContentLoader.tsx
ui/shared/ContentLoader.tsx
+1
-2
GasInfoTooltip.tsx
ui/shared/gas/GasInfoTooltip.tsx
+39
-43
GasInfoUpdateTimer.tsx
ui/shared/gas/GasInfoUpdateTimer.tsx
+14
-5
Layout.tsx
ui/shared/layout/Layout.tsx
+1
-1
MaintenanceAlert.tsx
ui/snippets/header/alerts/MaintenanceAlert.tsx
+7
-4
GetGasButton.tsx
ui/snippets/topBar/GetGasButton.tsx
+1
-2
TopBar.tsx
ui/snippets/topBar/TopBar.tsx
+9
-9
TopBarStats.tsx
ui/snippets/topBar/TopBarStats.tsx
+6
-5
No files found.
toolkit/chakra/progress-circle.tsx
0 → 100644
View file @
be5b304d
import
type
{
SystemStyleObject
}
from
'
@chakra-ui/react
'
;
import
{
AbsoluteCenter
,
ProgressCircle
as
ChakraProgressCircle
,
}
from
'
@chakra-ui/react
'
;
import
*
as
React
from
'
react
'
;
export
interface
ProgressCircleRingProps
extends
ChakraProgressCircle
.
CircleProps
{
trackColor
?:
SystemStyleObject
[
'
stroke
'
];
cap
?:
SystemStyleObject
[
'
strokeLinecap
'
];
}
export
const
ProgressCircleRing
=
React
.
forwardRef
<
SVGSVGElement
,
ProgressCircleRingProps
>
(
function
ProgressCircleRing
(
props
,
ref
)
{
const
{
trackColor
,
cap
,
color
,
...
rest
}
=
props
;
return
(
<
ChakraProgressCircle
.
Circle
{
...
rest
}
ref=
{
ref
}
>
<
ChakraProgressCircle
.
Track
stroke=
{
trackColor
}
/>
<
ChakraProgressCircle
.
Range
stroke=
{
color
}
strokeLinecap=
{
cap
}
/>
</
ChakraProgressCircle
.
Circle
>
);
});
export
const
ProgressCircleValueText
=
React
.
forwardRef
<
HTMLDivElement
,
ChakraProgressCircle
.
ValueTextProps
>
(
function
ProgressCircleValueText
(
props
,
ref
)
{
return
(
<
AbsoluteCenter
>
<
ChakraProgressCircle
.
ValueText
{
...
props
}
ref=
{
ref
}
/>
</
AbsoluteCenter
>
);
});
export
const
ProgressCircleRoot
=
ChakraProgressCircle
.
Root
;
toolkit/chakra/skeleton.tsx
View file @
be5b304d
...
@@ -46,7 +46,7 @@ export const SkeletonText = React.forwardRef<HTMLDivElement, SkeletonTextProps>(
...
@@ -46,7 +46,7 @@ export const SkeletonText = React.forwardRef<HTMLDivElement, SkeletonTextProps>(
export
const
Skeleton
=
React
.
forwardRef
<
HTMLDivElement
,
ChakraSkeletonProps
>
(
export
const
Skeleton
=
React
.
forwardRef
<
HTMLDivElement
,
ChakraSkeletonProps
>
(
function
Skeleton
(
props
,
ref
)
{
function
Skeleton
(
props
,
ref
)
{
const
{
loading
=
false
,
variant
=
'
shine
'
,
...
rest
}
=
props
;
const
{
loading
=
false
,
...
rest
}
=
props
;
return
<
ChakraSkeleton
loading=
{
loading
}
variant=
{
variant
}
{
...
rest
}
ref=
{
ref
}
/>;
return
<
ChakraSkeleton
loading=
{
loading
}
{
...
rest
}
ref=
{
ref
}
/>;
},
},
);
);
toolkit/theme/foundations/animations.ts
0 → 100644
View file @
be5b304d
export
const
keyframes
=
{
fromLeftToRight
:
{
from
:
{
left
:
'
100%
'
,
},
to
:
{
left
:
'
0%
'
,
},
},
};
toolkit/theme/foundations/semanticTokens.ts
View file @
be5b304d
...
@@ -83,6 +83,17 @@ const semanticTokens: ThemingConfig['semanticTokens'] = {
...
@@ -83,6 +83,17 @@ const semanticTokens: ThemingConfig['semanticTokens'] = {
shadow
:
{
value
:
{
base
:
'
{colors.blackAlpha.200}
'
,
_dark
:
'
{colors.whiteAlpha.300}
'
}
},
shadow
:
{
value
:
{
base
:
'
{colors.blackAlpha.200}
'
,
_dark
:
'
{colors.whiteAlpha.300}
'
}
},
},
},
},
},
progressCircle
:
{
trackColor
:
{
DEFAULT
:
{
value
:
{
base
:
'
{colors.blackAlpha.50}
'
,
_dark
:
'
{colors.whiteAlpha.100}
'
}
},
},
},
skeleton
:
{
bg
:
{
start
:
{
value
:
{
base
:
'
{colors.blackAlpha.50}
'
,
_dark
:
'
{colors.whiteAlpha.50}
'
}
},
end
:
{
value
:
{
base
:
'
{colors.blackAlpha.100}
'
,
_dark
:
'
{colors.whiteAlpha.100}
'
}
},
},
},
text
:
{
text
:
{
primary
:
{
value
:
{
base
:
'
{colors.blackAlpha.800}
'
,
_dark
:
'
{colors.whiteAlpha.800}
'
}
},
primary
:
{
value
:
{
base
:
'
{colors.blackAlpha.800}
'
,
_dark
:
'
{colors.whiteAlpha.800}
'
}
},
secondary
:
{
value
:
{
base
:
'
{colors.gray.500}
'
,
_dark
:
'
{colors.gray.400}
'
}
},
secondary
:
{
value
:
{
base
:
'
{colors.gray.500}
'
,
_dark
:
'
{colors.gray.400}
'
}
},
...
...
toolkit/theme/recipes/index.ts
View file @
be5b304d
import
{
recipe
as
button
}
from
'
./button.recipe
'
;
import
{
recipe
as
button
}
from
'
./button.recipe
'
;
import
{
recipe
as
link
}
from
'
./link.recipe
'
;
import
{
recipe
as
link
}
from
'
./link.recipe
'
;
import
{
recipe
as
popover
}
from
'
./popover.recipe
'
;
import
{
recipe
as
popover
}
from
'
./popover.recipe
'
;
import
{
recipe
as
progressCircle
}
from
'
./progress-circle.recipe
'
;
import
{
recipe
as
skeleton
}
from
'
./skeleton.recipe
'
;
import
{
recipe
as
tooltip
}
from
'
./tooltip.recipe
'
;
import
{
recipe
as
tooltip
}
from
'
./tooltip.recipe
'
;
export
const
recipes
=
{
export
const
recipes
=
{
button
,
button
,
link
,
link
,
skeleton
,
};
};
export
const
slotRecipes
=
{
export
const
slotRecipes
=
{
tooltip
,
tooltip
,
popover
,
popover
,
progressCircle
,
};
};
toolkit/theme/recipes/popover.recipe.ts
View file @
be5b304d
import
{
defineSlotRecipe
}
from
'
@chakra-ui/react
'
;
import
{
defineSlotRecipe
}
from
'
@chakra-ui/react
'
;
export
const
recipe
=
defineSlotRecipe
({
export
const
recipe
=
defineSlotRecipe
({
className
:
'
chakra-popover
'
,
slots
:
[
'
content
'
,
'
header
'
,
'
body
'
,
'
footer
'
,
'
arrow
'
,
'
arrowTip
'
],
slots
:
[
'
content
'
,
'
header
'
,
'
body
'
,
'
footer
'
,
'
arrow
'
,
'
arrowTip
'
],
base
:
{
base
:
{
content
:
{
content
:
{
...
...
toolkit/theme/recipes/progress-circle.recipe.ts
0 → 100644
View file @
be5b304d
import
{
defineSlotRecipe
}
from
'
@chakra-ui/react
'
;
export
const
recipe
=
defineSlotRecipe
({
slots
:
[
'
root
'
,
'
circle
'
,
'
circleTrack
'
,
'
circleRange
'
,
'
label
'
,
'
valueText
'
],
base
:
{
root
:
{
display
:
'
inline-flex
'
,
textStyle
:
'
sm
'
,
position
:
'
relative
'
,
},
circle
:
{
_indeterminate
:
{
animation
:
'
spin 2s linear infinite
'
,
},
},
circleTrack
:
{
'
--track-color
'
:
'
colors.progressCircle.trackColor
'
,
stroke
:
'
var(--track-color)
'
,
},
circleRange
:
{
stroke
:
'
blue.500
'
,
transitionProperty
:
'
stroke-dasharray
'
,
transitionDuration
:
'
0.6s
'
,
_indeterminate
:
{
animation
:
'
circular-progress 1.5s linear infinite
'
,
},
},
label
:
{
display
:
'
inline-flex
'
,
},
valueText
:
{
lineHeight
:
'
1
'
,
fontWeight
:
'
medium
'
,
letterSpacing
:
'
tight
'
,
fontVariantNumeric
:
'
tabular-nums
'
,
},
},
variants
:
{
size
:
{
sm
:
{
circle
:
{
'
--size
'
:
'
16px
'
,
'
--thickness
'
:
'
2px
'
,
},
valueText
:
{
textStyle
:
'
2xs
'
,
},
},
md
:
{
circle
:
{
'
--size
'
:
'
20px
'
,
'
--thickness
'
:
'
2px
'
,
},
valueText
:
{
textStyle
:
'
xs
'
,
},
},
},
},
defaultVariants
:
{
size
:
'
md
'
,
},
});
toolkit/theme/recipes/skeleton.recipe.ts
0 → 100644
View file @
be5b304d
import
{
defineRecipe
}
from
'
@chakra-ui/react
'
;
export
const
recipe
=
defineRecipe
({
base
:
{},
variants
:
{
loading
:
{
'
true
'
:
{
borderRadius
:
'
l2
'
,
boxShadow
:
'
none
'
,
backgroundClip
:
'
padding-box
'
,
cursor
:
'
default
'
,
color
:
'
transparent
'
,
pointerEvents
:
'
none
'
,
userSelect
:
'
none
'
,
flexShrink
:
'
0
'
,
'
&::before, &::after, *
'
:
{
visibility
:
'
hidden
'
,
},
},
'
false
'
:
{
background
:
'
unset
'
,
animation
:
'
fade-in var(--fade-duration, 0.1s) ease-out !important
'
,
},
},
variant
:
{
pulse
:
{
background
:
'
bg.emphasized
'
,
animation
:
'
pulse
'
,
animationDuration
:
'
var(--duration, 1.2s)
'
,
},
shine
:
{
'
--animate-from
'
:
'
100%
'
,
'
--animate-to
'
:
'
-100%
'
,
'
--start-color
'
:
'
colors.skeleton.bg.start
'
,
'
--end-color
'
:
'
colors.skeleton.bg.end
'
,
backgroundImage
:
'
linear-gradient(90deg,var(--start-color) 8%,var(--end-color) 18%,var(--start-color) 33%)
'
,
backgroundSize
:
'
200% 100%
'
,
animation
:
'
bg-position var(--duration, 2s) linear infinite
'
,
},
none
:
{
animation
:
'
none
'
,
},
},
},
defaultVariants
:
{
variant
:
'
shine
'
,
loading
:
true
,
},
});
toolkit/theme/theme.ts
View file @
be5b304d
...
@@ -3,6 +3,7 @@ import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
...
@@ -3,6 +3,7 @@ import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
// TODO @tom2drum migrate this to the new recipe system
// TODO @tom2drum migrate this to the new recipe system
// import components from './components/index';
// import components from './components/index';
// import config from './config';
// import config from './config';
import
{
keyframes
}
from
'
./foundations/animations
'
;
import
*
as
borders
from
'
./foundations/borders
'
;
import
*
as
borders
from
'
./foundations/borders
'
;
import
breakpoints
from
'
./foundations/breakpoints
'
;
import
breakpoints
from
'
./foundations/breakpoints
'
;
import
colors
from
'
./foundations/colors
'
;
import
colors
from
'
./foundations/colors
'
;
...
@@ -18,6 +19,7 @@ const customConfig = defineConfig({
...
@@ -18,6 +19,7 @@ const customConfig = defineConfig({
globalCss
,
globalCss
,
theme
:
{
theme
:
{
breakpoints
,
breakpoints
,
keyframes
,
recipes
,
recipes
,
slotRecipes
,
slotRecipes
,
semanticTokens
,
semanticTokens
,
...
...
ui/pages/Chakra.tsx
View file @
be5b304d
...
@@ -3,8 +3,11 @@ import React from 'react';
...
@@ -3,8 +3,11 @@ import React from 'react';
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
useColorMode
}
from
'
toolkit/chakra/color-mode
'
;
import
{
useColorMode
}
from
'
toolkit/chakra/color-mode
'
;
import
{
ProgressCircleRing
,
ProgressCircleRoot
}
from
'
toolkit/chakra/progress-circle
'
;
import
{
Skeleton
}
from
'
toolkit/chakra/skeleton
'
;
import
{
Switch
}
from
'
toolkit/chakra/switch
'
;
import
{
Switch
}
from
'
toolkit/chakra/switch
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
ContentLoader
from
'
ui/shared/ContentLoader
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
const
ChakraShowcases
=
()
=>
{
const
ChakraShowcases
=
()
=>
{
...
@@ -51,6 +54,29 @@ const ChakraShowcases = () => {
...
@@ -51,6 +54,29 @@ const ChakraShowcases = () => {
</
Tooltip
>
</
Tooltip
>
</
HStack
>
</
HStack
>
</
section
>
</
section
>
<
section
>
<
Heading
textStyle=
"heading.md"
mb=
{
2
}
>
Progress Circle
</
Heading
>
<
HStack
gap=
{
4
}
>
<
ProgressCircleRoot
value=
{
45
}
colorPalette=
"blue"
>
<
ProgressCircleRing
/>
</
ProgressCircleRoot
>
</
HStack
>
</
section
>
{
/* TODO @tom2drum check skeleton styles */
}
<
section
>
<
Heading
textStyle=
"heading.md"
mb=
{
2
}
>
Skeleton
&
Loaders
</
Heading
>
<
HStack
gap=
{
4
}
>
<
Skeleton
loading
>
<
span
>
Skeleton
</
span
>
</
Skeleton
>
<
ContentLoader
/>
</
HStack
>
</
section
>
</
VStack
>
</
VStack
>
</>
</>
);
);
...
...
ui/shared/ContentLoader.tsx
View file @
be5b304d
...
@@ -18,8 +18,7 @@ const ContentLoader = ({ className, text }: Props) => {
...
@@ -18,8 +18,7 @@ const ContentLoader = ({ className, text }: Props) => {
position
:
'
absolute
'
,
position
:
'
absolute
'
,
width
:
'
60px
'
,
width
:
'
60px
'
,
height
:
'
6px
'
,
height
:
'
6px
'
,
// TODO @tom2drum check this animation
animation
:
`fromLeftToRight 700ms ease-in-out infinite alternate`
,
animation
:
`slide-from-left-full 700ms ease-in-out infinite alternate`
,
left
:
'
100%
'
,
left
:
'
100%
'
,
top
:
0
,
top
:
0
,
backgroundColor
:
'
blue.300
'
,
backgroundColor
:
'
blue.300
'
,
...
...
ui/shared/gas/GasInfoTooltip.tsx
View file @
be5b304d
import
type
{
PlacementWithLogical
}
from
'
@chakra-ui/react
'
;
import
{
import
{
Box
,
Box
,
Flex
,
Flex
,
Grid
,
Grid
,
PopoverBody
,
PopoverContent
,
PopoverTrigger
,
Portal
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
HomeStats
}
from
'
types/api/stats
'
;
import
type
{
HomeStats
}
from
'
types/api/stats
'
;
import
type
{
ExcludeUndefined
}
from
'
types/utils
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
{
useColorModeValue
}
from
'
toolkit/chakra/color-mode
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
type
{
TooltipProps
}
from
'
toolkit/chakra/tooltip
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
import
LinkInternal
from
'
ui/shared/links/LinkInternal
'
;
import
LinkInternal
from
'
ui/shared/links/LinkInternal
'
;
import
GasInfoTooltipRow
from
'
./GasInfoTooltipRow
'
;
import
GasInfoTooltipRow
from
'
./GasInfoTooltipRow
'
;
...
@@ -29,14 +24,12 @@ interface Props {
...
@@ -29,14 +24,12 @@ interface Props {
data
:
HomeStats
;
data
:
HomeStats
;
dataUpdatedAt
:
number
;
dataUpdatedAt
:
number
;
isOpen
?:
boolean
;
// for testing purposes only; the tests were flaky, i couldn't find a better way
isOpen
?:
boolean
;
// for testing purposes only; the tests were flaky, i couldn't find a better way
placement
?:
PlacementWithLogical
;
placement
?:
ExcludeUndefined
<
TooltipProps
[
'
positioning
'
]
>
[
'
placement
'
]
;
}
}
const
feature
=
config
.
features
.
gasTracker
;
const
feature
=
config
.
features
.
gasTracker
;
const
GasInfoTooltip
=
({
children
,
data
,
dataUpdatedAt
,
isOpen
,
placement
}:
Props
)
=>
{
const
GasInfoTooltip
=
({
children
,
data
,
dataUpdatedAt
,
isOpen
,
placement
}:
Props
)
=>
{
const
tooltipBg
=
useColorModeValue
(
'
gray.700
'
,
'
gray.900
'
);
if
(
!
data
.
gas_prices
)
{
if
(
!
data
.
gas_prices
)
{
return
null
;
return
null
;
}
}
...
@@ -47,39 +40,42 @@ const GasInfoTooltip = ({ children, data, dataUpdatedAt, isOpen, placement }: Pr
...
@@ -47,39 +40,42 @@ const GasInfoTooltip = ({ children, data, dataUpdatedAt, isOpen, placement }: Pr
feature
.
isEnabled
&&
feature
.
units
.
length
===
2
?
feature
.
isEnabled
&&
feature
.
units
.
length
===
2
?
3
:
2
;
3
:
2
;
const
content
=
(
<
Flex
flexDir=
"column"
textStyle=
"xs"
rowGap=
{
3
}
>
{
data
.
gas_price_updated_at
&&
(
<
Flex
justifyContent=
"space-between"
>
<
Box
color=
"text_secondary"
>
Last update
</
Box
>
<
Flex
color=
"text_secondary"
justifyContent=
"flex-end"
columnGap=
{
2
}
ml=
{
3
}
>
{
dayjs
(
data
.
gas_price_updated_at
).
format
(
'
MMM DD, HH:mm:ss
'
)
}
{
data
.
gas_prices_update_in
!==
0
&&
<
GasInfoUpdateTimer
key=
{
dataUpdatedAt
}
startTime=
{
dataUpdatedAt
}
duration=
{
data
.
gas_prices_update_in
}
/>
}
</
Flex
>
</
Flex
>
)
}
<
Grid
rowGap=
{
2
}
columnGap=
"10px"
gridTemplateColumns=
{
`repeat(${ columnNum }, minmax(min-content, auto))`
}
>
<
GasInfoTooltipRow
name=
"Fast"
info=
{
data
.
gas_prices
.
fast
}
/>
<
GasInfoTooltipRow
name=
"Normal"
info=
{
data
.
gas_prices
.
average
}
/>
<
GasInfoTooltipRow
name=
"Slow"
info=
{
data
.
gas_prices
.
slow
}
/>
</
Grid
>
<
LinkInternal
href=
{
route
({
pathname
:
'
/gas-tracker
'
})
}
>
Gas tracker overview
</
LinkInternal
>
</
Flex
>
);
return
(
return
(
<
Popover
trigger=
"hover"
isLazy
isOpen=
{
isOpen
}
placement=
{
placement
}
>
<
Tooltip
<
PopoverTrigger
>
content=
{
content
}
{
children
}
positioning=
{
{
placement
}
}
</
PopoverTrigger
>
open=
{
isOpen
}
<
Portal
>
lazyMount
<
PopoverContent
bgColor=
{
tooltipBg
}
w=
"auto"
>
interactive
<
PopoverBody
color=
"white"
>
showArrow=
{
false
}
{
/* TODO @tom2drum add dark mode */
}
// TODO @tom2drum forced light mode doesn't work for now
<
Flex
flexDir=
"column"
fontSize=
"xs"
lineHeight=
{
4
}
rowGap=
{
3
}
>
contentProps=
{
{
p
:
4
,
borderRadius
:
'
md
'
,
className
:
'
light
'
}
}
{
data
.
gas_price_updated_at
&&
(
>
<
Flex
justifyContent=
"space-between"
>
{
children
}
<
Box
color=
"text_secondary"
>
Last update
</
Box
>
</
Tooltip
>
<
Flex
color=
"text_secondary"
justifyContent=
"flex-end"
columnGap=
{
2
}
ml=
{
3
}
>
{
dayjs
(
data
.
gas_price_updated_at
).
format
(
'
MMM DD, HH:mm:ss
'
)
}
{
data
.
gas_prices_update_in
!==
0
&&
<
GasInfoUpdateTimer
key=
{
dataUpdatedAt
}
startTime=
{
dataUpdatedAt
}
duration=
{
data
.
gas_prices_update_in
}
/>
}
</
Flex
>
</
Flex
>
)
}
<
Grid
rowGap=
{
2
}
columnGap=
"10px"
gridTemplateColumns=
{
`repeat(${ columnNum }, minmax(min-content, auto))`
}
>
<
GasInfoTooltipRow
name=
"Fast"
info=
{
data
.
gas_prices
.
fast
}
/>
<
GasInfoTooltipRow
name=
"Normal"
info=
{
data
.
gas_prices
.
average
}
/>
<
GasInfoTooltipRow
name=
"Slow"
info=
{
data
.
gas_prices
.
slow
}
/>
</
Grid
>
<
LinkInternal
href=
{
route
({
pathname
:
'
/gas-tracker
'
})
}
>
Gas tracker overview
</
LinkInternal
>
</
Flex
>
</
PopoverBody
>
</
PopoverContent
>
</
Portal
>
</
Popover
>
);
);
};
};
...
...
ui/shared/gas/GasInfoUpdateTimer.tsx
View file @
be5b304d
import
{
CircularProgress
,
chakra
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
type
{
ProgressCircle
}
from
'
@chakra-ui/react
'
;
import
{
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
{
ProgressCircleRing
,
ProgressCircleRoot
}
from
'
toolkit/chakra/progress-circle
'
;
interface
Props
{
interface
Props
{
startTime
:
number
;
startTime
:
number
;
duration
:
number
;
duration
:
number
;
className
?:
string
;
className
?:
string
;
size
?:
number
;
size
?:
ProgressCircle
.
RootProps
[
'
size
'
]
;
}
}
const
getValue
=
(
startDate
:
dayjs
.
Dayjs
,
duration
:
number
)
=>
{
const
getValue
=
(
startDate
:
dayjs
.
Dayjs
,
duration
:
number
)
=>
{
...
@@ -22,9 +24,8 @@ const getValue = (startDate: dayjs.Dayjs, duration: number) => {
...
@@ -22,9 +24,8 @@ const getValue = (startDate: dayjs.Dayjs, duration: number) => {
return
value
;
return
value
;
};
};
const
GasInfoUpdateTimer
=
({
startTime
,
duration
,
className
,
size
=
4
}:
Props
)
=>
{
const
GasInfoUpdateTimer
=
({
startTime
,
duration
,
className
,
size
=
'
sm
'
}:
Props
)
=>
{
const
[
value
,
setValue
]
=
React
.
useState
(
getValue
(
dayjs
(
startTime
),
duration
));
const
[
value
,
setValue
]
=
React
.
useState
(
getValue
(
dayjs
(
startTime
),
duration
));
const
trackColor
=
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.100
'
);
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
const
startDate
=
dayjs
(
startTime
);
const
startDate
=
dayjs
(
startTime
);
...
@@ -42,7 +43,15 @@ const GasInfoUpdateTimer = ({ startTime, duration, className, size = 4 }: Props)
...
@@ -42,7 +43,15 @@ const GasInfoUpdateTimer = ({ startTime, duration, className, size = 4 }: Props)
};
};
},
[
startTime
,
duration
]);
},
[
startTime
,
duration
]);
return
<
CircularProgress
className=
{
className
}
value=
{
value
}
trackColor=
{
trackColor
}
size=
{
size
}
/>;
return
(
<
ProgressCircleRoot
className=
{
className
}
value=
{
value
}
size=
{
size
}
>
<
ProgressCircleRing
/>
</
ProgressCircleRoot
>
);
};
};
export
default
React
.
memo
(
chakra
(
GasInfoUpdateTimer
));
export
default
React
.
memo
(
chakra
(
GasInfoUpdateTimer
));
ui/shared/layout/Layout.tsx
View file @
be5b304d
...
@@ -13,7 +13,7 @@ import * as Layout from './components';
...
@@ -13,7 +13,7 @@ import * as Layout from './components';
const
LayoutDefault
=
({
children
}:
Props
)
=>
{
const
LayoutDefault
=
({
children
}:
Props
)
=>
{
return
(
return
(
<
Layout
.
Container
>
<
Layout
.
Container
>
{
/* <Layout.TopRow/> */
}
<
Layout
.
TopRow
/>
<
Layout
.
NavBar
/>
<
Layout
.
NavBar
/>
{
/* <HeaderMobile/> */
}
{
/* <HeaderMobile/> */
}
<
Layout
.
MainArea
>
<
Layout
.
MainArea
>
...
...
ui/snippets/header/alerts/MaintenanceAlert.tsx
View file @
be5b304d
import
{
Alert
,
AlertIcon
,
AlertTitle
}
from
'
@chakra-ui/react
'
;
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
{
Alert
}
from
'
toolkit/chakra/alert
'
;
// TODO @tom2drum fix this alert
const
MaintenanceAlert
=
()
=>
{
const
MaintenanceAlert
=
()
=>
{
if
(
!
config
.
UI
.
maintenanceAlert
.
message
)
{
if
(
!
config
.
UI
.
maintenanceAlert
.
message
)
{
return
null
;
return
null
;
...
@@ -10,10 +12,10 @@ const MaintenanceAlert = () => {
...
@@ -10,10 +12,10 @@ const MaintenanceAlert = () => {
return
(
return
(
<
Alert
status=
"info"
colorScheme=
"gray"
py=
{
3
}
borderRadius=
"md"
>
<
Alert
status=
"info"
colorScheme=
"gray"
py=
{
3
}
borderRadius=
"md"
>
<
AlertIcon
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
/>
{
/* <AlertIcon display={{ base: 'none', lg: 'flex' }}/> */
}
<
AlertTitle
<
Box
dangerouslySetInnerHTML=
{
{
__html
:
config
.
UI
.
maintenanceAlert
.
message
}
}
dangerouslySetInnerHTML=
{
{
__html
:
config
.
UI
.
maintenanceAlert
.
message
}
}
sx
=
{
{
css
=
{
{
'
& a
'
:
{
'
& a
'
:
{
color
:
'
link
'
,
color
:
'
link
'
,
_hover
:
{
_hover
:
{
...
@@ -21,6 +23,7 @@ const MaintenanceAlert = () => {
...
@@ -21,6 +23,7 @@ const MaintenanceAlert = () => {
},
},
},
},
}
}
}
}
/>
/>
</
Alert
>
</
Alert
>
);
);
...
...
ui/snippets/topBar/GetGasButton.tsx
View file @
be5b304d
...
@@ -39,8 +39,7 @@ const GetGasButton = () => {
...
@@ -39,8 +39,7 @@ const GetGasButton = () => {
href=
{
href
}
href=
{
href
}
display=
"flex"
display=
"flex"
alignItems=
"center"
alignItems=
"center"
fontSize=
"xs"
textStyle=
"xs"
lineHeight=
{
5
}
onClick=
{
onGetGasClick
}
onClick=
{
onGetGasClick
}
>
>
{
getGasFeature
.
logoUrl
&&
(
{
getGasFeature
.
logoUrl
&&
(
...
...
ui/snippets/topBar/TopBar.tsx
View file @
be5b304d
import
{
Flex
,
Divide
r
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Separato
r
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
useColorModeValue
}
from
'
toolkit/chakra/color-mode
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
{
useColorModeValue
}
from
'
toolkit/chakra/color-mode
'
;
import
{
CONTENT_MAX_WIDTH
}
from
'
ui/shared/layout/utils
'
;
import
{
CONTENT_MAX_WIDTH
}
from
'
ui/shared/layout/utils
'
;
import
DeFiDropdown
from
'
./DeFiDropdown
'
;
import
DeFiDropdown
from
'
./DeFiDropdown
'
;
...
@@ -25,19 +25,19 @@ const TopBar = () => {
...
@@ -25,19 +25,19 @@ const TopBar = () => {
>
>
<
TopBarStats
/>
<
TopBarStats
/>
<
Flex
alignItems=
"center"
>
<
Flex
alignItems=
"center"
>
{
config
.
features
.
deFiDropdown
.
isEnabled
&&
(
{
/* {
config.features.deFiDropdown.isEnabled && (
<>
<>
<DeFiDropdown/>
<DeFiDropdown/>
<
Divide
r
mr=
{
3
}
ml=
{
{
base
:
2
,
sm
:
3
}
}
height=
{
4
}
orientation=
"vertical"
/>
<
Separato
r mr={ 3 } ml={{ base: 2, sm: 3 }} height={ 4 } orientation="vertical"/>
</>
</>
)
}
) }
*/
}
<
Settings
/>
{
/* <Settings/> */
}
{
config
.
UI
.
navigation
.
layout
===
'
horizontal
'
&&
Boolean
(
config
.
UI
.
navigation
.
featuredNetworks
)
&&
(
{
/* {
config.UI.navigation.layout === 'horizontal' && Boolean(config.UI.navigation.featuredNetworks) && (
<Box display={{ base: 'none', lg: 'flex' }}>
<Box display={{ base: 'none', lg: 'flex' }}>
<
Divide
r
mx=
{
3
}
height=
{
4
}
orientation=
"vertical"
/>
<
Separato
r mx={ 3 } height={ 4 } orientation="vertical"/>
<NetworkMenu/>
<NetworkMenu/>
</Box>
</Box>
)
}
) }
*/
}
</
Flex
>
</
Flex
>
</
Flex
>
</
Flex
>
</
Box
>
</
Box
>
...
...
ui/snippets/topBar/TopBarStats.tsx
View file @
be5b304d
import
{
Flex
,
Link
,
Skeleton
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Link
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
...
@@ -6,6 +6,7 @@ import useApiQuery from 'lib/api/useApiQuery';
...
@@ -6,6 +6,7 @@ import useApiQuery from 'lib/api/useApiQuery';
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
{
HOMEPAGE_STATS
}
from
'
stubs/stats
'
;
import
{
HOMEPAGE_STATS
}
from
'
stubs/stats
'
;
import
{
Skeleton
}
from
'
toolkit/chakra/skeleton
'
;
import
GasInfoTooltip
from
'
ui/shared/gas/GasInfoTooltip
'
;
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
'
;
...
@@ -55,12 +56,12 @@ const TopBarStats = () => {
...
@@ -55,12 +56,12 @@ const TopBarStats = () => {
>
>
{
data
?.
coin_price
&&
(
{
data
?.
coin_price
&&
(
<
Flex
columnGap=
{
1
}
>
<
Flex
columnGap=
{
1
}
>
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
>
<
Skeleton
loading=
{
isPlaceholderData
}
>
<
chakra
.
span
color=
"text_secondary"
>
{
config
.
chain
.
currency
.
symbol
}
</
chakra
.
span
>
<
chakra
.
span
color=
"text_secondary"
>
{
config
.
chain
.
currency
.
symbol
}
</
chakra
.
span
>
<
span
>
$
{
Number
(
data
.
coin_price
).
toLocaleString
(
undefined
,
{
minimumFractionDigits
:
2
,
maximumFractionDigits
:
6
})
}
</
span
>
<
span
>
$
{
Number
(
data
.
coin_price
).
toLocaleString
(
undefined
,
{
minimumFractionDigits
:
2
,
maximumFractionDigits
:
6
})
}
</
span
>
</
Skeleton
>
</
Skeleton
>
{
data
.
coin_price_change_percentage
&&
(
{
data
.
coin_price_change_percentage
&&
(
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
>
<
Skeleton
loading=
{
isPlaceholderData
}
>
<
chakra
.
span
color=
{
Number
(
data
.
coin_price_change_percentage
)
>=
0
?
'
green.500
'
:
'
red.500
'
}
>
<
chakra
.
span
color=
{
Number
(
data
.
coin_price_change_percentage
)
>=
0
?
'
green.500
'
:
'
red.500
'
}
>
{
Number
(
data
.
coin_price_change_percentage
).
toFixed
(
2
)
}
%
{
Number
(
data
.
coin_price_change_percentage
).
toFixed
(
2
)
}
%
</
chakra
.
span
>
</
chakra
.
span
>
...
@@ -70,7 +71,7 @@ const TopBarStats = () => {
...
@@ -70,7 +71,7 @@ const TopBarStats = () => {
)
}
)
}
{
!
isMobile
&&
data
?.
secondary_coin_price
&&
config
.
chain
.
secondaryCoin
.
symbol
&&
(
{
!
isMobile
&&
data
?.
secondary_coin_price
&&
config
.
chain
.
secondaryCoin
.
symbol
&&
(
<
Flex
columnGap=
{
1
}
ml=
{
data
?.
coin_price
?
3
:
0
}
>
<
Flex
columnGap=
{
1
}
ml=
{
data
?.
coin_price
?
3
:
0
}
>
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
>
<
Skeleton
loading=
{
isPlaceholderData
}
>
<
chakra
.
span
color=
"text_secondary"
>
{
config
.
chain
.
secondaryCoin
.
symbol
}
</
chakra
.
span
>
<
chakra
.
span
color=
"text_secondary"
>
{
config
.
chain
.
secondaryCoin
.
symbol
}
</
chakra
.
span
>
<
span
>
$
{
Number
(
data
.
secondary_coin_price
).
toLocaleString
(
undefined
,
{
minimumFractionDigits
:
2
,
maximumFractionDigits
:
6
})
}
</
span
>
<
span
>
$
{
Number
(
data
.
secondary_coin_price
).
toLocaleString
(
undefined
,
{
minimumFractionDigits
:
2
,
maximumFractionDigits
:
6
})
}
</
span
>
</
Skeleton
>
</
Skeleton
>
...
@@ -79,7 +80,7 @@ const TopBarStats = () => {
...
@@ -79,7 +80,7 @@ const TopBarStats = () => {
{
data
?.
coin_price
&&
config
.
features
.
gasTracker
.
isEnabled
&&
<
TextSeparator
color=
"border.divider"
/>
}
{
data
?.
coin_price
&&
config
.
features
.
gasTracker
.
isEnabled
&&
<
TextSeparator
color=
"border.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
}
>
<
Skeleton
loading=
{
isPlaceholderData
}
display=
"inline-flex"
whiteSpace=
"pre-wrap"
>
<
chakra
.
span
color=
"text_secondary"
>
Gas
</
chakra
.
span
>
<
chakra
.
span
color=
"text_secondary"
>
Gas
</
chakra
.
span
>
<
GasInfoTooltip
data=
{
data
}
dataUpdatedAt=
{
dataUpdatedAt
}
placement=
{
!
data
?.
coin_price
?
'
bottom-start
'
:
undefined
}
>
<
GasInfoTooltip
data=
{
data
}
dataUpdatedAt=
{
dataUpdatedAt
}
placement=
{
!
data
?.
coin_price
?
'
bottom-start
'
:
undefined
}
>
<
Link
>
<
Link
>
...
...
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