Skip to content

Commit 9390504

Browse files
committed
Revert "add progress"
This reverts commit 9de985a.
1 parent 9de985a commit 9390504

File tree

4 files changed

+59
-75
lines changed

4 files changed

+59
-75
lines changed

package-lock.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"bootstrap": "^5.3.3",
1515
"firebase": "^10.13.1",
1616
"marked": "^14.1.2",
17-
"nprogress": "^0.2.0",
1817
"react": "^18.3.1",
1918
"react-dom": "^18.3.1",
2019
"react-router-dom": "^6.26.2",

src/App.css

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
:root{
2-
--primary-color:rgb(186, 22, 163);
3-
}
41
.App {
52
/* text-align: center; */
63
}
@@ -27,7 +24,7 @@
2724
color: white;
2825
}
2926
.lnk {
30-
color: var(--primary-color) ;
27+
color: rgb(186 22 163) ;
3128
text-decoration: none ;
3229
}
3330
.clk{
@@ -46,20 +43,13 @@ background: rgb(186 22 163) !important;
4643
transform: rotate(360deg);
4744
}
4845
}
46+
/* Default state for search input */
4947
.input-group .form-control {
5048
width: 150px;
5149
transition: width 0.3s ease-in-out;
5250
}
53-
.search-expanded .form-control {
54-
width: 300px;
55-
}
56-
#nprogress .bar {
57-
background: var(--primary-color);
5851

59-
#nprogress .spinner-icon {
60-
border-top-color: var(--primary-color);
61-
border-left-color: var(--primary-color);
62-
}
63-
#nprogress .peg {
64-
box-shadow: 0 0 10px var(--primary-color), 0 0 5px var(--primary-color);
52+
/* Expanded state when the input is focused */
53+
.search-expanded .form-control {
54+
width: 300px; /* You can adjust this width */
6555
}

src/App.jsx

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import React, { useEffect, useState } from 'react';
2-
import { BrowserRouter as Router, Routes, Route, Navigate, useLocation } from 'react-router-dom';
3-
import NProgress from 'nprogress';
4-
import 'nprogress/nprogress.css';
2+
// import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
53
import './App.css';
64
import './index.css';
5+
import {
6+
BrowserRouter as Router,
7+
Routes,
8+
Route,
9+
Navigate,
10+
useLocation
11+
} from 'react-router-dom';
712
import SearchResults from './components/search';
813
import Login from './components/login';
914
import SignUp from './components/register';
@@ -18,65 +23,62 @@ import Dashboard from './components/dashboard';
1823
import courses from './components/courseData';
1924
import Footer from './components/Footer';
2025

21-
// Configure NProgress settings
22-
NProgress.configure({ showSpinner: false, speed: 500, trickleSpeed: 200 });
23-
24-
const App = () => {
25-
const location = useLocation();
26+
function App() {
2627
const [user, setUser] = useState(null);
2728

28-
useEffect(() => {
29-
NProgress.start();
30-
31-
const timeout = setTimeout(() => {
32-
NProgress.done();
33-
}, 200);
34-
35-
return () => {
36-
clearTimeout(timeout);
37-
NProgress.done();
38-
};
39-
}, [location]);
40-
41-
// Firebase authentication check
4229
useEffect(() => {
4330
const unsubscribe = auth.onAuthStateChanged((user) => {
44-
setUser(user);
31+
setUser(user); // Set user when logged in
4532
});
46-
return () => unsubscribe();
33+
34+
return () => unsubscribe(); // Clean up on unmount
4735
}, []);
36+
// Handle redirects from GitHub Pages 404 fallback
37+
// function RedirectWithState() {
38+
// const location = useLocation();
39+
// useEffect(() => {
40+
// const redirectPath = new URLSearchParams(location.search).get('redirect');
41+
// if (redirectPath) {
42+
// window.history.replaceState({}, '', redirectPath);
43+
// }
44+
// }, [location]);
45+
// return null;
46+
// }
4847

4948
return (
50-
<div className="App">
51-
<Navbar loggedin={user ? 'true' : 'false'} />
52-
<div className="auth-wrapper">
53-
<div className="auth-inner">
54-
<Routes>
55-
{/* Redirect to profile if user is logged in */}
56-
<Route path="/" element={user ? <Navigate to="/profile" /> : <Login />} />
57-
<Route path="/home" element={<Home />} />
58-
<Route path="/login" element={user ? <Navigate to="/profile" /> : <Login />} />
59-
<Route path="/register" element={<SignUp />} />
60-
<Route path="/profile" element={user ? <Profile /> : <Navigate to="/login" />} />
61-
<Route path="/courses/:courseName" element={<CourseDetail />} />
62-
<Route path="/dashboard" element={<Dashboard courses={courses} />} />
63-
<Route path="/search" element={<SearchResults />} />
64-
</Routes>
65-
<ToastContainer />
49+
<Router basename={import.meta.env.BASE_URL}>
50+
{/* <RedirectWithState /> */}
51+
<div className="App">
52+
{/* Pass user status as loggedin prop to Navbar */}
53+
<Navbar loggedin={user ? 'true' : 'false'} />
54+
<div className="auth-wrapper">
55+
<div className="auth-inner">
56+
57+
<Routes>
58+
{/* Redirect to profile if the user is logged in */}
59+
<Route path="/" element={user ? <Navigate to="/profile" /> : <Login />} />
60+
<Route path="/home" element={<Home />} />
61+
<Route
62+
path="/login"
63+
element={user ? <Navigate to="/profile" /> : <Login />}
64+
/>
65+
<Route path="/register" element={<SignUp />} />
66+
<Route
67+
path="/profile"
68+
element={user ? <Profile /> : <Navigate to="/login" />}
69+
/>
70+
<Route path="/courses/:courseName" element={<CourseDetail />} />
71+
<Route path="/" element={<Dashboard courses={courses} />} />
72+
<Route path="/search" element={<SearchResults />} />
73+
74+
</Routes>
75+
<ToastContainer />
76+
</div>
6677
</div>
6778
</div>
68-
<Footer />
69-
</div>
70-
);
71-
};
72-
73-
const WrappedApp = () => {
74-
return (
75-
<Router>
76-
<App />
79+
<Footer />
7780
</Router>
7881
);
79-
};
80-
81-
export default WrappedApp;
82+
}
8283

84+
export default App;

0 commit comments

Comments
 (0)