Prakhar Singh
commited on
Commit
·
963da3d
1
Parent(s):
7e99777
chorse: The UI and the Sign In and Sign Up functionality Fixed
Browse files
Frontend/src/components/auth/SignIn.tsx
CHANGED
|
@@ -25,15 +25,6 @@ const SignIn: React.FC<SignInProps> = ({ onClose, onSwitchToSignUp, onAuthSucces
|
|
| 25 |
|
| 26 |
return (
|
| 27 |
<>
|
| 28 |
-
{/* Close Button - Uses the 'onClose' prop */}
|
| 29 |
-
<button
|
| 30 |
-
onClick={onClose}
|
| 31 |
-
className="absolute top-4 right-4 text-gray-400 hover:text-white transition-colors p-2 rounded-full hover:bg-slate-800"
|
| 32 |
-
aria-label="Close"
|
| 33 |
-
>
|
| 34 |
-
<X className="w-5 h-5" />
|
| 35 |
-
</button>
|
| 36 |
-
|
| 37 |
<h2 className="text-3xl font-bold mb-8 text-center text-white">
|
| 38 |
Welcome Back
|
| 39 |
</h2>
|
|
|
|
| 25 |
|
| 26 |
return (
|
| 27 |
<>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
<h2 className="text-3xl font-bold mb-8 text-center text-white">
|
| 29 |
Welcome Back
|
| 30 |
</h2>
|
Frontend/src/components/auth/SignUp.tsx
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
|
|
|
|
|
| 1 |
import React from 'react';
|
| 2 |
-
import { User, Mail, Lock, UserPlus, Chrome, X } from 'lucide-react';
|
| 3 |
|
| 4 |
-
// Added onClose prop to handle form-internal links/closing
|
| 5 |
interface SignUpProps {
|
| 6 |
onClose: () => void;
|
| 7 |
onSwitchToSignIn: () => void;
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
const SignUp: React.FC<SignUpProps> = ({ onClose, onSwitchToSignIn }) => {
|
| 12 |
|
| 13 |
-
// TODO: Implement actual form submission logic here
|
| 14 |
const handleSubmit = (e: React.FormEvent) => {
|
| 15 |
e.preventDefault();
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
};
|
| 19 |
|
| 20 |
-
// TODO: Implement actual Google OAuth logic here
|
| 21 |
const handleGoogleSignUp = () => {
|
| 22 |
-
|
|
|
|
| 23 |
};
|
| 24 |
|
| 25 |
return (
|
| 26 |
<>
|
| 27 |
-
{/* Close Button - Uses the 'onClose' prop */}
|
| 28 |
-
<button
|
| 29 |
-
onClick={onClose}
|
| 30 |
-
className="absolute top-4 right-4 text-gray-400 hover:text-white transition-colors p-2 rounded-full hover:bg-slate-800"
|
| 31 |
-
aria-label="Close"
|
| 32 |
-
>
|
| 33 |
-
<X className="w-5 h-5" />
|
| 34 |
-
</button>
|
| 35 |
-
|
| 36 |
<h2 className="text-3xl font-bold mb-8 text-center text-white">
|
| 37 |
Create Your Account
|
| 38 |
</h2>
|
|
|
|
| 1 |
+
// src/components/SignUp.tsx - CORRECTED CODE
|
| 2 |
+
|
| 3 |
import React from 'react';
|
| 4 |
+
import { User, Mail, Lock, UserPlus, Chrome, X } from 'lucide-react';
|
| 5 |
|
|
|
|
| 6 |
interface SignUpProps {
|
| 7 |
onClose: () => void;
|
| 8 |
onSwitchToSignIn: () => void;
|
| 9 |
+
onAuthSuccess: () => void;
|
| 10 |
}
|
| 11 |
|
| 12 |
+
const SignUp: React.FC<SignUpProps> = ({ onClose, onSwitchToSignIn, onAuthSuccess }) => {
|
| 13 |
|
|
|
|
| 14 |
const handleSubmit = (e: React.FormEvent) => {
|
| 15 |
e.preventDefault();
|
| 16 |
+
// ... (Authentication logic remains the same)
|
| 17 |
+
|
| 18 |
+
// Simulate successful first-time sign-up (which logs them in)
|
| 19 |
+
console.log("Sign Up successful. Logging in and redirecting to dashboard.");
|
| 20 |
+
onAuthSuccess();
|
| 21 |
};
|
| 22 |
|
|
|
|
| 23 |
const handleGoogleSignUp = () => {
|
| 24 |
+
// ... (Google Auth logic remains the same)
|
| 25 |
+
onAuthSuccess();
|
| 26 |
};
|
| 27 |
|
| 28 |
return (
|
| 29 |
<>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
<h2 className="text-3xl font-bold mb-8 text-center text-white">
|
| 31 |
Create Your Account
|
| 32 |
</h2>
|
Frontend/src/components/dashboard/Sidebar.tsx
CHANGED
|
@@ -2,22 +2,23 @@ import React from "react";
|
|
| 2 |
import { Link, useLocation } from "react-router-dom";
|
| 3 |
import {
|
| 4 |
Home, FileText, Brain, BookOpen,
|
| 5 |
-
|
| 6 |
} from "lucide-react";
|
| 7 |
|
| 8 |
interface SidebarProps {
|
| 9 |
-
onLogout?: () => void;
|
| 10 |
}
|
| 11 |
|
| 12 |
const Sidebar: React.FC<SidebarProps> = ({ onLogout }) => {
|
| 13 |
const location = useLocation();
|
| 14 |
|
| 15 |
const navItems = [
|
| 16 |
-
{ path: "/", label: "Dashboard", icon: <Home size={18} /> },
|
| 17 |
{ path: "/notes", label: "Notes", icon: <BookOpen size={18} /> },
|
| 18 |
{ path: "/AIInterview", label: "AI Interview", icon: <Brain size={18} /> },
|
| 19 |
{ path: "/quize", label: "Resume Quiz", icon: <FileText size={18} /> },
|
| 20 |
];
|
|
|
|
| 21 |
return (
|
| 22 |
<aside className="w-64 bg-linear-to-r from-blue-700 to-gray-900/50 text-white flex flex-col justify-between">
|
| 23 |
|
|
@@ -43,19 +44,25 @@ const Sidebar: React.FC<SidebarProps> = ({ onLogout }) => {
|
|
| 43 |
</nav>
|
| 44 |
</div>
|
| 45 |
|
| 46 |
-
{/* Bottom Section (
|
| 47 |
<div className="p-4 border-t border-gray-700 space-y-4">
|
| 48 |
-
|
|
|
|
| 49 |
<Settings size={18} />
|
| 50 |
<span>Settings</span>
|
| 51 |
</button>
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
<User size={18} />
|
| 55 |
<span>John Doe</span>
|
| 56 |
</button>
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
<LogOut size={18} />
|
| 60 |
<span>Logout</span>
|
| 61 |
</button>
|
|
|
|
| 2 |
import { Link, useLocation } from "react-router-dom";
|
| 3 |
import {
|
| 4 |
Home, FileText, Brain, BookOpen,
|
| 5 |
+
Settings, User, LogOut
|
| 6 |
} from "lucide-react";
|
| 7 |
|
| 8 |
interface SidebarProps {
|
| 9 |
+
onLogout?: () => void; // Function to handle logging out
|
| 10 |
}
|
| 11 |
|
| 12 |
const Sidebar: React.FC<SidebarProps> = ({ onLogout }) => {
|
| 13 |
const location = useLocation();
|
| 14 |
|
| 15 |
const navItems = [
|
| 16 |
+
{ path: "/dashboard", label: "Dashboard", icon: <Home size={18} /> },
|
| 17 |
{ path: "/notes", label: "Notes", icon: <BookOpen size={18} /> },
|
| 18 |
{ path: "/AIInterview", label: "AI Interview", icon: <Brain size={18} /> },
|
| 19 |
{ path: "/quize", label: "Resume Quiz", icon: <FileText size={18} /> },
|
| 20 |
];
|
| 21 |
+
|
| 22 |
return (
|
| 23 |
<aside className="w-64 bg-linear-to-r from-blue-700 to-gray-900/50 text-white flex flex-col justify-between">
|
| 24 |
|
|
|
|
| 44 |
</nav>
|
| 45 |
</div>
|
| 46 |
|
| 47 |
+
{/* Bottom Section (User Actions) */}
|
| 48 |
<div className="p-4 border-t border-gray-700 space-y-4">
|
| 49 |
+
{/* Settings Button */}
|
| 50 |
+
<button className="flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-800 transition w-full text-left text-gray-300">
|
| 51 |
<Settings size={18} />
|
| 52 |
<span>Settings</span>
|
| 53 |
</button>
|
| 54 |
|
| 55 |
+
{/* User Profile Placeholder */}
|
| 56 |
+
<button className="flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-800 transition w-full text-left text-gray-300">
|
| 57 |
<User size={18} />
|
| 58 |
<span>John Doe</span>
|
| 59 |
</button>
|
| 60 |
|
| 61 |
+
{/* Logout Button (Click handler added here) */}
|
| 62 |
+
<button
|
| 63 |
+
onClick={onLogout}
|
| 64 |
+
className="flex items-center space-x-3 p-3 rounded-lg bg-red-500 hover:bg-red-600 text-black hover:text-white transition w-full text-left font-medium"
|
| 65 |
+
>
|
| 66 |
<LogOut size={18} />
|
| 67 |
<span>Logout</span>
|
| 68 |
</button>
|