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
21282a71
Commit
21282a71
authored
Sep 13, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide account nav for unauth users
parent
6830dc22
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
20 deletions
+36
-20
Burger.tsx
ui/blocks/header/Burger.tsx
+1
-1
NavFooter.tsx
ui/blocks/navigation/NavFooter.tsx
+11
-2
NavigationDesktop.tsx
ui/blocks/navigation/NavigationDesktop.tsx
+14
-11
NavigationMobile.tsx
ui/blocks/navigation/NavigationMobile.tsx
+10
-6
No files found.
ui/blocks/header/Burger.tsx
View file @
21282a71
...
@@ -39,7 +39,7 @@ const Burger = () => {
...
@@ -39,7 +39,7 @@ const Burger = () => {
>
>
<
DrawerOverlay
/>
<
DrawerOverlay
/>
<
DrawerContent
maxWidth=
"260px"
>
<
DrawerContent
maxWidth=
"260px"
>
<
DrawerBody
p=
{
6
}
>
<
DrawerBody
p=
{
6
}
display=
"flex"
flexDirection=
"column"
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
>
<
NetworkLogo
onClick=
{
handleNetworkLogoClick
}
/>
<
NetworkLogo
onClick=
{
handleNetworkLogoClick
}
/>
<
NetworkMenuButton
<
NetworkMenuButton
...
...
ui/blocks/navigation/NavFooter.tsx
View file @
21282a71
...
@@ -20,9 +20,10 @@ const VERSION_URL = `https://github.com/blockscout/blockscout/tree/${ BLOCKSCOUT
...
@@ -20,9 +20,10 @@ const VERSION_URL = `https://github.com/blockscout/blockscout/tree/${ BLOCKSCOUT
interface
Props
{
interface
Props
{
isCollapsed
?:
boolean
;
isCollapsed
?:
boolean
;
isAuth
?:
boolean
;
}
}
const
NavFooter
=
({
isCollapsed
}:
Props
)
=>
{
const
NavFooter
=
({
isCollapsed
,
isAuth
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
width
=
(()
=>
{
const
width
=
(()
=>
{
...
@@ -33,6 +34,14 @@ const NavFooter = ({ isCollapsed }: Props) => {
...
@@ -33,6 +34,14 @@ const NavFooter = ({ isCollapsed }: Props) => {
return
isCollapsed
?
'
20px
'
:
'
180px
'
;
return
isCollapsed
?
'
20px
'
:
'
180px
'
;
})();
})();
const
marginTop
=
(()
=>
{
if
(
!
isAuth
)
{
return
'
auto
'
;
}
return
isMobile
?
6
:
20
;
})();
return
(
return
(
<
VStack
<
VStack
as=
"footer"
as=
"footer"
...
@@ -41,7 +50,7 @@ const NavFooter = ({ isCollapsed }: Props) => {
...
@@ -41,7 +50,7 @@ const NavFooter = ({ isCollapsed }: Props) => {
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
width=
{
width
}
width=
{
width
}
paddingTop=
{
isMobile
?
6
:
8
}
paddingTop=
{
isMobile
?
6
:
8
}
marginTop=
{
isMobile
?
6
:
20
}
marginTop=
{
marginTop
}
alignItems=
"flex-start"
alignItems=
"flex-start"
alignSelf=
"center"
alignSelf=
"center"
color=
"gray.500"
color=
"gray.500"
...
...
ui/blocks/navigation/NavigationDesktop.tsx
View file @
21282a71
...
@@ -17,15 +17,16 @@ const NavigationDesktop = () => {
...
@@ -17,15 +17,16 @@ const NavigationDesktop = () => {
const
{
mainNavItems
,
accountNavItems
}
=
useNavItems
();
const
{
mainNavItems
,
accountNavItems
}
=
useNavItems
();
const
isLargeScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
isLargeScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
cookieValue
=
cookies
.
get
(
cookies
.
NAMES
.
NAV_BAR_COLLAPSED
);
const
navBarCollapsedCookie
=
cookies
.
get
(
cookies
.
NAMES
.
NAV_BAR_COLLAPSED
);
const
isAuth
=
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
));
const
[
isCollapsed
,
setCollapsedState
]
=
React
.
useState
(
cookieValu
e
===
'
true
'
);
const
[
isCollapsed
,
setCollapsedState
]
=
React
.
useState
(
navBarCollapsedCooki
e
===
'
true
'
);
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
if
(
!
cookieValu
e
)
{
if
(
!
navBarCollapsedCooki
e
)
{
setCollapsedState
(
!
isLargeScreen
);
setCollapsedState
(
!
isLargeScreen
);
}
}
},
[
isLargeScreen
,
cookieValu
e
]);
},
[
isLargeScreen
,
navBarCollapsedCooki
e
]);
const
handleTogglerClick
=
React
.
useCallback
(()
=>
{
const
handleTogglerClick
=
React
.
useCallback
(()
=>
{
setCollapsedState
((
flag
)
=>
!
flag
);
setCollapsedState
((
flag
)
=>
!
flag
);
...
@@ -70,13 +71,15 @@ const NavigationDesktop = () => {
...
@@ -70,13 +71,15 @@ const NavigationDesktop = () => {
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
<
Box
as=
"nav"
mt=
{
12
}
>
{
isAuth
&&
(
<
VStack
as=
"ul"
spacing=
"2"
alignItems=
"flex-start"
overflow=
"hidden"
>
<
Box
as=
"nav"
mt=
{
12
}
>
{
accountNavItems
.
map
((
item
)
=>
<
VStack
as=
"ul"
spacing=
"2"
alignItems=
"flex-start"
overflow=
"hidden"
>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
{
accountNavItems
.
map
((
item
)
=>
</
VStack
>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
</
Box
>
</
VStack
>
<
NavFooter
isCollapsed=
{
isCollapsed
}
/>
</
Box
>
)
}
<
NavFooter
isCollapsed=
{
isCollapsed
}
isAuth=
{
isAuth
}
/>
<
ChevronLeftIcon
<
ChevronLeftIcon
width=
{
6
}
width=
{
6
}
height=
{
6
}
height=
{
6
}
...
...
ui/blocks/navigation/NavigationMobile.tsx
View file @
21282a71
...
@@ -2,6 +2,7 @@ import { Box, VStack } from '@chakra-ui/react';
...
@@ -2,6 +2,7 @@ import { Box, VStack } from '@chakra-ui/react';
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
useNavItems
from
'
lib/hooks/useNavItems
'
;
import
useNavItems
from
'
lib/hooks/useNavItems
'
;
import
NavFooter
from
'
ui/blocks/navigation/NavFooter
'
;
import
NavFooter
from
'
ui/blocks/navigation/NavFooter
'
;
import
NavLink
from
'
ui/blocks/navigation/NavLink
'
;
import
NavLink
from
'
ui/blocks/navigation/NavLink
'
;
...
@@ -9,6 +10,7 @@ import NavLink from 'ui/blocks/navigation/NavLink';
...
@@ -9,6 +10,7 @@ import NavLink from 'ui/blocks/navigation/NavLink';
const
NavigationMobile
=
()
=>
{
const
NavigationMobile
=
()
=>
{
const
{
mainNavItems
,
accountNavItems
}
=
useNavItems
();
const
{
mainNavItems
,
accountNavItems
}
=
useNavItems
();
const
router
=
useRouter
();
const
router
=
useRouter
();
const
isAuth
=
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
));
return
(
return
(
<>
<>
...
@@ -17,12 +19,14 @@ const NavigationMobile = () => {
...
@@ -17,12 +19,14 @@ const NavigationMobile = () => {
{
mainNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
{
mainNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
<
Box
as=
"nav"
mt=
{
6
}
>
{
isAuth
&&
(
<
VStack
as=
"ul"
spacing=
"2"
alignItems=
"flex-start"
overflow=
"hidden"
>
<
Box
as=
"nav"
mt=
{
6
}
>
{
accountNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
<
VStack
as=
"ul"
spacing=
"2"
alignItems=
"flex-start"
overflow=
"hidden"
>
</
VStack
>
{
accountNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isActive=
{
router
.
asPath
.
startsWith
(
item
.
pathname
)
}
/>)
}
</
Box
>
</
VStack
>
<
NavFooter
/>
</
Box
>
)
}
<
NavFooter
isAuth=
{
isAuth
}
/>
</>
</>
);
);
};
};
...
...
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