diff --git a/apps/web/src/components/Sidebar/Sidebar.tsx b/apps/web/src/components/Sidebar/Sidebar.tsx index 49cb61970..f74a5e33b 100644 --- a/apps/web/src/components/Sidebar/Sidebar.tsx +++ b/apps/web/src/components/Sidebar/Sidebar.tsx @@ -1,3 +1,5 @@ +import { useState } from 'react'; + import { toBasicISOString, toLowerCase } from '@douglasneuroinformatics/libjs'; import { Button, Dialog, LanguageToggle, ThemeToggle } from '@douglasneuroinformatics/libui/components'; import { useTranslation } from '@douglasneuroinformatics/libui/hooks'; @@ -14,6 +16,8 @@ import { NavButton } from '../NavButton'; import { UserDropup } from '../UserDropup'; export const Sidebar = () => { + const [isEndSessionModalOpen, setIsEndSessionModalOpen] = useState(false); + const navItems = useNavItems(); const currentSession = useAppStore((store) => store.currentSession); const endSession = useAppStore((store) => store.endSession); @@ -43,7 +47,7 @@ export const Sidebar = () => { /> ))} {i === navItems.length - 1 && ( - + { className="min-w-20" onClick={() => { endSession(); - void navigate({ to: '/session/start-session' }); + void navigate({ to: '/session/start-session' }).then(() => { + setIsEndSessionModalOpen(false); + }); }} > {t('core.yes')} - diff --git a/apps/web/src/routes/_app/instruments/render/$id.tsx b/apps/web/src/routes/_app/instruments/render/$id.tsx index 03e88c70e..a642d6f42 100644 --- a/apps/web/src/routes/_app/instruments/render/$id.tsx +++ b/apps/web/src/routes/_app/instruments/render/$id.tsx @@ -38,7 +38,7 @@ const RouteComponent = () => { const handleSubmit: InstrumentSubmitHandler = async ({ data, instrumentId }) => { await axios.post('/v1/instrument-records', { data, - date: new Date(), + date: currentSession!.date, groupId: currentGroup?.id, instrumentId, sessionId: currentSession!.id, diff --git a/apps/web/src/routes/_app/session/start-session.tsx b/apps/web/src/routes/_app/session/start-session.tsx index 485ea8053..f06869076 100644 --- a/apps/web/src/routes/_app/session/start-session.tsx +++ b/apps/web/src/routes/_app/session/start-session.tsx @@ -60,24 +60,24 @@ const RouteComponent = () => {
- {currentSession !== null && ( - -
- -

- {t({ - en: 'The current session must be ended before starting the form again.', - fr: 'La session en cours doit être terminée avant de recommencer le formulaire.' - })} -

-
-
- )} + + +
+ {t({ en: 'Session Successfully Started', fr: 'Session démarrée avec succès' })} +
+

+ {t({ + en: 'Please note that you must end the current session before completing this form again.', + fr: 'Veuillez noter que vous devez mettre fin à la session en cours avant de remplir à nouveau ce formulaire.' + })} +

+
)} diff --git a/package.json b/package.json index f64af8d41..34237a443 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "opendatacapture", "type": "module", - "version": "1.12.4", + "version": "1.13.0", "private": true, "packageManager": "pnpm@10.7.0", "license": "Apache-2.0",