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

Karmveer/feature/27/auth pages #87

Merged
merged 20 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
19 changes: 8 additions & 11 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ import Header from "./components/Header";
import Footer from "./components/Footer";

const App = () => {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use main code for this page. The styling added is out of date

return (
<>
<Header />
<main>
<div>
<Outlet />
return (
<div className="flex flex-col min-h-screen">
<Header />
<main className="flex-grow flex flex-col">
<Outlet />
</main>
<Footer />
</div>
</main>
<Footer />
</>
);
);
};

export default App;
52 changes: 52 additions & 0 deletions web/src/components/FormInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

interface FormInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
label?: string;
placeholder?: string;
type?: string;
id?: string;
className?: string;
name?: string;
options?: string[];
errorMessage?: string
}

const FormInput: React.FC<FormInputProps> = ({
label,
placeholder,
type = "text", id,
className = "mt-2 w-full px-3 py-2 border border-black rounded-lg focus:outline-none focus:border-black focus:ring-black",
options = [""],
...props
}) => {
if(type==="radio" && options.length > 0){
return (
<div className="mb-4 mt-4">
<div className="mt-2">
{options.map((option,index) => (
<label key={option} className={`inline-flex items-center ${index !== 0 ? 'ml-6' : ''}`}>
<input type="radio" name={props.name} value={option} />
<span className="ml-2">{option}</span>
</label>
))}
</div>
</div>
)
}else{
return (
<div className="form-input">
{label && <label htmlFor={id} className="">{label}</label>}
<input
placeholder={placeholder}
type={type}
id={id}
className={` ${className}`}
{...props}
/>
{props.errorMessage && <span className="text-red-500">{props.errorMessage}</span>}
</div>
);
}

}

export default FormInput;
47 changes: 29 additions & 18 deletions web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Link, useLocation } from "react-router-dom";
import { IoMdClose, IoMdMenu } from "react-icons/io";
import peacockLogo from "../assets/peacock-logo.png";
import whiteName from "../assets/auis_white.png";
import {SignedIn, SignedOut, SignOutButton} from "@clerk/clerk-react";

function Header() {
const [navBar, setNavBar] = useState(false);
Expand Down Expand Up @@ -67,24 +68,34 @@ function Header() {
</li>
))}
<div className="flex flex-col lg:flex-row items-center gap-8 mt-4 lg:mt-0 lg:ml-8">
<a href="/login">
<button
type="button"
className="bg-primary-orange hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}
>
Log-in
</button>
</a>
<a href="/signup">
<button
type="button"
className="bg-primary-orange hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}
>
Sign-up
</button>
</a>
<SignedOut>
<a href="/login">
<button
type="button"
className="bg-primary-orange hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}
>
Log-in
</button>
</a>
<a href="/signup">
<button
type="button"
className="bg-primary-orange hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}
>
Sign-up
</button>
</a>
</SignedOut>
<SignedIn >
<div className="bg-primary-orange hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}>
<SignOutButton />
</div>

</SignedIn>

</div>
</div>
</nav>
Expand Down
57 changes: 57 additions & 0 deletions web/src/components/UserInformationForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import FormInput from "@components/FormInput.tsx";
import {useState} from "react";


function UserInformationForm() {
const [values, setValues] = useState({
firstName: "",
lastName: "",
university: "",
graudationYear: "",
UPI: "",
studentID: "",
studyOption: ""
});

const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
// Need to do validation here
setValues({ ...values, [e.target.name]: e.target.value });
console.log(values)
};

const residencyOptions = ["International", "Domestic"];
const paymentOptions = ["One Semester ($8)", "Two Semesters ($15)"];

function handleSubmit(e: React.FormEvent<HTMLFormElement>){
e.preventDefault();
console.log("submitted");
}
return (
<div className="flex items-center justify-center ">
<div className="bg-white p-8 rounded-lg shadow-lg max-w-lg w-full">
<h2 className="text-2xl font-semibold mb-6 text-center">We need some more information for your membership</h2>

<form onSubmit={handleSubmit} >
<FormInput placeholder={"First Name"} id="firstName" errorMessage="First Name is Required" onChange={onChange} />
<FormInput placeholder={"Last Name"} id="lastName" errorMessage="Last Name is Required" onChange={onChange}/>
<FormInput placeholder={"University (or alumni)"} id="university" errorMessage="Your Univeristiy is Required" onChange={onChange}/>
<FormInput placeholder={"What year are you in (or alumni)"} id="year" errorMessage="Your Graduation Year is Required" onChange={onChange}/>
<FormInput placeholder={"UPI (if you have one)"} id="upi" onChange={onChange}/>
<FormInput placeholder={"Student ID (if you have one)"} id="studentId" onChange={onChange}/>
<FormInput placeholder={"What are you studying)"} id="study" onChange={onChange}/>

<FormInput type="radio" name="residency" options={residencyOptions}/>
<FormInput type="radio" name="duration" options={paymentOptions}/>

<button className="w-full bg-black text-white py-2 rounded-lg hover:bg-gray-800" >
Purchase membership
</button>
</form>

</div>
</div>

);
}

