diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 82c545bb..d4f63555 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,6 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; -import { AnimatePresence } from 'framer-motion'; +import { BrowserRouter as Router, Routes, Route, Navigate, Outlet } from 'react-router-dom'; import { Toaster } from 'react-hot-toast'; import Sidebar from './components/layout/Sidebar'; import Dashboard from './components/dashboard/Dashboard'; @@ -13,10 +12,10 @@ import SupportPage from './components/pages/SupportPage'; import LandingPage from './components/landing/LandingPage'; import LoginPage from './components/pages/LoginPage'; import ProfilePage from './components/pages/ProfilePage'; +import { AnimatePresence } from 'framer-motion'; function App() { const [isSidebarOpen, setIsSidebarOpen] = useState(true); - const [activePage, setActivePage] = useState('landing'); // Default to landing page const [repoData, setRepoData] = useState(null); // Store fetched repo stats const [isAuthenticated, setIsAuthenticated] = useState(false); @@ -36,34 +35,29 @@ function App() { const handleLogout = () => { setIsAuthenticated(false); localStorage.removeItem('isAuthenticated'); - setActivePage('landing'); setRepoData(null); }; - const renderPage = () => { - switch (activePage) { - case 'landing': - return ; - case 'dashboard': - return ; - case 'integration': - return ; - case 'contributors': - return ; - case 'analytics': - return ; - case 'prs': - return ; - case 'support': - return ; - case 'settings': - return ; - case 'profile': - return ; - default: - return ; - } - }; + const ProtectedLayout = () => ( +
+ +
+
+ + + +
+
+
+ ); return ( @@ -81,31 +75,21 @@ function App() { } /> - -
-
- {renderPage()} -
-
- - ) : ( - - ) + isAuthenticated ? : } - /> + > + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> +
@@ -113,3 +97,4 @@ function App() { } export default App; + diff --git a/frontend/src/components/layout/Sidebar.tsx b/frontend/src/components/layout/Sidebar.tsx index 9976dc4b..425e4a5b 100644 --- a/frontend/src/components/layout/Sidebar.tsx +++ b/frontend/src/components/layout/Sidebar.tsx @@ -1,58 +1,72 @@ import React from 'react'; +import { NavLink } from 'react-router-dom'; import { LayoutDashboard, Bot, - Github, - MessageSquare, Users, Activity, GitPullRequest, MessageCircleQuestion, Menu, Settings, - User + User, + LogOut } from 'lucide-react'; interface SidebarProps { isOpen: boolean; setIsOpen: (isOpen: boolean) => void; - activePage: string; - setActivePage: (page: string) => void; + onLogout: () => void; } -const Sidebar: React.FC = ({ isOpen, setIsOpen, activePage, setActivePage }) => ( -
-
-

Devr.AI

- +const navItems = [ + { icon: , label: 'Dashboard', path: '/dashboard' }, + { icon: , label: 'Bot Integration', path: '/integration' }, + { icon: , label: 'Contributors', path: '/contributors' }, + { icon: , label: 'Analytics', path: '/analytics' }, + { icon: , label: 'Pull Requests', path: '/prs' }, + { icon: , label: 'Support', path: '/support' }, + { icon: , label: 'Settings', path: '/settings' }, + { icon: , label: 'Profile', path: '/profile' }, +]; + +const Sidebar: React.FC = ({ isOpen, setIsOpen, onLogout }) => ( +
+
+
+

Devr.AI

+ +
+ +
- - +
); -export default Sidebar; \ No newline at end of file +export default Sidebar;