1+ import { useState } from 'react' ;
2+
13import { toBasicISOString , toLowerCase } from '@douglasneuroinformatics/libjs' ;
24import { Button , Dialog , LanguageToggle , ThemeToggle } from '@douglasneuroinformatics/libui/components' ;
35import { useTranslation } from '@douglasneuroinformatics/libui/hooks' ;
@@ -14,6 +16,8 @@ import { NavButton } from '../NavButton';
1416import { UserDropup } from '../UserDropup' ;
1517
1618export const Sidebar = ( ) => {
19+ const [ isEndSessionModalOpen , setIsEndSessionModalOpen ] = useState ( false ) ;
20+
1721 const navItems = useNavItems ( ) ;
1822 const currentSession = useAppStore ( ( store ) => store . currentSession ) ;
1923 const endSession = useAppStore ( ( store ) => store . endSession ) ;
@@ -43,7 +47,7 @@ export const Sidebar = () => {
4347 />
4448 ) ) }
4549 { i === navItems . length - 1 && (
46- < Dialog >
50+ < Dialog open = { isEndSessionModalOpen } onOpenChange = { setIsEndSessionModalOpen } >
4751 < Dialog . Trigger asChild >
4852 < NavButton
4953 disabled = { currentSession === null }
@@ -63,12 +67,19 @@ export const Sidebar = () => {
6367 className = "min-w-20"
6468 onClick = { ( ) => {
6569 endSession ( ) ;
66- void navigate ( { to : '/session/start-session' } ) ;
70+ void navigate ( { to : '/session/start-session' } ) . then ( ( ) => {
71+ setIsEndSessionModalOpen ( false ) ;
72+ } ) ;
6773 } }
6874 >
6975 { t ( 'core.yes' ) }
7076 </ Button >
71- < Button className = "min-w-20" variant = "outline" >
77+ < Button
78+ className = "min-w-20"
79+ type = "button"
80+ variant = "outline"
81+ onClick = { ( ) => setIsEndSessionModalOpen ( false ) }
82+ >
7283 { t ( 'core.no' ) }
7384 </ Button >
7485 </ Dialog . Footer >
0 commit comments