@@ -28,7 +28,6 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
2828 if ( ! userProfileState ) {
2929 getUserProfileService ( false ) . then ( ( res : any ) => {
3030 setUserProfile ( res ) ;
31- console . log ( "User Profile:" , userProfile ) ;
3231 } ) . catch ( ( error ) => {
3332 console . error ( "Error fetching user profile:" , error ) ;
3433 } ) ;
@@ -44,15 +43,12 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
4443 dispatch ( fetchChatHistoryListRequest ( ) ) ;
4544 } , [ dispatch ] ) ;
4645
46+
4747 function handleClick ( path : string ) {
48- if ( currentPath as any === path )
49- setShowInnerComponent ( true ) ;
50- else
51- setShowInnerComponent ( true ) ;
48+ setShowInnerComponent ( true ) ;
5249 Router . push ( path ) ;
5350 }
5451
55-
5652 const logoutFuc = async ( ) => {
5753 await logout ( ) ;
5854 dispatch ( resetLoginOtpState ( ) ) ;
@@ -87,10 +83,19 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
8783 < div className = { 'w-full h-3 bg-secondary-02' } />
8884 < ul >
8985 < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
90- < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/chat' ) } >
91- < Icons name = { 'profile-faq' } />
92- < p className = { 'ml-3' } > chat</ p >
93- </ a >
86+ { currentPath === '/chat' ?
87+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/chat' ) } >
88+ < Icons name = { 'profile-faq' } />
89+ < p className = { 'ml-3' } > Chat</ p >
90+ </ a >
91+ :
92+ < Link href = "/chat" >
93+ < span className = { 'flex flex-1' } >
94+ < Icons name = { 'profile-faq' } />
95+ < p className = { 'ml-3' } > Chat</ p >
96+ </ span >
97+ </ Link >
98+ }
9499 < Icons name = { 'direction-left-gray' } />
95100 </ li >
96101
@@ -108,52 +113,94 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
108113 < ul className = "pl-8 space-y-1 max-h-40 overflow-y-auto" onScroll = { handleScroll } >
109114 { chatHistory . map ( ( chat : any ) => (
110115 < li key = { chat . id } >
116+
111117 < a
112118 href = { `/chat/history/${ chat . id } ` }
113119 className = { `block px-4 py-2 hover:bg-primary-02 hover:text-primary ${ currentPath . includes ( chat . id ) ? 'bg-primary-01 text-primary' : '' } ` }
114120 >
115121 { chat . title } - { new Date ( chat . date ) . toLocaleDateString ( ) }
116122 </ a >
123+
117124 </ li >
118125 ) ) }
119126 </ ul >
120127 ) }
121128
122- { allowedRolesManagement . includes ( role ) ?
123- < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
124- < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/management' ) } >
125- < Icons name = { 'management' } />
126- < p className = { 'ml-3' } > Management</ p >
127- </ a >
128- < Icons name = { 'direction-left-gray' } />
129- </ li >
130- : ''
131- }
132- { allowedRolesManagement . includes ( role ) ?
133- < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
134- < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/alerts' ) } >
135- < Icons name = { 'chart-live' } />
136- < p className = { 'ml-3' } > Alerts</ p >
137- </ a >
138- < Icons name = { 'direction-left-gray' } />
139- </ li >
140- : ''
141- }
129+ { allowedRolesManagement . includes ( role ) && (
130+ < >
131+ < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
132+ { currentPath === '/management' ?
133+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/management' ) } >
134+ < Icons name = { 'management' } />
135+ < p className = { 'ml-3' } > Management</ p >
136+ </ a >
137+ :
138+ < Link href = "/management" >
139+ < span className = { 'flex flex-1' } >
140+ < Icons name = { 'management' } />
141+ < p className = { 'ml-3' } > Management</ p >
142+ </ span >
143+ </ Link >
144+ }
145+
146+ < Icons name = { 'direction-left-gray' } />
147+ </ li >
148+ < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
149+
150+ { currentPath === '/alerts' ?
151+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/alerts' ) } >
152+ < Icons name = { 'chart-live' } />
153+ < p className = { 'ml-3' } > Alerts</ p >
154+ </ a >
155+ :
156+ < Link href = "/alerts" >
157+ < span className = { 'flex flex-1' } >
158+ < Icons name = { 'chart-live' } />
159+ < p className = { 'ml-3' } > Alerts</ p >
160+ </ span >
161+ </ Link >
162+ }
163+ < Icons name = { 'direction-left-gray' } />
164+ </ li >
165+ </ >
166+ ) }
142167 < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
143- < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/profile' ) } >
144- < Icons name = { 'profile-account' } />
145- < p className = { 'ml-3' } > Profle</ p >
146- </ a >
168+
169+
170+ { currentPath === '/profile' ?
171+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/profile' ) } >
172+ < Icons name = { 'profile-account' } />
173+ < p className = { 'ml-3' } > Profle</ p >
174+ </ a >
175+ :
176+ < Link href = "/profile" >
177+ < span className = { 'flex flex-1' } >
178+ < Icons name = { 'profile-account' } />
179+ < p className = { 'ml-3' } > Profile</ p >
180+ </ span >
181+ </ Link >
182+ }
147183 < Icons name = { 'direction-left-gray' } />
148184 </ li >
149185 < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
150- < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/security' ) } >
151- < Icons name = { 'profile-security' } />
152- < p className = { 'ml-3' } > Security</ p >
153- </ a >
186+
187+
188+ { currentPath === '/security' ?
189+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/security' ) } >
190+ < Icons name = { 'profile-security' } />
191+ < p className = { 'ml-3' } > Security</ p >
192+ </ a >
193+ :
194+ < Link href = "/security" >
195+ < span className = { 'flex flex-1' } >
196+ < Icons name = { 'profile-security' } />
197+ < p className = { 'ml-3' } > Security</ p >
198+ </ span >
199+ </ Link >
200+ }
154201 < Icons name = { 'direction-left-gray' } />
155202 </ li >
156-
203+
157204 < li className = { 'flex p-4 cursor-pointer' } onClick = { logoutFuc } >
158205 < Icons name = { 'profile-logout' } />
159206 < p className = { 'ml-3' } > Logout</ p >
0 commit comments