From 9bf9b9ea41de30f7972e65a4ae52fd11b905b19f Mon Sep 17 00:00:00 2001 From: ddemirta Date: Mon, 30 Oct 2023 20:11:32 -0700 Subject: [PATCH 1/5] No location sections are fixed --- .../components/course/CreateSectionModal.tsx | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/csm_web/frontend/src/components/course/CreateSectionModal.tsx b/csm_web/frontend/src/components/course/CreateSectionModal.tsx index cc614ec3..91d45f28 100644 --- a/csm_web/frontend/src/components/course/CreateSectionModal.tsx +++ b/csm_web/frontend/src/components/course/CreateSectionModal.tsx @@ -46,6 +46,8 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre */ const [capacity, setCapacity] = useState(""); + const [alertMessage, setAlertMessage] = useState(null) + /** * Create a new empty spacetime for the new section. */ @@ -87,10 +89,15 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre } }; - /** - * Handle form submission. - */ + const hasEmptyLocation = () => { + return spacetimes.some(spacetime => !spacetime.location?.trim()); + }; + + const handleSubmit = (event: React.MouseEvent): void => { + + + event.preventDefault(); const data = { mentorEmail, @@ -100,6 +107,9 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre courseId }; + + + createSectionMutation.mutate(data, { onSuccess: () => { closeModal(); @@ -110,6 +120,11 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre return ( + {alertMessage && ( +
+ {alertMessage} +
+)}
@@ -219,7 +234,7 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre -
From a61289ae0d44d89cc1e2ee5ea5a14d761dd8c482 Mon Sep 17 00:00:00 2001 From: ddemirta Date: Mon, 13 Nov 2023 19:35:07 -0800 Subject: [PATCH 2/5] pre-commit error fixed --- .../src/components/course/CreateSectionModal.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/csm_web/frontend/src/components/course/CreateSectionModal.tsx b/csm_web/frontend/src/components/course/CreateSectionModal.tsx index 91d45f28..ae3e0ea5 100644 --- a/csm_web/frontend/src/components/course/CreateSectionModal.tsx +++ b/csm_web/frontend/src/components/course/CreateSectionModal.tsx @@ -46,8 +46,6 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre */ const [capacity, setCapacity] = useState(""); - const [alertMessage, setAlertMessage] = useState(null) - /** * Create a new empty spacetime for the new section. */ @@ -108,8 +106,6 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre }; - - createSectionMutation.mutate(data, { onSuccess: () => { closeModal(); @@ -120,11 +116,6 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre return ( - {alertMessage && ( -
- {alertMessage} -
-)}
From 9ee33de258a2edef613cd009f7f38f5b6f54bb2b Mon Sep 17 00:00:00 2001 From: ddemirta Date: Mon, 13 Nov 2023 19:45:46 -0800 Subject: [PATCH 3/5] pre-commit error fix2 --- csm_web/frontend/src/components/course/CreateSectionModal.tsx | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/csm_web/frontend/src/components/course/CreateSectionModal.tsx b/csm_web/frontend/src/components/course/CreateSectionModal.tsx index ae3e0ea5..b744e300 100644 --- a/csm_web/frontend/src/components/course/CreateSectionModal.tsx +++ b/csm_web/frontend/src/components/course/CreateSectionModal.tsx @@ -231,4 +231,4 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre
); -}; +}; \ No newline at end of file diff --git a/package.json b/package.json index 2cd4567e..42027744 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "csm_web", "version": "1.0.0", - "description": "", + "description": "This repository contains webapps that help support the infrastructure of CSM. Currently, it only holds Scheduler (our section signup and attendance system), but more are on the way.", "main": "index.tsx", "scripts": { "dev": "webpack --mode development", From d6a2a1d0113333190f445508fed02d200eb8843f Mon Sep 17 00:00:00 2001 From: ddemirta Date: Mon, 13 Nov 2023 19:50:56 -0800 Subject: [PATCH 4/5] pre-commit error fix2 --- .../frontend/src/components/course/CreateSectionModal.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/csm_web/frontend/src/components/course/CreateSectionModal.tsx b/csm_web/frontend/src/components/course/CreateSectionModal.tsx index b744e300..ebf129c0 100644 --- a/csm_web/frontend/src/components/course/CreateSectionModal.tsx +++ b/csm_web/frontend/src/components/course/CreateSectionModal.tsx @@ -91,11 +91,7 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre return spacetimes.some(spacetime => !spacetime.location?.trim()); }; - const handleSubmit = (event: React.MouseEvent): void => { - - - event.preventDefault(); const data = { mentorEmail, @@ -105,7 +101,6 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre courseId }; - createSectionMutation.mutate(data, { onSuccess: () => { closeModal(); @@ -231,4 +226,4 @@ export const CreateSectionModal = ({ courseId, closeModal, reloadSections }: Cre
); -}; \ No newline at end of file +}; From dd5e22bebec95f848c5f00ed874bc88ccef6efe2 Mon Sep 17 00:00:00 2001 From: Eric Che Date: Mon, 13 Nov 2023 20:09:01 -0800 Subject: [PATCH 5/5] a