Skip to content

UI improvements for signin and signup pages (issue #60) #62

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
199 changes: 199 additions & 0 deletions frontend/package-lock.json

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

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-scroll-area": "^1.2.2",
Expand Down
39 changes: 21 additions & 18 deletions frontend/src/Pages/Authentication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,40 @@ import React, { useState } from 'react';
import { Button } from '@/components/ui/button';
import { LoginForm, SignUpForm, OTPVerificationForm, ForgotPasswordForm, ResetPasswordForm } from './Authentication/forms.tsx';
import { Link } from 'react-router-dom';
import loginSvg from '@/assets/login.svg';
import signupSvg from '@/assets/signup.svg';

const LeftSection = () => (
<div className="hidden md:flex w-full h-full flex-col justify-between bg-muted p-10 text-white">
<div className="flex items-center text-lg font-medium">
<Link to="/" className="flex items-center">
interface LeftSectionProps {
authMode: 'login' | 'signup' | 'otpVerification' | 'forgotPassword' | 'resetPassword';
}

const LeftSection: React.FC<LeftSectionProps> = ({ authMode }) => (
<div className="hidden md:flex w-full h-full flex-col justify-between bg-muted p-10">
<div className="flex items-center text-lg font-medium text-white">
<Link to="/" className="flex items-center text-2xl">
<svg>
{/* SVG Content */}
{/* <img src={logo} alt="Arguehub Logo" className="w-10 h-10" /> */}
</svg>
Arguehub
</Link>
</div>
<div>

<div className="flex flex-col items-center justify-center flex-grow">
<img
src={authMode === 'signup' ? signupSvg : loginSvg}
alt={`${authMode === 'signup' ? 'Sign up' : 'Login'} illustration`}
className="w-4/5 max-w-md mb-16 scale-150"
/>
<blockquote className="space-y-2">
<p className="text-lg">
<p className="text-lg text-white text-center">
"We cannot solve our problems with the same thinking we used when we created them."
</p>
<footer className="text-sm">Albert Einstein</footer>
<footer className="text-sm text-muted-foreground text-right italic">- Albert Einstein</footer>
</blockquote>
</div>
</div>
);



interface RightSectionProps {
authMode: 'login' | 'signup' | 'otpVerification' | 'forgotPassword' | 'resetPassword';
toggleAuthMode: () => void;
Expand Down Expand Up @@ -90,9 +100,7 @@ const RightSection: React.FC<RightSectionProps> = ({
</div>
);


const Authentication = () => {
// Extend authMode to include 'resetPassword'
const [authMode, setAuthMode] = useState<
'login' | 'signup' | 'otpVerification' | 'forgotPassword' | 'resetPassword'
>('login');
Expand All @@ -105,37 +113,32 @@ const Authentication = () => {
setAuthMode((prevMode) => (prevMode === 'login' ? 'signup' : 'login'));
};

// Start OTP verification process
const startOtpVerification = (email: string) => {
setEmailForOTP(email);
setAuthMode('otpVerification');
};

// Handle successful OTP verification
const handleOtpVerified = () => {
setAuthMode('login');
};

// Start forgot password process
const startForgotPassword = () => {
setAuthMode('forgotPassword');
};

// Start reset password process
const startResetPassword = (email: string) => {
setEmailForPasswordReset(email);
setAuthMode('resetPassword');
};

// Handle successful password reset
const handlePasswordReset = () => {
setInfoMessage('Your password was successfully reset. You can now log in.');
setAuthMode('login');
};

return (
<div className="flex w-screen h-screen">
<LeftSection />
<LeftSection authMode={authMode} />

<RightSection
authMode={authMode}
Expand Down
Loading