Skip to content

Commit 4884600

Browse files
Merge pull request #79 from smokeyScraper/frontend-fix
[bugfix]: Fix frontend build errors
2 parents 3354281 + 3f103ab commit 4884600

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

frontend/src/App.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
11
import React, { useEffect, useState } from 'react';
22
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
33
import { AnimatePresence } from 'framer-motion';
4+
import { Toaster } from 'react-hot-toast';
45
import Sidebar from './components/layout/Sidebar';
56
import Dashboard from './components/dashboard/Dashboard';
6-
7-
87
import BotIntegrationPage from './components/integration/BotIntegrationPage';
98
import ContributorsPage from './components/contributors/ContributorsPage';
109
import PullRequestsPage from './components/pages/PullRequestsPage';
1110
import SettingsPage from './components/pages/SettingsPage';
1211
import AnalyticsPage from './components/pages/AnalyticsPage';
1312
import SupportPage from './components/pages/SupportPage';
1413
import LandingPage from './components/landing/LandingPage';
14+
import LoginPage from './components/pages/LoginPage';
15+
import ProfilePage from './components/pages/ProfilePage';
1516

1617
function App() {
1718
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
1819
const [activePage, setActivePage] = useState('landing'); // Default to landing page
1920
const [repoData, setRepoData] = useState<any>(null); // Store fetched repo stats
21+
const [isAuthenticated, setIsAuthenticated] = useState(false);
22+
23+
// Check for existing authentication on app load
24+
useEffect(() => {
25+
const savedAuth = localStorage.getItem('isAuthenticated');
26+
if (savedAuth === 'true') {
27+
setIsAuthenticated(true);
28+
}
29+
}, []);
30+
31+
const handleLogin = () => {
32+
setIsAuthenticated(true);
33+
localStorage.setItem('isAuthenticated', 'true');
34+
};
35+
36+
const handleLogout = () => {
37+
setIsAuthenticated(false);
38+
localStorage.removeItem('isAuthenticated');
39+
setActivePage('landing');
40+
setRepoData(null);
41+
};
2042

2143
const renderPage = () => {
2244
switch (activePage) {
@@ -36,15 +58,17 @@ function App() {
3658
return <SupportPage />;
3759
case 'settings':
3860
return <SettingsPage />;
61+
case 'profile':
62+
return <ProfilePage />;
3963
default:
4064
return <Dashboard repoData={repoData} />;
41-
4265
}
4366
};
4467

4568
return (
4669
<Router>
4770
<div className="min-h-screen bg-gray-950 text-white">
71+
<Toaster position="top-right" />
4872
<Routes>
4973
<Route
5074
path="/login"
@@ -89,4 +113,3 @@ function App() {
89113
}
90114

91115
export default App;
92-

frontend/src/components/contributors/ContributorCard.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,24 @@ interface ContributorCardProps {
66
name: string;
77
avatar: string;
88
role: string;
9-
109
contributions: number; // Changed to number for consistency
1110
lastActive?: string; // Made optional for flexibility
12-
1311
}
1412

1513
const ContributorCard: React.FC<ContributorCardProps> = ({ name, avatar, role, contributions, lastActive }) => {
1614
const [isExpanded, setIsExpanded] = useState(false);
1715

1816
return (
19-
2017
<motion.div
21-
2218
whileHover={{ scale: 1.02 }}
2319
className="bg-gray-900 p-6 rounded-xl border border-gray-800 hover:border-green-500 transition-all duration-300 cursor-pointer"
2420
onClick={() => setIsExpanded(!isExpanded)}
2521
>
2622
<div className="flex items-center space-x-4">
27-
2823
<motion.img
2924
whileHover={{ scale: 1.1 }}
3025
src={avatar}
3126
alt={name}
32-
3327
className="w-12 h-12 rounded-full"
3428
/>
3529
<div>
@@ -39,43 +33,39 @@ const ContributorCard: React.FC<ContributorCardProps> = ({ name, avatar, role, c
3933
</div>
4034

4135
<motion.div
42-
4336
initial={false}
44-
animate={{ height: isExpanded ? 'auto' : 'auto' }}
37+
animate={{ height: isExpanded ? 'auto' : 0}}
4538
className="mt-4 space-y-2"
4639
>
4740
<div className="flex justify-between text-sm">
4841
<span className="text-gray-400">Contributions</span>
49-
5042
<motion.span
51-
5243
initial={{ opacity: 0 }}
5344
animate={{ opacity: 1 }}
5445
className="text-green-400"
5546
>
5647
{contributions}
5748
</motion.span>
58-
49+
</div>
50+
5951
{lastActive && (
6052
<div className="flex justify-between text-sm">
6153
<span className="text-gray-400">Last Active</span>
6254
<span className="text-gray-300">{lastActive}</span>
6355
</div>
6456
)}
57+
6558
{isExpanded && (
6659
<motion.div
67-
6860
initial={{ opacity: 0, height: 0 }}
6961
animate={{ opacity: 1, height: 'auto' }}
7062
exit={{ opacity: 0, height: 0 }}
7163
className="pt-4 border-t border-gray-800 mt-4"
7264
>
73-
7465
<button
7566
onClick={(e) => {
7667
e.stopPropagation();
7768
toast.success(`Message sent to ${name}`);
78-
7969
}}
8070
className="w-full bg-green-500 hover:bg-green-600 text-white py-2 rounded-lg transition-colors"
8171
>

0 commit comments

Comments
 (0)