@@ -14,33 +14,29 @@ import {
1414import Logo from "./Logo" ;
1515import { CluserIndicator , Cluster } from "./Cluster" ;
1616import NavCollapseToggle from "../Navigation/NavCollapseToggle" ;
17- import { isNavCollapsedAtom } from "../../atoms" ;
18- import { useAtomValue } from "jotai" ;
1917import NavBlur from "../Navigation/NavBlur" ;
2018import { slotNavBackgroundColor } from "../../colors" ;
21- import { useCurrentRoute } from "../../hooks/useCurrentRoute" ;
2219import { useMemo } from "react" ;
20+ import { useSlotsNavigation } from "../../hooks/useSlotsNavigation" ;
2321
2422export default function Header ( ) {
2523 const showDropdownNav = useMedia ( "(max-width: 900px)" ) ;
2624 const isXNarrow = useMedia ( "(max-width: 401px)" ) ;
27- const isNarrow = useMedia ( "(max-width: 768px)" ) ;
28- const isNavCollapsed = useAtomValue ( isNavCollapsedAtom ) ;
2925
30- const currentRoute = useCurrentRoute ( ) ;
31- const isSchedule = currentRoute === "Schedule" ;
26+ const { isNarrowScreen , blurBackground , showNav , showOnlyEpochBar } =
27+ useSlotsNavigation ( ) ;
3228
3329 const leftBackground = useMemo ( ( ) => {
34- if ( isNavCollapsed ) return undefined ;
35- if ( isSchedule ) {
30+ if ( ! showNav ) return undefined ;
31+ if ( showOnlyEpochBar ) {
3632 // only color the epoch bar portion
3733 const width = `${ slotNavWithoutListWidth + epochThumbPadding } px` ;
3834 return `linear-gradient(to right, ${ slotNavBackgroundColor } 0px ${ width } , transparent ${ width } 100%)` ;
3935 }
4036 return slotNavBackgroundColor ;
41- } , [ isNavCollapsed , isSchedule ] ) ;
37+ } , [ showOnlyEpochBar , showNav ] ) ;
4238
43- const useExtraNarrowGap = isNavCollapsed && isXNarrow ;
39+ const useExtraNarrowGap = ! showNav && isXNarrow ;
4440 const extraNarrowGap = "3px" ;
4541
4642 return (
@@ -69,11 +65,7 @@ export default function Header() {
6965 ml = { `${ - epochThumbPadding } px` }
7066 pl = { `${ epochThumbPadding } px` }
7167 >
72- { isNarrow && isNavCollapsed && (
73- < div style = { { width : isNavCollapsed ? undefined : "0" } } >
74- < NavCollapseToggle isLarge />
75- </ div >
76- ) }
68+ { isNarrowScreen && ! showNav && < NavCollapseToggle isLarge /> }
7769 < Logo />
7870 < Cluster />
7971 </ Flex >
@@ -97,11 +89,11 @@ export default function Header() {
9789
9890 < IdentityKey />
9991
100- { isNarrow && ! isNavCollapsed && < NavBlur /> }
92+ { blurBackground && < NavBlur /> }
10193 </ Flex >
10294 </ Flex >
10395
104- { ! isNarrow && (
96+ { ! isNarrowScreen && (
10597 < div
10698 style = { {
10799 position : "relative" ,
@@ -114,7 +106,7 @@ export default function Header() {
114106 left : 0 ,
115107 } }
116108 >
117- < NavCollapseToggle isFloating = { isNavCollapsed } />
109+ < NavCollapseToggle isFloating = { ! showNav } />
118110 </ div >
119111 </ div >
120112 ) }
0 commit comments