Files
monaco/Frontend/src/App.jsx
Arnab-Afk 47f73681af feat: Update login navigation and authentication flow
- Changed navigation from '/editor' to '/tests' after successful login.
- Introduced token state management in AuthContext for better handling of authentication.
- Updated login function to store JWT instead of Google token.
- Added error handling for login and test fetching processes.

style: Enhance UI with new footer and test list styles

- Added a footer component with copyright information.
- Created a new TestList component with improved styling and animations.
- Implemented responsive design for test cards and filter tabs.
- Added loading and error states for better user experience.

fix: Improve API interaction for test fetching and password verification

- Refactored API calls to use a centralized studentApi utility.
- Enhanced error handling for API responses, including unauthorized access.
- Implemented password verification for protected tests before starting them.
2025-10-29 11:37:19 +05:30

52 lines
1.6 KiB
JavaScript

import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { GoogleOAuthProvider } from '@react-oauth/google';
import { AuthProvider } from './contexts/AuthContext';
import Login from './components/Login';
import TestList from './components/TestList';
import CodeChallenge from "./components/CodeChallenge.jsx";
import Header from './components/Header';
import Footer from './components/Footer';
import ProtectedRoute from './components/ProtectedRoute';
import "./index.css";
function App() {
// Google OAuth Client ID - in production, this should be in environment variables
const GOOGLE_CLIENT_ID = "586378657128-smg8t52eqbji66c3eg967f70hsr54q5r.apps.googleusercontent.com";
return (
<GoogleOAuthProvider clientId={GOOGLE_CLIENT_ID}>
<AuthProvider>
<Router>
<div className="App">
<Routes>
<Route path="/login" element={<Login />} />
<Route
path="/tests"
element={
<ProtectedRoute>
<TestList />
<Footer />
</ProtectedRoute>
}
/>
<Route
path="/editor"
element={
<ProtectedRoute>
<CodeChallenge />
<Footer />
</ProtectedRoute>
}
/>
<Route path="/" element={<Navigate to="/tests" replace />} />
</Routes>
</div>
</Router>
</AuthProvider>
</GoogleOAuthProvider>
);
}
export default App