Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signup page #4

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ testem.log
.DS_Store
Thumbs.db

# api keys
.env
2 changes: 1 addition & 1 deletion apps/frontend/src/app/firebase/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const settings = {
};

const firebaseConfig = {
apiKey: "AIzaSyBBiN0i2T47tZkQmVwRcp7TAdtKESP5aQ8",
apiKey: process.env.SECRET,
authDomain: "wol-planner-7e216.firebaseapp.com",
databaseURL: "https://wol-planner-7e216-default-rtdb.firebaseio.com",
projectId: "wol-planner-7e216",
Expand Down
142 changes: 99 additions & 43 deletions apps/frontend/src/app/views/signup/SignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,119 @@
import React, { useState } from "react"
import React, { useState, useContext, useEffect } from "react"
import "./signup.css"
import loginListThreeFilled from "../../images/logos/loginListThreeFilled.svg"
import loginVector from "../../images/logos/loginVector.svg"
import loginCrystalBall from "../../images/logos/loginCrystalBall.svg"
import loginGroup103 from "../../images/logos/loginGroup103.svg"
import { createUserWithEmailAndPassword } from "firebase/auth"
import { auth } from "../../firebase/firebase"
import { useNavigate } from 'react-router-dom';
import { AuthLayout } from '../../components/authlayout/AuthLayout';

export const SignUp = () => {

const [isDisabled, setIsDisabled] = React.useState(true)
const [authError, setAuthError] = React.useState("")
const [emailError, setEmailError] = React.useState(true)
const navigate = useNavigate()
const [firstName, setFirstName] = React.useState('')
const [lastName, setLastName] = React.useState('')
const [username, setUsername] = React.useState('')
const [email, setEmail] = React.useState('')
const [password, setPassword] = React.useState('')
const [inputError, setInputError] = React.useState(false)

// const emailRegex = new RegExp(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)
// if(!emailRegex.test(email)) {
// setEmailError(true)
// } else {
// setEmailError(false)
// }

useEffect(() => {
const emailRegex = new RegExp(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/);
if (!emailRegex.test(email)) {
setEmailError(true)
} else {
setEmailError(false)
}
})
const createUser = async () => {
if(firstName.length < 1 || lastName.length < 1 || username.length < 1 || emailError === true || password.length < 7) {
setInputError(true)
}
else {
try {
await createUserWithEmailAndPassword(auth, email, password)
navigate("/dashboard")
}
catch(err: any) {
console.error(err.message)
setInputError(true)
// setAuthError(err.message)
}
}
}

return (
<div className="signupLayout">
<div className='signupGroup103Container'>
<img src={loginGroup103} alt="" className="signupGroup103" style={{gridRowStart: "1", gridRowEnd: "2"}}/>
</div>
<div className='signupLogoContainer'>
<div className="signupLogo" style={{gridRowStart: "2", gridRowEnd: "3"}}>
<h1 className="signupW">W</h1>
<img src={loginListThreeFilled} alt="" className="signupListThreeFilled"/>
<h1 className="signupL">L</h1>
<img src={loginVector} alt="" className="signupVector"/>
<img src={loginCrystalBall} alt="" className="signupCrystalBall"/>
<AuthLayout>
<div className="signupLayout">
<div className='signupGroup103Container'>
<img src={loginGroup103} alt="" className="signupGroup103" style={{gridRowStart: "1", gridRowEnd: "2"}}/>
</div>
</div>
<div className="signupFirstNameContainer">
<h2 className="signupFirstName">First Name</h2>
<div className="signupFirstNameInputContainer">
<input className="signupFirstNameInput"/>
<div className='signupLogoContainer'>
<div className="signupLogo" style={{gridRowStart: "2", gridRowEnd: "3"}}>
<h1 className="signupW">W</h1>
<img src={loginListThreeFilled} alt="" className="signupListThreeFilled"/>
<h1 className="signupL">L</h1>
<img src={loginVector} alt="" className="signupVector"/>
<img src={loginCrystalBall} alt="" className="signupCrystalBall"/>
</div>
</div>
</div>
<div className="signupLastNameContainer">
<h2 className="signupLastName">Last Name</h2>
<div className="signupLastNameInputContainer">
<input className="signupLastNameInput"/>
<div className="signupIndicatesRequiredContainer">
<p className="signupIndicatesRequired">* Indicates Required</p>
</div>
</div>
<div className="signupUsernameContainer">
<h2 className="signupUsername">Username</h2>
<div className="signupUsernameInputContainer">
<input className="signupUsernameInput"/>
<div className="signupFirstNameContainer">
<h2 className="signupFirstName">First Name</h2>
<div className="signupFirstNameInputContainer">
<input className="signupFirstNameInput" onChange={(e) => setFirstName(e.target.value)}/>
</div>
</div>
</div>
<div className="signupEmailContainer">
<h2 className="signupEmail">Email</h2>
<div className="signupEmailInputContainer">
<input className="signupEmailInput"/>
<div className="signupLastNameContainer">
<h2 className="signupLastName">Last Name</h2>
<div className="signupLastNameInputContainer">
<input className="signupLastNameInput" onChange={(e) => setLastName(e.target.value)}/>
</div>
</div>
</div>
<div className="signupPasswordContainer">
<h2 className="signupPassword">Password</h2>
<div className="signupPasswordInputContainer">
<input className="signupPasswordInput"/>
<div className="signupUsernameContainer">
<h2 className="signupUsername">Username</h2>
<div className="signupUsernameInputContainer">
<input className="signupUsernameInput" onChange={(e) => setUsername(e.target.value)}/>
</div>
</div>
<div className="signupEmailContainer">
<h2 className="signupEmail">Email</h2>
<div className="signupEmailInputContainer">
<input className="signupEmailInput" onChange={(e) => setEmail(e.target.value)}/>
</div>
</div>
<div className="signupEmailErrorContainer">
<p className="signupEmailError">Please enter a valid email address</p>
</div>
<div className="signupPasswordContainer">
<h2 className="signupPassword">Password</h2>
<div className="signupPasswordInputContainer">
<input className="signupPasswordInput" onChange={(e) => setPassword(e.target.value)}/>
</div>
</div>
<div className="signupButtonContainer">
<button className="signupButton" onClick={createUser} disabled={isDisabled} style={{backgroundColor: isDisabled ? "#6F6F6F" : "#000"}}>
<span className="signupButtonText">Submit</span>
</button>
</div>
<div className="signupPasswordErrorContainer">
<p className="signupPasswordError">Password must be at least 8 characters</p>
</div>
</div>
<div className="signupButtonContainer">
<button className="signupButton">
<span className="signupButtonText">Submit</span>
</button>
</div>
</div>
</AuthLayout>
)
}
41 changes: 39 additions & 2 deletions apps/frontend/src/app/views/signup/signup.css
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,43 @@
}
.signupLayout {
display: grid;
grid-template-rows: 40px 137px 98px 66px 116px 66px 96px 106px;
padding: 12px 16px 12px 16px;
grid-template-rows: 40px 147px 98px 76px 100px 76px 96px 110px;
}
.signupIndicatesRequiredContainer {
display: flex;
justify-content: center;
align-items: center;
}
.signupIndicatesRequired {
color: #F00;
font-feature-settings: 'clig' off, 'liga' off;
font-family: Arial;
font-size: 14px;
font-style: italic;
font-weight: 400;
line-height: normal;
}
.signupEmailErrorContainer {

}
.signupEmailError {
color: var(--Primary-Red, #F00);
font-feature-settings: 'clig' off, 'liga' off;
font-family: Arial;
font-size: 14px;
font-style: italic;
font-weight: 400;
line-height: normal;
}
.signupPasswordErrorContainer {

}
.signupPasswordError {
color: #F00;
font-feature-settings: 'clig' off, 'liga' off;
font-family: Arial;
font-size: 14px;
font-style: italic;
font-weight: 400;
line-height: normal;
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@tailwindcss/typography": "^0.5.9",
"axios": "^1.6.0",
"clsx": "^1.2.1",
"dotenv": "^16.0.3",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-validator": "^7.0.1",
"firebase": "^10.1.0",
Expand Down
Loading