export default UserInformationForm;
26 changes: 15 additions & 11 deletions web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,26 @@ import SignUpScreen from "./screens/SignUpScreen.tsx";
import PhotosScreen from "./screens/PhotosScreen.tsx";
import PVVScreen from "./screens/PVVScreen.tsx";
import LoginScreen from "./screens/LoginScreen.tsx";
import InformationScreen from "./screens/InformationScreen.tsx";
import { ClerkProvider } from "@clerk/clerk-react";
import { graphqlClient } from "./graphql/client.ts";

//Add any routes for screens below
const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<App />}>
<Route index={true} element={<HomeScreen />} />
<Route path="/test" element={<TestScreen />} />
<Route path="/exec" element={<ExecScreen />} />
<Route path="/login" element={<LoginScreen />} />
<Route path="/signup" element={<SignUpScreen />} />
<Route path="/pvv" element={<PVVScreen />} />
<Route path="/photos" element={<PhotosScreen />} />
</Route>
)

createRoutesFromElements(
<Route path="/" element={<App />}>
<Route index={true} element={<HomeScreen />} />
<Route path="/test" element={<TestScreen />} />
<Route path="/exec" element={<ExecScreen />} />
<Route path="/login" element={<LoginScreen />} />
<Route path="/signup" element={<SignUpScreen />} />
<Route path="/user-info" element={<InformationScreen />} />
<Route path="/pvv" element={<PVVScreen />} />
<Route path="/photos" element={<PhotosScreen />} />
</Route>
)

);
// Import your publishable key
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
Expand Down
11 changes: 11 additions & 0 deletions web/src/screens/InformationScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import UserInformationForm from "@components/UserInformationForm.tsx";

function InformationScreen() {
return (
<div className="flex-grow flex flex-col justify-center bg-gradient-to-t from-blue-500 via-blue-400 to-blue-300">
<UserInformationForm />
</div>
);
}

export default InformationScreen;
28 changes: 23 additions & 5 deletions web/src/screens/LoginScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
import { SignIn } from "@clerk/clerk-react";

function LoginScreen() {
return (
<div>
<h2> Login Screen</h2>
</div>
);
return (
<div className="flex-grow flex flex-col h-full">
<div className="flex flex-grow justify-center">
<div className="flex flex-1 items-center justify-center">
<SignIn />
</div>
<div className="flex flex-col flex-1 items-center justify-top text-center pt-20 "
style={{
background: 'linear-gradient(to top, #ccf2ff 50%, #ffffff 100%)',
}}
>
<div className="mb-5">
<img src="/src/assets/peacock.png" alt="Descriptive Text" className="max-w-[300px] max-h-[300px] " />
</div>
<div>
<img src="/src/assets/AUIS_black_3.png" alt="Descriptive Text" className="max-w-xs max-h-xs" />
</div>
</div>
</div>
</div>
);
}

export default LoginScreen;
33 changes: 15 additions & 18 deletions web/src/screens/SignUpScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
import {SignUp} from "@clerk/clerk-react";
import { SignUp } from "@clerk/clerk-react";

function SignUpScreen() {
return (
<div className="flex-grow bg-white flex flex-col">
<div className="flex justify-center my-5">
<h1 className="text-black font-bold">Join Our Vibrant Community Today </h1>
</div>
<div className="flex flex-row justify-center mt-5">
<div className="flex flex-col flex-1 items-center justify-center text-center p-4">
<div className="flex-grow flex flex-col h-full ">
<div className="flex flex-grow justify-center ">

<div className="flex flex-col flex-1 items-center justify-top text-center pt-20 "
style={{
background: 'linear-gradient(to top, #fda642 50%, #ffffff 100%)',
}}
>
<div className="mb-5">
<img src="/src/assets/react.svg" alt="Descriptive Text" className="min-w-1000 min-h-1000"/>
<img src="/src/assets/peacock.png" alt="Descriptive Text" className="max-w-[300px] max-h-[300px] " />
</div>
<div>
<h1>Ready to Join Us? Let's get started and set up your account.</h1>
<h2>If you already have one, sign in here to access your profile.</h2>
<img src="/src/assets/AUIS_black_3.png" alt="Descriptive Text" className="max-w-xs max-h-xs" />
</div>
</div>

<div className="w-px bg-gray-300 mt-15">a</div>

<div className="flex flex-1 items-center justify-center mt-15">
<SignUp/>
<div className="flex flex-1 items-center justify-center ">
<SignUp afterSignUpUrl="/user-info"/>
</div>
</div>

</div>
)
);
}

export default SignUpScreen
export default SignUpScreen;
Loading