@@ -24,7 +24,7 @@ import {
24
24
} from '@tabler/icons-react' ;
25
25
import { FC , useEffect } from 'react' ;
26
26
import { useNavbarStyles } from './styles' ;
27
- import { useParams } from 'react-router-dom' ;
27
+ import { useLocation , useParams } from 'react-router-dom' ;
28
28
import { useGetLogStreamList } from '@/hooks/useGetLogStreamList' ;
29
29
import { notifications } from '@mantine/notifications' ;
30
30
import { useNavigate } from 'react-router-dom' ;
@@ -48,6 +48,7 @@ type NavbarProps = Omit<MantineNavbarProps, 'children'>;
48
48
const Navbar : FC < NavbarProps > = ( props ) => {
49
49
const navigate = useNavigate ( ) ;
50
50
const { streamName } = useParams ( ) ;
51
+ const location = useLocation ( ) ;
51
52
52
53
const [ username ] = useLocalStorage ( { key : 'username' , getInitialValueInEffect : false } ) ;
53
54
const [ , , removeCredentials ] = useLocalStorage ( { key : 'credentials' } ) ;
@@ -65,7 +66,7 @@ const Navbar: FC<NavbarProps> = (props) => {
65
66
66
67
const [ disableLink , setDisableLink ] = useMountedState ( false ) ;
67
68
const [ isSubNavbarOpen , setIsSubNavbarOpen ] = useMountedState ( false ) ;
68
- const [ opened , { open, close } ] = useDisclosure ( true ) ;
69
+ const [ opened , { open, close } ] = useDisclosure ( false ) ;
69
70
const [ openedDelete , { close : closeDelete , open : openDelete } ] = useDisclosure ( ) ;
70
71
71
72
const { data : streams , error, getData, resetData : resetStreamArray } = useGetLogStreamList ( ) ;
@@ -94,6 +95,9 @@ const Navbar: FC<NavbarProps> = (props) => {
94
95
} = useHeaderContext ( ) ;
95
96
96
97
useEffect ( ( ) => {
98
+ if ( location . pathname . split ( '/' ) [ 2 ] ) {
99
+ setCurrentPage ( `/${ location . pathname . split ( '/' ) [ 2 ] } ` ) ;
100
+ }
97
101
if ( streams && streams . length === 0 ) {
98
102
setActiveStream ( '' ) ;
99
103
setSearchValue ( '' ) ;
@@ -204,7 +208,8 @@ const Navbar: FC<NavbarProps> = (props) => {
204
208
setCurrentPage ( link . pathname ) ;
205
209
} }
206
210
key = { link . label }
207
- className = { ( currentPage === link . pathname && linkBtnActive ) || linkBtn }
211
+
212
+ className = { ( currentPage === link . pathname && linkBtnActive ) || linkBtn }
208
213
/>
209
214
) ;
210
215
} ) }
0 commit comments