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
a65cca1d
Commit
a65cca1d
authored
Jan 10, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix DeFi dropdown
parent
155e3d62
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
37 deletions
+60
-37
button.recipe.ts
toolkit/theme/recipes/button.recipe.ts
+2
-0
DeFiDropdown.tsx
ui/snippets/topBar/DeFiDropdown.tsx
+30
-17
DeFiDropdownItem.tsx
ui/snippets/topBar/DeFiDropdownItem.tsx
+24
-16
NetworkMenu.tsx
ui/snippets/topBar/NetworkMenu.tsx
+1
-1
TopBar.tsx
ui/snippets/topBar/TopBar.tsx
+2
-2
Settings.tsx
ui/snippets/topBar/settings/Settings.tsx
+1
-1
No files found.
toolkit/theme/recipes/button.recipe.ts
View file @
a65cca1d
...
@@ -3,6 +3,7 @@ import { defineRecipe } from '@chakra-ui/react';
...
@@ -3,6 +3,7 @@ import { defineRecipe } from '@chakra-ui/react';
export
const
recipe
=
defineRecipe
({
export
const
recipe
=
defineRecipe
({
base
:
{
base
:
{
display
:
'
flex
'
,
display
:
'
flex
'
,
gap
:
0
,
borderRadius
:
'
base
'
,
borderRadius
:
'
base
'
,
fontWeight
:
600
,
fontWeight
:
600
,
overflow
:
'
hidden
'
,
overflow
:
'
hidden
'
,
...
@@ -13,6 +14,7 @@ export const recipe = defineRecipe({
...
@@ -13,6 +14,7 @@ export const recipe = defineRecipe({
variants
:
{
variants
:
{
visual
:
{
visual
:
{
solid
:
{
solid
:
{
gap
:
0
,
bg
:
'
blue.600
'
,
bg
:
'
blue.600
'
,
color
:
'
white
'
,
color
:
'
white
'
,
_hover
:
{
_hover
:
{
...
...
ui/snippets/topBar/DeFiDropdown.tsx
View file @
a65cca1d
import
{
B
utton
,
Box
,
Flex
,
PopoverTrigger
,
PopoverContent
,
PopoverBody
,
useDisclosure
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
B
ox
,
Flex
,
Link
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
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
{
space
}
from
'
lib/html-entities
'
;
import
getPageType
from
'
lib/mixpanel/getPageType
'
;
import
getPageType
from
'
lib/mixpanel/getPageType
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
{
Button
}
from
'
toolkit/chakra/button
'
;
import
{
PopoverBody
,
PopoverContent
,
PopoverRoot
,
PopoverTrigger
}
from
'
toolkit/chakra/popover
'
;
import
{
useDisclosure
}
from
'
toolkit/hooks/useDisclosure
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
DeFiDropdownItem
from
'
./DeFiDropdownItem
'
;
import
DeFiDropdownItem
from
'
./DeFiDropdownItem
'
;
...
@@ -17,7 +20,7 @@ const feature = config.features.deFiDropdown;
...
@@ -17,7 +20,7 @@ const feature = config.features.deFiDropdown;
const
DeFiDropdown
=
()
=>
{
const
DeFiDropdown
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
source
=
getPageType
(
router
.
pathname
);
const
source
=
getPageType
(
router
.
pathname
);
const
{
isOpen
,
onToggle
,
onClos
e
}
=
useDisclosure
();
const
{
open
,
onToggle
,
onOpenChang
e
}
=
useDisclosure
();
const
handleClick
=
React
.
useCallback
((
content
:
string
)
=>
{
const
handleClick
=
React
.
useCallback
((
content
:
string
)
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
content
,
Source
:
source
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
content
,
Source
:
source
});
...
@@ -28,9 +31,9 @@ const DeFiDropdown = () => {
...
@@ -28,9 +31,9 @@ const DeFiDropdown = () => {
}
}
const
buttonStyles
=
{
const
buttonStyles
=
{
variant
:
'
solid
'
,
visual
:
'
solid
'
as
const
,
size
:
'
xs
'
,
borderRadius
:
'
sm
'
,
borderRadius
:
'
sm
'
,
textStyle
:
'
xs
'
,
height
:
5
,
height
:
5
,
px
:
1.5
,
px
:
1.5
,
fontWeight
:
'
500
'
,
fontWeight
:
'
500
'
,
...
@@ -42,15 +45,15 @@ const DeFiDropdown = () => {
...
@@ -42,15 +45,15 @@ const DeFiDropdown = () => {
}));
}));
return
items
.
length
>
1
?
(
return
items
.
length
>
1
?
(
<
Popover
isOpen=
{
isOpen
}
onClose=
{
onClose
}
placement=
"bottom-start"
isLazy
>
<
Popover
Root
open=
{
open
}
onOpenChange=
{
onOpenChange
}
positioning=
{
{
placement
:
'
bottom-start
'
}
}
lazyMount
>
<
PopoverTrigger
>
<
PopoverTrigger
>
<
Button
<
Button
onClick=
{
onToggle
}
onClick=
{
onToggle
}
isActive=
{
isO
pen
}
active=
{
o
pen
}
{
...
buttonStyles
}
{
...
buttonStyles
}
>
>
<
chakra
.
span
display=
{
{
base
:
'
none
'
,
lg
:
'
inline
'
}
}
mr=
{
1
}
>
<
chakra
.
span
display=
{
{
base
:
'
none
'
,
lg
:
'
inline
'
}
}
whiteSpace=
"pre-wrap"
>
Blockscout
Blockscout
{
space
}
</
chakra
.
span
>
</
chakra
.
span
>
DeFi
DeFi
<
IconSvg
name=
"arrows/east-mini"
boxSize=
{
4
}
ml=
{
1
}
transform=
"rotate(-90deg)"
/>
<
IconSvg
name=
"arrows/east-mini"
boxSize=
{
4
}
ml=
{
1
}
transform=
"rotate(-90deg)"
/>
...
@@ -65,19 +68,29 @@ const DeFiDropdown = () => {
...
@@ -65,19 +68,29 @@ const DeFiDropdown = () => {
</
Flex
>
</
Flex
>
</
PopoverBody
>
</
PopoverBody
>
</
PopoverContent
>
</
PopoverContent
>
</
Popover
>
</
Popover
Root
>
)
:
(
)
:
(
<
Button
<
Button
as=
"a"
asChild
href=
{
items
[
0
].
dappId
?
route
({
pathname
:
'
/apps/[id]
'
,
query
:
{
id
:
items
[
0
].
dappId
,
action
:
'
connect
'
}
})
:
items
[
0
].
url
}
target=
{
items
[
0
].
dappId
?
'
_self
'
:
'
_blank
'
}
onClick=
{
items
[
0
].
onClick
}
onClick=
{
items
[
0
].
onClick
}
_hover=
{
{
color
:
'
white
'
,
}
}
{
...
buttonStyles
}
{
...
buttonStyles
}
>
>
<
IconSvg
name=
{
items
[
0
].
icon
}
boxSize=
{
3
}
mr=
{
{
base
:
0
,
sm
:
1
}
}
/>
<
Link
<
Box
display=
{
{
base
:
'
none
'
,
sm
:
'
inline
'
}
}
>
href=
{
{
items
[
0
].
text
}
items
[
0
].
dappId
?
</
Box
>
route
({
pathname
:
'
/apps/[id]
'
,
query
:
{
id
:
items
[
0
].
dappId
,
action
:
'
connect
'
}
})
:
items
[
0
].
url
}
target=
{
items
[
0
].
dappId
?
'
_self
'
:
'
_blank
'
}
>
<
IconSvg
name=
{
items
[
0
].
icon
}
boxSize=
{
3
}
mr=
{
{
base
:
0
,
sm
:
1
}
}
/>
<
Box
display=
{
{
base
:
'
none
'
,
sm
:
'
inline
'
}
}
>
{
items
[
0
].
text
}
</
Box
>
</
Link
>
</
Button
>
</
Button
>
);
);
};
};
...
...
ui/snippets/topBar/DeFiDropdownItem.tsx
View file @
a65cca1d
import
{
Text
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
DeFiDropdownItem
as
TDeFiDropdownItem
}
from
'
types/client/deFiDropdown
'
;
import
type
{
DeFiDropdownItem
as
TDeFiDropdownItem
}
from
'
types/client/deFiDropdown
'
;
...
@@ -19,11 +19,11 @@ const DeFiDropdownItem = ({ item }: Props) => {
...
@@ -19,11 +19,11 @@ const DeFiDropdownItem = ({ item }: Props) => {
height
:
'
34px
'
,
height
:
'
34px
'
,
display
:
'
inline-flex
'
,
display
:
'
inline-flex
'
,
alignItems
:
'
center
'
,
alignItems
:
'
center
'
,
color
:
useColorModeValue
(
'
blackAlpha.800
'
,
'
gray.400
'
)
,
color
:
{
base
:
'
blackAlpha.800
'
,
_dark
:
'
gray.400
'
}
,
_hover
:
{
_hover
:
{
textDecoration
:
'
none
'
,
textDecoration
:
'
none
'
,
'
& *
'
:
{
'
& *
'
:
{
color
:
'
link
_hovered
'
,
color
:
'
link
.primary.hover
'
,
},
},
},
},
};
};
...
@@ -35,19 +35,27 @@ const DeFiDropdownItem = ({ item }: Props) => {
...
@@ -35,19 +35,27 @@ const DeFiDropdownItem = ({ item }: Props) => {
</>
</>
);
);
return
item
.
dappId
?
(
if
(
item
.
dappId
)
{
<
LinkInternal
return
(
href=
{
route
({
pathname
:
'
/apps/[id]
'
,
query
:
{
id
:
item
.
dappId
,
action
:
'
connect
'
}
})
}
<
LinkInternal
target=
"_self"
href=
{
route
({
pathname
:
'
/apps/[id]
'
,
query
:
{
id
:
item
.
dappId
,
action
:
'
connect
'
}
})
}
{
...
styles
}
target=
"_self"
>
{
...
styles
}
{
content
}
>
</
LinkInternal
>
{
content
}
)
:
(
</
LinkInternal
>
<
LinkExternal
href=
{
item
.
url
}
{
...
styles
}
>
);
{
content
}
}
</
LinkExternal
>
);
if
(
item
.
url
)
{
return
(
<
LinkExternal
href=
{
item
.
url
}
{
...
styles
}
>
{
content
}
</
LinkExternal
>
);
}
return
null
;
};
};
export
default
React
.
memo
(
DeFiDropdownItem
);
export
default
React
.
memo
(
DeFiDropdownItem
);
ui/snippets/topBar/NetworkMenu.tsx
View file @
a65cca1d
...
@@ -22,7 +22,7 @@ const NetworkMenu = () => {
...
@@ -22,7 +22,7 @@ const NetworkMenu = () => {
color=
"link.primary"
color=
"link.primary"
_hover=
{
{
color
:
'
link.primary.hover
'
}
}
_hover=
{
{
color
:
'
link.primary.hover
'
}
}
aria
-
label=
"Network menu"
aria
-
label=
"Network menu"
borderRadius=
"
none
"
borderRadius=
"
sm
"
onClick=
{
menu
.
onToggle
}
onClick=
{
menu
.
onToggle
}
>
>
<
IconSvg
name=
"networks"
boxSize=
{
4
}
p=
"1px"
/>
<
IconSvg
name=
"networks"
boxSize=
{
4
}
p=
"1px"
/>
...
...
ui/snippets/topBar/TopBar.tsx
View file @
a65cca1d
...
@@ -25,12 +25,12 @@ const TopBar = () => {
...
@@ -25,12 +25,12 @@ const TopBar = () => {
>
>
<
TopBarStats
/>
<
TopBarStats
/>
<
Flex
alignItems=
"center"
>
<
Flex
alignItems=
"center"
>
{
/* {
config.features.deFiDropdown.isEnabled && (
{
config
.
features
.
deFiDropdown
.
isEnabled
&&
(
<>
<>
<
DeFiDropdown
/>
<
DeFiDropdown
/>
<
Separator
mr=
{
3
}
ml=
{
{
base
:
2
,
sm
:
3
}
}
height=
{
4
}
orientation=
"vertical"
/>
<
Separator
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
'
}
}
>
...
...
ui/snippets/topBar/settings/Settings.tsx
View file @
a65cca1d
...
@@ -25,7 +25,7 @@ const Settings = () => {
...
@@ -25,7 +25,7 @@ const Settings = () => {
visual=
"plain"
visual=
"plain"
color=
"link.primary"
color=
"link.primary"
_hover=
{
{
color
:
'
link.primary.hover
'
}
}
_hover=
{
{
color
:
'
link.primary.hover
'
}
}
borderRadius=
"
none
"
borderRadius=
"
sm
"
aria
-
label=
"User settings"
aria
-
label=
"User settings"
>
>
<
IconSvg
name=
"gear_slim"
boxSize=
{
5
}
p=
"1px"
/>
<
IconSvg
name=
"gear_slim"
boxSize=
{
5
}
p=
"1px"
/>
...
...
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