diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 4e2a127..82c545b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,10 +1,9 @@ import React, { useEffect, useState } from 'react'; import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; import { AnimatePresence } from 'framer-motion'; +import { Toaster } from 'react-hot-toast'; import Sidebar from './components/layout/Sidebar'; import Dashboard from './components/dashboard/Dashboard'; - - import BotIntegrationPage from './components/integration/BotIntegrationPage'; import ContributorsPage from './components/contributors/ContributorsPage'; import PullRequestsPage from './components/pages/PullRequestsPage'; @@ -12,11 +11,34 @@ import SettingsPage from './components/pages/SettingsPage'; import AnalyticsPage from './components/pages/AnalyticsPage'; import SupportPage from './components/pages/SupportPage'; import LandingPage from './components/landing/LandingPage'; +import LoginPage from './components/pages/LoginPage'; +import ProfilePage from './components/pages/ProfilePage'; 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); + + // Check for existing authentication on app load + useEffect(() => { + const savedAuth = localStorage.getItem('isAuthenticated'); + if (savedAuth === 'true') { + setIsAuthenticated(true); + } + }, []); + + const handleLogin = () => { + setIsAuthenticated(true); + localStorage.setItem('isAuthenticated', 'true'); + }; + + const handleLogout = () => { + setIsAuthenticated(false); + localStorage.removeItem('isAuthenticated'); + setActivePage('landing'); + setRepoData(null); + }; const renderPage = () => { switch (activePage) { @@ -36,15 +58,17 @@ function App() { return ; case 'settings': return ; + case 'profile': + return ; default: return ; - } }; return (
+ = ({ name, avatar, role, contributions, lastActive }) => { const [isExpanded, setIsExpanded] = useState(false); return ( - setIsExpanded(!isExpanded)} >
-
@@ -39,43 +33,39 @@ const ContributorCard: React.FC = ({ name, avatar, role, c
Contributions - {contributions} - +
+ {lastActive && (
Last Active {lastActive}
)} + {isExpanded && ( -