diff --git a/apps/frontend/src/components/volunteer/signup/SignUpPage.tsx b/apps/frontend/src/components/volunteer/signup/SignUpPage.tsx
index a26f1b5c..77bd072a 100644
--- a/apps/frontend/src/components/volunteer/signup/SignUpPage.tsx
+++ b/apps/frontend/src/components/volunteer/signup/SignUpPage.tsx
@@ -6,21 +6,18 @@ import {
VStack,
Button,
IconButton,
- FormLabel,
- FormControl,
- FormErrorMessage,
- SimpleGrid,
- Center,
+ Textarea,
} from '@chakra-ui/react';
import { Checkbox } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
-import React, { useState } from 'react';
+import React from 'react';
import { useNavigate } from 'react-router-dom';
import CircleIcon from '@mui/icons-material/Circle';
import CircleOutlinedIcon from '@mui/icons-material/CircleOutlined';
import { Formik, Form, Field } from 'formik';
import * as Yup from 'yup';
+// ns-add-group-signup interfaces and maps
interface InputField {
label: string;
width?: string;
@@ -33,29 +30,52 @@ interface CheckboxField {
interface InputFieldGroup {
fields: InputField[];
- type?: 'single' | 'double'; // 'single' for single column, 'double' for double column row
+ type?: 'single' | 'double';
height: string;
width: string;
}
-interface FormField {
- label: string;
- type: string;
-}
-interface FormFields {
- [key: string]: FormField;
-}
-const termsAndConditionsCheckboxesMap: CheckboxField[] = [
+const personalInfoCheckboxesMap: CheckboxField[] = [
+ { label: 'Signing up as a group representative?' },
+];
+
+const personalInfoInputFieldsMap: InputFieldGroup[] = [
{
- label: 'I have reviewed the General Safety Guidelines',
+ fields: [
+ { label: 'First Name', width: '250px' },
+ { label: 'Last Name', width: '350px' },
+ ],
+ type: 'double',
+ height: '40px',
+ width: '810px',
},
{
- label: 'I have read and agree to the Terms of Use and Privacy Policy',
+ fields: [{ label: 'Email Address' }],
+ type: 'single',
+ height: '40px',
+ width: '380px',
},
{
- label: 'I have read and agree to the Release of Liability',
+ fields: [{ label: 'Phone Number' }],
+ type: 'single',
+ height: '40px',
+ width: '380px',
},
+ {
+ fields: [{ label: 'Birth Year' }],
+ type: 'single',
+ height: '40px',
+ width: '100px',
+ },
+];
+
+const termsAndConditionsCheckboxesMap: CheckboxField[] = [
+ { label: 'I have reviewed the General Safety Guidelines' },
+ { label: 'I have read and agree to the Terms of Use and Privacy Policy' },
+ { label: 'I have read and agree to the Release of Liability' },
];
+
+// Yup validation schema (from the form validation ticket)
const validationSchema = Yup.object({
firstname: Yup.string().required('First name is required'),
lastname: Yup.string().required('Last name is required'),
@@ -70,99 +90,212 @@ const validationSchema = Yup.object({
.max(new Date().getFullYear(), 'Invalid birth year')
.required('Birth year is required'),
groupRepresentative: Yup.boolean(),
+ // groupMembers remains optional
});
-const formFields: FormFields = {
- firstname: { label: 'First Name', type: 'text' },
- lastname: { label: 'Last Name', type: 'text' },
- email: { label: 'Email', type: 'email' },
- phone: { label: 'Phone Number', type: 'text' },
- birthyear: { label: 'Birth Year', type: 'number' },
- groupRepresentative: {
- label: 'Group representative?',
- type: 'checkbox',
- },
-};
-function PersonalInfo() {
+interface PersonalInfoProps {
+ onSubmit: (values: any) => void;
+}
+
+function PersonalInfo({ onSubmit }: PersonalInfoProps) {
return (
-
- {
- console.log(values);
- }}
- >
- {({
- errors,
- touched,
- isValid,
- dirty,
- }: {
- errors: { [key: string]: string };
- touched: { [key: string]: boolean };
- isValid: boolean;
- dirty: boolean;
- }) => (
-
- )}
-
-
-
-
-
-
-
+ {errors.groupMembers && touched.groupMembers && (
+
+ {errors.groupMembers}
+
+ )}
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
);
}
@@ -171,8 +304,8 @@ function TermsAndConditions() {
@@ -180,8 +313,7 @@ function TermsAndConditions() {
{field.label}
@@ -229,22 +355,21 @@ interface Props {
}
export default function SignUpPage({ setShowSignUp }: Props) {
- const [isSubmitted, setIsSubmitted] = useState(false); // Step 1
+ const [isSubmitted, setIsSubmitted] = React.useState(false);
const navigate = useNavigate();
const closeSignUp = () => {
setShowSignUp(false);
};
- const handleSubmit = () => {
- // You can add form validation logic here if needed
+ const handleSubmit = (values: any) => {
+ console.log(values);
setIsSubmitted(true);
- navigate('/success'); // Step 2
+ navigate('/success');
};
return (
Welcome, Volunteer!
-
- {/* Comment these in and out to display the different pop up pages */}
-
- {/* */}
+
+
-
- {/* Conditional rendering for the submit button */}
- {/* {!isSubmitted && (
-
- )} */}
-
- {/* Success message */}
- {/* {isSubmitted && (
-
-
- Thank you for submitting the form!
-
- You can add additional content for the success page
-
- )} */}
);