Skip to content

Commit 1f936a3

Browse files
committed
feat: add card to state session is active
1 parent 12f7ee3 commit 1f936a3

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

apps/web/src/routes/_app/session/start-session.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,28 @@ const RouteComponent = () => {
4141
{t('startSession')}
4242
</Heading>
4343
</PageHeader>
44-
<StartSessionForm
45-
currentGroup={currentGroup}
46-
initialValues={initialValues}
47-
readOnly={currentSession !== null || createSessionMutation.isPending}
48-
username={currentUser?.username}
49-
onSubmit={async (formData) => {
50-
const session = await createSessionMutation.mutateAsync(formData);
51-
startSession({ ...session, type: formData.type });
52-
}}
53-
/>
44+
<div className="space-y-4">
45+
<StartSessionForm
46+
currentGroup={currentGroup}
47+
initialValues={initialValues}
48+
readOnly={currentSession !== null || createSessionMutation.isPending}
49+
username={currentUser?.username}
50+
onSubmit={async (formData) => {
51+
const session = await createSessionMutation.mutateAsync(formData);
52+
startSession({ ...session, type: formData.type });
53+
}}
54+
/>
55+
{currentSession !== null && (
56+
<div className="mx-auto block max-w-3xl rounded-lg border border-gray-200 bg-white p-6 opacity-75 shadow-sm dark:border-gray-700 dark:bg-gray-800">
57+
<p className="max-w-4xl text-center text-yellow-600 dark:text-yellow-300">
58+
{t({
59+
en: 'The current session must be ended before starting the form again',
60+
fr: 'La session en cours doit être terminée avant de recommencer le formulaire.'
61+
})}
62+
</p>
63+
</div>
64+
)}
65+
</div>
5466
</React.Fragment>
5567
);
5668
};

0 commit comments

Comments
 (0)