@@ -43,16 +43,20 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
4343 dispatch ( fetchChatHistoryListRequest ( ) ) ;
4444 } , [ dispatch ] ) ;
4545
46-
4746 function handleClick ( path : string ) {
48- setShowInnerComponent ( true ) ;
47+ setTimeout ( ( ) => {
48+ setShowInnerComponent ( true ) ;
49+ } , 1000 )
50+
4951 Router . push ( path ) ;
5052 }
5153
54+
5255 const logoutFuc = async ( ) => {
5356 await logout ( ) ;
5457 dispatch ( resetLoginOtpState ( ) ) ;
5558 dispatch ( loginReset ( ) ) ;
59+ setShowInnerComponent ( true ) ;
5660 localStorage . removeItem ( 'isLogin' ) ;
5761 localStorage . removeItem ( 'userProfile' ) ;
5862 Router . push ( '/' ) ;
@@ -83,19 +87,10 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
8387 < div className = { 'w-full h-3 bg-secondary-02' } />
8488 < ul >
8589 < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
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- }
90+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/chat' ) } >
91+ < Icons name = { 'profile-faq' } />
92+ < p className = { 'ml-3' } > chat</ p >
93+ </ a >
9994 < Icons name = { 'direction-left-gray' } />
10095 </ li >
10196
@@ -113,91 +108,49 @@ const Menu = ({ currentPath, setShowInnerComponent }: { currentPath: string, set
113108 < ul className = "pl-8 space-y-1 max-h-40 overflow-y-auto" onScroll = { handleScroll } >
114109 { chatHistory . map ( ( chat : any ) => (
115110 < li key = { chat . id } >
116-
117111 < a
118112 href = { `/chat/history/${ chat . id } ` }
119113 className = { `block px-4 py-2 hover:bg-primary-02 hover:text-primary ${ currentPath . includes ( chat . id ) ? 'bg-primary-01 text-primary' : '' } ` }
120114 >
121115 { chat . title } - { new Date ( chat . date ) . toLocaleDateString ( ) }
122116 </ a >
123-
124117 </ li >
125118 ) ) }
126119 </ ul >
127120 ) }
128121
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- ) }
167- < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
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 >
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 >
174137 </ 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- }
138+ < Icons name = { 'direction-left-gray' } />
139+ </ li >
140+ : ''
141+ }
142+ < 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 >
183147 < Icons name = { 'direction-left-gray' } />
184148 </ li >
185149 < li className = { 'flex justify-between p-4 border-b-2 border-secondary-02 cursor-pointer' } >
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- }
150+ < a className = { 'flex flex-1' } onClick = { ( ) => handleClick ( '/security' ) } >
151+ < Icons name = { 'profile-security' } />
152+ < p className = { 'ml-3' } > Security</ p >
153+ </ a >
201154 < Icons name = { 'direction-left-gray' } />
202155 </ li >
203156
0 commit comments