diff --git a/backend/yarn.lock b/backend/yarn.lock
index 30806eb13..e84566ec3 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -6816,9 +6816,9 @@ widest-line@^3.1.0:
string-width "^4.0.0"
word-wrap@^1.2.3, word-wrap@~1.2.3:
- version "1.2.3"
- resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
- integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
+ version "1.2.5"
+ resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
+ integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
wrap-ansi@^5.1.0:
version "5.1.0"
diff --git a/client/src/api/ProjectApiService.js b/client/src/api/ProjectApiService.js
index b97e88cf2..12f4e0763 100644
--- a/client/src/api/ProjectApiService.js
+++ b/client/src/api/ProjectApiService.js
@@ -27,24 +27,20 @@ class ProjectApiService {
name,
description,
location,
- githubIdentifier,
githubUrl,
slackUrl,
googleDriveUrl,
- hflaWebsiteUrl,
} = projectData;
const requestOptions = {
method: 'POST',
headers: this.headers,
body: JSON.stringify({
- name: name,
- description: description,
- location: location,
- githubIdentifier: githubIdentifier,
- githubUrl: githubUrl,
- slackUrl: slackUrl,
- googleDriveUrl: googleDriveUrl,
- hflaWebsiteUrl: hflaWebsiteUrl,
+ name,
+ description,
+ location,
+ githubUrl,
+ slackUrl,
+ googleDriveUrl,
projectStatus: 'Active',
}),
};
diff --git a/client/src/components/ProjectForm.js b/client/src/components/ProjectForm.js
index e9cd58532..47c70aa61 100644
--- a/client/src/components/ProjectForm.js
+++ b/client/src/components/ProjectForm.js
@@ -1,8 +1,8 @@
import React, { useState, useEffect } from 'react';
import { Link, useHistory } from 'react-router-dom';
+import { useForm } from 'react-hook-form';
import ProjectApiService from '../api/ProjectApiService';
import { ReactComponent as PlusIcon } from '../svg/PlusIcon.svg';
-
import {
Typography,
Box,
@@ -16,7 +16,6 @@ import {
FormControlLabel,
RadioGroup,
} from '@mui/material';
-
import { styled } from '@mui/material/styles';
/** Project Form Component
@@ -41,7 +40,12 @@ const simpleInputs = [
label: 'Location',
name: 'location',
type: 'text',
- placeholder: 'Enter project location',
+ placeholder: 'Enter location for meeting',
+ value: /https:\/\/[\w-]*\.?zoom.us\/(j|my)\/[\d\w?=-]+/,
+ errorMessage: 'Please enter a valid Zoom URL',
+ addressValue: '',
+ addressError: 'Invalid address'
+
},
// Leaving incase we want to add this back in for updating projects
// {
@@ -54,7 +58,7 @@ const simpleInputs = [
label: 'GitHub URL',
name: 'githubUrl',
type: 'text',
- placeholder: 'htttps://github.com/',
+ placeholder: 'htttps://github.com/'
},
{
label: 'Slack Channel Link',
@@ -104,24 +108,22 @@ const StyledRadio = styled(Radio)(({ theme }) => ({
*/
export default function ProjectForm() {
- const [formData, setFormData] = useState({
- name: '',
- description: '',
- location: '',
- // githubIdentifier: '',
- githubUrl: '',
- slackUrl: '',
- googleDriveUrl: '',
- // hflaWebsiteUrl: '',
- });
-
//seperate state for the location radio buttons
const [locationType, setLocationType] = React.useState('remote');
-
const [activeButton, setActiveButton] = React.useState('close');
-
const [newlyCreatedID, setNewlyCreatedID] = useState(null);
const history = useHistory();
+ const { register, handleSubmit, formState: { errors } } = useForm({
+ mode: 'all',
+ defaultValues: {
+ name: '',
+ description: '',
+ location: '',
+ githubUrl: '',
+ slackUrl: '',
+ googleDriveUrl: ''
+ }
+ });
const routeToNewProjectPage = () => {
if(newlyCreatedID !== null) {
@@ -129,35 +131,19 @@ export default function ProjectForm() {
}
}
-
useEffect(() => {
routeToNewProjectPage()
},[newlyCreatedID])
-
-
// only handles radio button change
const handleRadioChange = (event) => {
setLocationType(event.target.value);
};
- //updates state of formData onChange of any form input
- const handleChange = (e) => {
- const { name, value } = e.target;
-
- setFormData((fData) => ({
- ...fData,
- [name]: value,
- }));
- };
-
- const handleSubmit = async (e) => {
- e.preventDefault();
+ const submitForm = async (data) => {
const projectApi = new ProjectApiService();
try {
- // fires POST request to create a new project,
- // but the server response does not include the newly created project id that we need
- const id = await projectApi.create(formData);
+ const id = await projectApi.create(data);
setNewlyCreatedID(id);
} catch (errors) {
console.error(errors);
@@ -166,15 +152,6 @@ export default function ProjectForm() {
setActiveButton('close');
};
- // Basic validation : if all inputs have values, enable the submit button
- useEffect(() => {
- if (Object.values(formData).every((val) => val !== '')) {
- setActiveButton('save');
- } else {
- setActiveButton('close');
- }
- }, [formData]);
-
const locationRadios = (
@@ -223,7 +200,9 @@ export default function ProjectForm() {
-
-
+
))}
@@ -277,7 +240,6 @@ export default function ProjectForm() {
type="submit"
form="project-form"
variant={activeButton === 'save' ? 'contained' : 'secondary'}
- disabled={activeButton !== 'save'}
>
Save
diff --git a/client/src/components/auth/Auth.js b/client/src/components/auth/Auth.js
index 8a153ecb7..eda330db9 100644
--- a/client/src/components/auth/Auth.js
+++ b/client/src/components/auth/Auth.js
@@ -46,7 +46,7 @@ const Auth = () => {
const isEmailValid = validateEmail();
if (isEmailValid) {
- const userData = await checkUser(email, LOG_IN);
+ const userData = await checkUser(email.toLowerCase(), LOG_IN);
if (userData) {
if (
userData.user.accessLevel !== ADMIN &&
@@ -59,7 +59,7 @@ const Auth = () => {
return;
}
- const isAuth = await checkAuth(email, LOG_IN);
+ const isAuth = await checkAuth(email.toLowerCase(), LOG_IN);
if (isAuth) {
history.push('/emailsent');
} else {
diff --git a/client/src/pages/CheckInForm.js b/client/src/pages/CheckInForm.js
index 2456c7512..f437a171e 100644
--- a/client/src/pages/CheckInForm.js
+++ b/client/src/pages/CheckInForm.js
@@ -237,7 +237,6 @@ const CheckInForm = (props) => {
setErrorMessage(error);
setIsLoading(false);
}
- // }
};
const submitNewProfile = (userForm) => {
diff --git a/client/yarn.lock b/client/yarn.lock
index a862e5300..1d10c3bde 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -12816,9 +12816,9 @@ which@^2.0.1:
isexe "^2.0.0"
word-wrap@~1.2.3:
- version "1.2.3"
- resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
- integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
+ version "1.2.5"
+ resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
+ integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
workbox-background-sync@^4.3.1:
version "4.3.1"