From 47f73681afad630e606eca034367b217de44647a Mon Sep 17 00:00:00 2001 From: Arnab-Afk Date: Wed, 29 Oct 2025 11:37:19 +0530 Subject: [PATCH] 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. --- Frontend/.env | 3 +- Frontend/package-lock.json | 8 +- Frontend/src/App.jsx | 27 +- Frontend/src/components/CodeChallenge.jsx | 264 +++++++-- Frontend/src/components/Footer.jsx | 14 + Frontend/src/components/Login.jsx | 4 +- Frontend/src/components/TestList.css | 688 ++++++++++++++++++++++ Frontend/src/components/TestList.jsx | 346 +++++++++++ Frontend/src/contexts/AuthContext.jsx | 88 +-- Frontend/src/index.css | 21 +- Frontend/src/utils/studentApi.js | 51 ++ 11 files changed, 1416 insertions(+), 98 deletions(-) create mode 100644 Frontend/src/components/Footer.jsx create mode 100644 Frontend/src/components/TestList.css create mode 100644 Frontend/src/components/TestList.jsx create mode 100644 Frontend/src/utils/studentApi.js diff --git a/Frontend/.env b/Frontend/.env index 4ed5eb7..09a9ddd 100644 --- a/Frontend/.env +++ b/Frontend/.env @@ -1 +1,2 @@ -VITE_API_URL="http://localhost:8080" \ No newline at end of file +VITE_API_URL="http://localhost:8080" +VITE_FACULTY_API_URL="http://localhost:5000/api" \ No newline at end of file diff --git a/Frontend/package-lock.json b/Frontend/package-lock.json index 0dab426..24e7f42 100644 --- a/Frontend/package-lock.json +++ b/Frontend/package-lock.json @@ -2677,9 +2677,9 @@ "license": "ISC" }, "node_modules/postcss": { - "version": "8.5.3", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", - "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "dev": true, "funding": [ { @@ -2697,7 +2697,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.8", + "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, diff --git a/Frontend/src/App.jsx b/Frontend/src/App.jsx index ef54b2b..574fb5e 100644 --- a/Frontend/src/App.jsx +++ b/Frontend/src/App.jsx @@ -2,8 +2,10 @@ import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-d 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"; @@ -19,23 +21,24 @@ function App() { } /> - {/*
*/} - -
-
- - Copyright © 2025. Made with - ♡ by Ishika and Arnab. - -
-
+ +