Prakhar Singh
commited on
Commit
·
2636d69
1
Parent(s):
e479d3a
Dashboard header remove
Browse files
Frontend/src/App.tsx
CHANGED
|
@@ -6,18 +6,14 @@ import AIInterview from "./pages/AiInterview";
|
|
| 6 |
import Quize from "./pages/quize";
|
| 7 |
import Home from "./pages/home";
|
| 8 |
import Sidebar from "./components/dashboard/Sidebar";
|
| 9 |
-
import Header from "./components/dashboard/Header";
|
| 10 |
|
| 11 |
const App: React.FC = () => {
|
| 12 |
-
// Track authentication state
|
| 13 |
const [isAuthenticated, setIsAuthenticated] = useState<boolean>(false);
|
| 14 |
|
| 15 |
-
// Function to handle successful login
|
| 16 |
const handleLogin = () => {
|
| 17 |
setIsAuthenticated(true);
|
| 18 |
};
|
| 19 |
|
| 20 |
-
// Function to handle logout
|
| 21 |
const handleLogout = () => {
|
| 22 |
setIsAuthenticated(false);
|
| 23 |
};
|
|
@@ -25,45 +21,46 @@ const App: React.FC = () => {
|
|
| 25 |
return (
|
| 26 |
<Router>
|
| 27 |
<Routes>
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
element={
|
| 32 |
isAuthenticated ? (
|
| 33 |
<Navigate to="/dashboard" replace />
|
| 34 |
) : (
|
| 35 |
<Home onLogin={handleLogin} />
|
| 36 |
)
|
| 37 |
-
}
|
| 38 |
/>
|
| 39 |
|
| 40 |
-
{/* Protected Routes
|
| 41 |
<Route
|
| 42 |
path="/*"
|
| 43 |
element={
|
| 44 |
isAuthenticated ? (
|
| 45 |
<div className="flex h-screen bg-gray-100">
|
| 46 |
-
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
{/* Main Content */}
|
| 50 |
-
<
|
| 51 |
-
<
|
| 52 |
-
|
| 53 |
-
<
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
</main>
|
| 60 |
-
</div>
|
| 61 |
</div>
|
| 62 |
) : (
|
| 63 |
<Navigate to="/" replace />
|
| 64 |
)
|
| 65 |
}
|
| 66 |
/>
|
|
|
|
| 67 |
</Routes>
|
| 68 |
</Router>
|
| 69 |
);
|
|
|
|
| 6 |
import Quize from "./pages/quize";
|
| 7 |
import Home from "./pages/home";
|
| 8 |
import Sidebar from "./components/dashboard/Sidebar";
|
|
|
|
| 9 |
|
| 10 |
const App: React.FC = () => {
|
|
|
|
| 11 |
const [isAuthenticated, setIsAuthenticated] = useState<boolean>(false);
|
| 12 |
|
|
|
|
| 13 |
const handleLogin = () => {
|
| 14 |
setIsAuthenticated(true);
|
| 15 |
};
|
| 16 |
|
|
|
|
| 17 |
const handleLogout = () => {
|
| 18 |
setIsAuthenticated(false);
|
| 19 |
};
|
|
|
|
| 21 |
return (
|
| 22 |
<Router>
|
| 23 |
<Routes>
|
| 24 |
+
|
| 25 |
+
{/* Public Route */}
|
| 26 |
+
<Route
|
| 27 |
+
path="/"
|
| 28 |
element={
|
| 29 |
isAuthenticated ? (
|
| 30 |
<Navigate to="/dashboard" replace />
|
| 31 |
) : (
|
| 32 |
<Home onLogin={handleLogin} />
|
| 33 |
)
|
| 34 |
+
}
|
| 35 |
/>
|
| 36 |
|
| 37 |
+
{/* Protected Routes */}
|
| 38 |
<Route
|
| 39 |
path="/*"
|
| 40 |
element={
|
| 41 |
isAuthenticated ? (
|
| 42 |
<div className="flex h-screen bg-gray-100">
|
| 43 |
+
|
| 44 |
+
{/* Sidebar (only once) */}
|
| 45 |
+
<Sidebar onLogout={handleLogout} />
|
| 46 |
|
| 47 |
{/* Main Content */}
|
| 48 |
+
<main className="flex-1 overflow-y-auto p-6">
|
| 49 |
+
<Routes>
|
| 50 |
+
<Route path="/dashboard" element={<Dashboard />} />
|
| 51 |
+
<Route path="/notes" element={<Notes />} />
|
| 52 |
+
<Route path="/AIInterview" element={<AIInterview />} />
|
| 53 |
+
<Route path="/quize" element={<Quize />} />
|
| 54 |
+
</Routes>
|
| 55 |
+
</main>
|
| 56 |
+
|
|
|
|
|
|
|
| 57 |
</div>
|
| 58 |
) : (
|
| 59 |
<Navigate to="/" replace />
|
| 60 |
)
|
| 61 |
}
|
| 62 |
/>
|
| 63 |
+
|
| 64 |
</Routes>
|
| 65 |
</Router>
|
| 66 |
);
|
Frontend/src/components/dashboard/Header.tsx
DELETED
|
@@ -1,55 +0,0 @@
|
|
| 1 |
-
import React from 'react';
|
| 2 |
-
import { LogOut, Bell, Settings, User } from 'lucide-react';
|
| 3 |
-
|
| 4 |
-
interface HeaderProps {
|
| 5 |
-
onLogout: () => void;
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
const Header: React.FC<HeaderProps> = ({ onLogout }) => {
|
| 9 |
-
return (
|
| 10 |
-
<header className="bg-white shadow-sm border-b border-gray-200 px-6 py-4">
|
| 11 |
-
<div className="flex items-center justify-between">
|
| 12 |
-
{/* Left side - Title or Search */}
|
| 13 |
-
<div>
|
| 14 |
-
<h1 className="text-2xl font-bold text-gray-800">Dashboard</h1>
|
| 15 |
-
</div>
|
| 16 |
-
|
| 17 |
-
{/* Right side - Actions */}
|
| 18 |
-
<div className="flex items-center space-x-4">
|
| 19 |
-
{/* Notifications */}
|
| 20 |
-
<button className="p-2 rounded-lg hover:bg-gray-100 transition-colors relative">
|
| 21 |
-
<Bell className="w-5 h-5 text-gray-600" />
|
| 22 |
-
<span className="absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"></span>
|
| 23 |
-
</button>
|
| 24 |
-
|
| 25 |
-
{/* Settings */}
|
| 26 |
-
<button className="p-2 rounded-lg hover:bg-gray-100 transition-colors">
|
| 27 |
-
<Settings className="w-5 h-5 text-gray-600" />
|
| 28 |
-
</button>
|
| 29 |
-
|
| 30 |
-
{/* User Profile */}
|
| 31 |
-
<div className="flex items-center space-x-3 pl-4 border-l border-gray-200">
|
| 32 |
-
<div className="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center">
|
| 33 |
-
<User className="w-5 h-5 text-white" />
|
| 34 |
-
</div>
|
| 35 |
-
<div className="hidden md:block">
|
| 36 |
-
<p className="text-sm font-medium text-gray-700">John Doe</p>
|
| 37 |
-
<p className="text-xs text-gray-500">john@example.com</p>
|
| 38 |
-
</div>
|
| 39 |
-
</div>
|
| 40 |
-
|
| 41 |
-
{/* Logout Button */}
|
| 42 |
-
<button
|
| 43 |
-
onClick={onLogout}
|
| 44 |
-
className="flex items-center space-x-2 px-4 py-2 rounded-lg bg-red-500 hover:bg-red-600 text-white transition-colors"
|
| 45 |
-
>
|
| 46 |
-
<LogOut className="w-4 h-4" />
|
| 47 |
-
<span className="hidden md:inline">Logout</span>
|
| 48 |
-
</button>
|
| 49 |
-
</div>
|
| 50 |
-
</div>
|
| 51 |
-
</header>
|
| 52 |
-
);
|
| 53 |
-
};
|
| 54 |
-
|
| 55 |
-
export default Header;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Frontend/src/components/dashboard/Sidebar.tsx
CHANGED
|
@@ -1,8 +1,15 @@
|
|
| 1 |
import React from "react";
|
| 2 |
import { Link, useLocation } from "react-router-dom";
|
| 3 |
-
import {
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
const location = useLocation();
|
| 7 |
|
| 8 |
const navItems = [
|
|
@@ -11,26 +18,54 @@ const Sidebar: React.FC = () => {
|
|
| 11 |
{ path: "/AIInterview", label: "AI Interview", icon: <Brain size={18} /> },
|
| 12 |
{ path: "/quize", label: "Resume Quiz", icon: <FileText size={18} /> },
|
| 13 |
];
|
| 14 |
-
|
| 15 |
return (
|
| 16 |
-
<aside className="w-64 bg-gray-900 text-white flex flex-col">
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</div>
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
</aside>
|
| 35 |
);
|
| 36 |
};
|
|
|
|
| 1 |
import React from "react";
|
| 2 |
import { Link, useLocation } from "react-router-dom";
|
| 3 |
+
import {
|
| 4 |
+
Home, FileText, Brain, BookOpen,
|
| 5 |
+
Bell, Settings, User, LogOut
|
| 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 = [
|
|
|
|
| 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-gray-900 text-white flex flex-col justify-between">
|
| 23 |
+
|
| 24 |
+
{/* Top Section */}
|
| 25 |
+
<div>
|
| 26 |
+
<div className="text-2xl font-bold text-center py-6 border-b border-gray-700">
|
| 27 |
+
InterviewAI
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
+
<nav className="p-4 space-y-3">
|
| 31 |
+
{navItems.map((item) => (
|
| 32 |
+
<Link
|
| 33 |
+
key={item.path}
|
| 34 |
+
to={item.path}
|
| 35 |
+
className={`flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-800 transition ${
|
| 36 |
+
location.pathname === item.path ? "bg-gray-800" : ""
|
| 37 |
+
}`}
|
| 38 |
+
>
|
| 39 |
+
{item.icon}
|
| 40 |
+
<span>{item.label}</span>
|
| 41 |
+
</Link>
|
| 42 |
+
))}
|
| 43 |
+
</nav>
|
| 44 |
</div>
|
| 45 |
+
|
| 46 |
+
{/* Bottom Section (From Header) */}
|
| 47 |
+
<div className="p-4 border-t border-gray-700 space-y-4">
|
| 48 |
+
<button className="flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-800 transition w-full text-left">
|
| 49 |
+
<Bell size={18} />
|
| 50 |
+
<span>Notifications</span>
|
| 51 |
+
</button>
|
| 52 |
+
|
| 53 |
+
<button className="flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-800 transition w-full text-left">
|
| 54 |
+
<Settings size={18} />
|
| 55 |
+
<span>Settings</span>
|
| 56 |
+
</button>
|
| 57 |
+
|
| 58 |
+
<button className="flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-800 transition w-full text-left">
|
| 59 |
+
<User size={18} />
|
| 60 |
+
<span>John Doe</span>
|
| 61 |
+
</button>
|
| 62 |
+
|
| 63 |
+
<button className="flex items-center space-x-3 p-3 rounded-lg hover:bg-red-600/20 text-red-400 transition w-full text-left">
|
| 64 |
+
<LogOut size={18} />
|
| 65 |
+
<span>Logout</span>
|
| 66 |
+
</button>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
</aside>
|
| 70 |
);
|
| 71 |
};
|