diff --git a/Backend/Controllers/questionController.js b/Backend/Controllers/questionController.js
index d50d607..2057d69 100644
--- a/Backend/Controllers/questionController.js
+++ b/Backend/Controllers/questionController.js
@@ -3,33 +3,34 @@ const logger = require('../utils/logger');
const promClient = require('prom-client');
const counter = new promClient.Counter({
- name: 'question_served',
+ name: 'questions_served',
help: 'The number of questions served'
});
-const getRandomQuestion = async (req, res) => {
+const getAllQuestions = async (req, res) => {
try {
- const count = await Question.countDocuments();
+ const questions = await Question.find();
+ console.log(questions)
+ const count = questions.length;
+
console.log('Total questions count:', count);
logger.info('Total questions count:', count);
+
if (count === 0) {
return res.status(404).json({ msg: 'No questions found' });
}
- const random = Math.floor(Math.random() * count);
- const question = await Question.findOne().skip(random);
- logger.info('Random question:', question);
- console.log('Random question:', question);
- if (!question) {
- return res.status(404).json({ msg: 'No question found' });
- }
+ counter.inc(count); // Increment the counter by the number of questions served
- counter.inc();
+ const questionsWithoutAnswers = questions.map(({ _id, question, options }) => ({
+ _id,
+ question,
+ options
+ }));
- res.json(question);
+ res.json(questionsWithoutAnswers);
} catch (err) {
- logger.error('Error in /random-question endpoint:', err.message);
- logger.error('Error in /random-question endpoint:', err.message);
+ logger.error('Error in /all-questions endpoint:', err.message);
res.status(500).send('Server Error');
}
};
@@ -49,4 +50,4 @@ const checkAnswer = async (req, res) => {
}
};
-module.exports = { getRandomQuestion, checkAnswer };
+module.exports = { getAllQuestions, checkAnswer };
diff --git a/Backend/Controllers/userController.js b/Backend/Controllers/userController.js
index 5abb306..de3bbc8 100644
--- a/Backend/Controllers/userController.js
+++ b/Backend/Controllers/userController.js
@@ -24,6 +24,39 @@ const createUser = async (req, res) => {
}
};
+// Return all users (Leaderboard)
+const getAllUsers = async (req, res) => {
+ try {
+ const users = await User.find().sort({ score: -1 }); // Sorting by score in descending order
+ res.status(200).json({
+ message: 'Users retrieved successfully',
+ users
+ });
+ } catch (error) {
+ res.status(500).json({
+ message: 'Failed to retrieve users',
+ error: error.message
+ });
+ }
+};
+
+// Clear all users
+const clearUsers = async (req, res) => {
+ try {
+ await User.deleteMany({});
+ res.status(200).json({
+ message: 'All users cleared successfully'
+ });
+ } catch (error) {
+ res.status(500).json({
+ message: 'Failed to clear users',
+ error: error.message
+ });
+ }
+};
+
module.exports = {
- createUser
+ createUser,
+ clearUsers,
+ getAllUsers
};
diff --git a/Backend/Routes/questionRoutes.js b/Backend/Routes/questionRoutes.js
index 5ea00f0..9762088 100644
--- a/Backend/Routes/questionRoutes.js
+++ b/Backend/Routes/questionRoutes.js
@@ -1,8 +1,8 @@
const express = require('express');
const router = express.Router();
-const { getRandomQuestion, checkAnswer } = require('../Controllers/questionController');
+const { getAllQuestions, checkAnswer } = require('../Controllers/questionController');
-router.get('/random-question', getRandomQuestion);
+router.get('/all-questions', getAllQuestions);
router.post('/check-answer', checkAnswer);
diff --git a/Backend/Routes/userRoutes.js b/Backend/Routes/userRoutes.js
index b5e10be..816f0c3 100644
--- a/Backend/Routes/userRoutes.js
+++ b/Backend/Routes/userRoutes.js
@@ -2,9 +2,13 @@ const express = require('express');
const router = express.Router();
const {
- createUser
+ createUser,
+ getAllUsers,
+ clearUsers
} = require('../Controllers/userController')
router.post('/create', createUser)
+router.get('/', getAllUsers);
+router.delete('/clear', clearUsers);
module.exports = router
\ No newline at end of file
diff --git a/Backend/app.log b/Backend/app.log
index 1213cad..2c320e1 100644
--- a/Backend/app.log
+++ b/Backend/app.log
@@ -415,3 +415,27 @@
2024-08-22T18:35:34.909Z info: MongoDB connected
2024-08-22T18:35:36.836Z info: Server started on port 7000
2024-08-22T18:35:37.664Z info: MongoDB connected
+2024-08-22T19:04:04.280Z info: Server started on port 7000
+2024-08-22T19:04:04.687Z info: MongoDB connected
+2024-08-22T19:17:29.852Z info: Server started on port 7000
+2024-08-22T19:17:30.243Z info: MongoDB connected
+2024-08-22T19:17:41.157Z info: Total questions count:
+2024-08-22T19:18:28.554Z info: Total questions count:
+2024-08-22T19:21:50.447Z info: Total questions count:
+2024-08-22T19:22:00.751Z info: Total questions count:
+2024-08-22T19:26:53.519Z info: Total questions count:
+2024-08-22T19:45:33.213Z info: Total questions count:
+2024-08-22T19:48:39.514Z info: Total questions count:
+2024-08-22T19:53:24.393Z info: Server started on port 7000
+2024-08-22T19:53:24.826Z info: MongoDB connected
+2024-08-22T19:56:06.610Z info: Total questions count:
+2024-08-23T05:40:56.224Z info: Server started on port 7000
+2024-08-23T05:40:57.560Z info: MongoDB connected
+2024-08-23T06:09:32.762Z info: Server started on port 7000
+2024-08-23T06:09:33.707Z info: MongoDB connected
+2024-08-23T06:10:35.182Z info: Total questions count:
+2024-08-23T06:39:01.409Z info: Server started on port 7000
+2024-08-23T06:39:02.866Z info: MongoDB connected
+2024-08-23T06:43:24.967Z info: Total questions count:
+2024-08-29T07:03:32.939Z info: Server started on port 7000
+2024-08-29T07:03:43.716Z info: MongoDB connected
diff --git a/Backend/server.js b/Backend/index.js
similarity index 100%
rename from Backend/server.js
rename to Backend/index.js
diff --git a/Backend/package.json b/Backend/package.json
index 6c5f3d0..3eb1ff3 100644
--- a/Backend/package.json
+++ b/Backend/package.json
@@ -5,8 +5,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
- "start": "node server.js",
- "dev": "nodemon server.js"
+ "start": "node index.js",
+ "dev": "nodemon index.js"
},
"keywords": [],
"author": "",
diff --git a/Backend/vercel.json b/Backend/vercel.json
new file mode 100644
index 0000000..7fd270e
--- /dev/null
+++ b/Backend/vercel.json
@@ -0,0 +1,15 @@
+{
+ "version": 2,
+ "builds": [
+ {
+ "src": "./index.js",
+ "use": "@vercel/node"
+ }
+ ],
+ "routes": [
+ {
+ "src": "/api/(.*)",
+ "dest": "/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Frontend/index.html b/Frontend/index.html
index b31895f..49b4ab4 100644
--- a/Frontend/index.html
+++ b/Frontend/index.html
@@ -4,7 +4,7 @@
-
Encode W3 Day
+ Encode Intro Session
diff --git a/Frontend/package.json b/Frontend/package.json
index dfd5524..74c9676 100644
--- a/Frontend/package.json
+++ b/Frontend/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "dev": "vite",
+ "dev": "vite --host",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
diff --git a/Frontend/pages/Admin.jsx b/Frontend/pages/Admin.jsx
new file mode 100644
index 0000000..3cc86c0
--- /dev/null
+++ b/Frontend/pages/Admin.jsx
@@ -0,0 +1,107 @@
+import React, { useEffect, useState } from 'react';
+import axios from 'axios';
+import '../src/Admin.css'; // Import the CSS file for styling
+
+const Admin = () => {
+ const [password, setPassword] = useState('');
+ const [isAuthenticated, setIsAuthenticated] = useState(false);
+ const [error, setError] = useState('');
+ const [leaderboard, setLeaderboard] = useState([]);
+ const [LBButtonClicked, setLBButtonClicked] = useState(false);
+ const correctPassword = import.meta.env.VITE_ADMIN_PASSWORD;
+ const backendRoute = import.meta.env.VITE_BACKEND_ROUTE;
+
+ useEffect(() => {
+ setLBButtonClicked(false);
+ }, []); // Adding an empty dependency array to run the effect only once on mount
+
+ const handlePasswordChange = (e) => {
+ setPassword(e.target.value);
+ };
+
+ const handleLogin = () => {
+ if (password === correctPassword) {
+ setIsAuthenticated(true);
+ setError('');
+ } else {
+ setError('Incorrect password. Please try again.');
+ }
+ };
+
+ const handleClearUsers = async () => {
+ try {
+ await axios.delete(`${backendRoute}/clear`);
+ alert('All users cleared successfully.');
+ setLeaderboard([]); // Clear leaderboard after users are deleted
+ setLBButtonClicked(true);
+ } catch (error) {
+ console.error('Error clearing users:', error);
+ alert('Failed to clear users.');
+ }
+ };
+
+ const handleShowLeaderboard = async () => {
+ try {
+ const response = await axios.get(`${backendRoute}/`);
+ setLeaderboard(response.data.users); // Update state with leaderboard data
+ setLBButtonClicked(true);
+ } catch (error) {
+ console.error('Error fetching leaderboard:', error);
+ alert('Failed to fetch leaderboard.');
+ }
+ };
+
+ return (
+
+ {!isAuthenticated ? (
+
+
Admin Login
+
+
+ {error &&
{error}
}
+
+ ) : (
+
+
+
+
+ {LBButtonClicked && (
+ leaderboard.length > 0 ? (
+
+
Leaderboard
+
+
+
+ | Name |
+ Roll Number |
+ Score |
+
+
+
+ {leaderboard.map((user, index) => (
+
+ | {user.name} |
+ {user.rollNo} |
+ {user.score} |
+
+ ))}
+
+
+
+ ) : (
+
No Users Yet!
+ )
+ )}
+
+ )}
+
+ );
+};
+
+export default Admin;
diff --git a/Frontend/pages/Home.jsx b/Frontend/pages/Home.jsx
index 6b896ae..1e98b60 100644
--- a/Frontend/pages/Home.jsx
+++ b/Frontend/pages/Home.jsx
@@ -1,61 +1,62 @@
import { useState, useEffect } from 'react';
import Logo from '../src/assets/encode.jpeg';
-import { Modal } from 'react-responsive-modal';
-import 'react-responsive-modal/styles.css';
import "../src/App.css";
import KBC from "../src/assets/kbc.gif";
import WRONG from "../src/assets/wrong.gif";
const Home = () => {
- const [open, setOpen] = useState(false);
- const [question, setQuestion] = useState(null);
+ const [questions, setQuestions] = useState([]);
const [buttonClicked, setButtonClicked] = useState(false);
+ const [submitted, setSubmitted] = useState(false);
const [selectedOption, setSelectedOption] = useState(null);
const [result, setResult] = useState(null);
- const [istTime, setIstTime] = useState('');
+ const [name, setName] = useState('');
+ const [rollNumber, setRollNumber] = useState('');
+ const [score, setScore] = useState(0);
+ const [questionIndex, setQuestionIndex] = useState(0);
+ const backendRoute = import.meta.env.VITE_BACKEND_ROUTE;
- const onOpenModal = () => {
- setIstTime(getISTTime()); // Update IST time when modal opens
- setOpen(true);
- };
- const onCloseModal = () => {
- setOpen(false);
- setButtonClicked(false);
- };
-
- const getISTTime = () => {
- const now = new Date();
- const istOffset = 5.5 * 60; // 5 hours 30 minutes
- const localOffset = now.getTimezoneOffset(); // Get the local timezone offset in minutes
- const istTime = new Date(now.getTime() + (istOffset + localOffset) * 60 * 1000);
-
- return istTime.toLocaleTimeString('en-IN', { timeZone: 'Asia/Kolkata' });
- };
+ useEffect(() => {
+ // Check if the user has already submitted the quiz
+ const hasSubmitted = localStorage.getItem('quizSubmitted');
+ if (hasSubmitted) {
+ setSubmitted(true);
+ }
+ }, []);
- const fetchQuestion = async () => {
+ const fetchQuestions = async () => {
try {
- const response = await fetch('http://localhost:7000/api/random-question');
+ const response = await fetch(`${backendRoute}/all-questions`);
const data = await response.json();
- setQuestion(data);
+ setQuestions(shuffleArray(data));
} catch (error) {
- console.error('Error fetching the question:', error);
+ console.error('Error fetching the questions:', error);
}
};
+ const shuffleArray = (array) => {
+ return array.sort(() => Math.random() - 0.5);
+ };
+
const submitAnswer = async (option) => {
try {
- const response = await fetch('http://localhost:7000/api/check-answer', {
+ const response = await fetch(`${backendRoute}/check-answer`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- questionId: question._id,
+ questionId: questions[questionIndex]._id,
selectedOption: option
})
});
const data = await response.json();
- setResult(data.isCorrect ? 'Correct!' : 'Incorrect!');
+ if (data.isCorrect) {
+ setScore(score + 1);
+ setResult('Correct!');
+ } else {
+ setResult('Incorrect!');
+ }
} catch (error) {
console.error('Error submitting the answer:', error);
}
@@ -64,7 +65,57 @@ const Home = () => {
const handleOptionClick = (option) => {
setSelectedOption(option);
submitAnswer(option);
- onOpenModal();
+ };
+
+ const handleNextQuestion = () => {
+ if (questionIndex < 9) {
+ setQuestionIndex(questionIndex + 1);
+ setResult(null);
+ setSelectedOption(null);
+ }
+ };
+
+ const handleStartQuiz = () => {
+ if (name && rollNumber) {
+ fetchQuestions();
+ setButtonClicked(true);
+ setScore(0);
+ setQuestionIndex(0);
+ } else {
+ alert("Please enter your Name and Roll Number.");
+ }
+ };
+
+ const handleSubmitQuiz = async () => {
+ try {
+ const response = await fetch(`${backendRoute}/create`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ name: name,
+ rollNo: rollNumber,
+ score: score
+ })
+ });
+
+ if (response.ok) {
+ const data = await response.json();
+ console.log('User created successfully:', data.user);
+ // Store a flag in localStorage to indicate the quiz has been submitted
+ localStorage.setItem('quizSubmitted', 'true');
+ } else {
+ const data = await response.json();
+ console.error('Failed to create user:', data.message);
+ }
+ } catch (error) {
+ console.error('Error submitting the quiz:', error.message);
+ }
+ setSubmitted(true);
+ setButtonClicked(false);
+ setName("");
+ setRollNumber("");
};
return (
@@ -73,54 +124,76 @@ const Home = () => {
-

+
-
🔍
World Wide Web Day
+
🔍
Encode Introductory Session Quiz
-
Congrats on reaching the last round!
- {buttonClicked === false &&
}
- {buttonClicked === true && question && (
+ {buttonClicked && !submitted && (
+
+
Score: {score}
+
+ )}
+
+ {submitted && (
+
+
Thank you for taking the Quiz!
+
+ )}
+
+ {!buttonClicked && !submitted && (
+
+
Enter your details!
+ setName(e.target.value)}
+ className="input-field"
+ />
+ setRollNumber(e.target.value)}
+ className="input-field"
+ />
+
+
+ )}
+ {buttonClicked && questions.length > 0 && questionIndex < 10 && (
-
Final Question:
-
+
Question {questionIndex + 1}:
+
{questions[questionIndex].question}
- {question.options.map((option, index) => (
-
+ {result && (
+
+
{result}
+ {questionIndex < 9 ? (
+ Next Question
+ ) : (
+ Submit final Score!
+ )}
+
+ )}
)}
-
- {result === "Correct!" ? (
-
-
{result}
-

-
Time: {istTime}
-
- ) : (
-
-
{result}
-

-
Time: {istTime}
-
- )}
-
);
};
diff --git a/Frontend/src/Admin.css b/Frontend/src/Admin.css
new file mode 100644
index 0000000..371deb6
--- /dev/null
+++ b/Frontend/src/Admin.css
@@ -0,0 +1,112 @@
+.admin-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ height: 100vh;
+ background-color: #f4f4f4;
+}
+
+.login-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20px;
+ background-color: #fff;
+ border-radius: 10px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+}
+
+h2, h3 {
+ margin-bottom: 20px;
+ color: #333;
+}
+
+.password-input {
+ padding: 10px;
+ margin-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 5px;
+ width: 100%;
+}
+
+.login-button {
+ padding: 10px 20px;
+ background-color: #007bff;
+ color: #fff;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+}
+
+.login-button:hover {
+ background-color: #0056b3;
+}
+
+.error-message {
+ color: red;
+ margin-top: 10px;
+}
+
+.admin-actions {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+
+.action-button {
+ padding: 10px 20px;
+ margin: 10px 0;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+ width: 200px;
+ text-align: center;
+}
+
+.clear-button {
+ background-color: #dc3545;
+ color: #fff;
+}
+
+.clear-button:hover {
+ background-color: #c82333;
+}
+
+.leaderboard-button {
+ background-color: #28a745;
+ color: #fff;
+}
+
+.leaderboard-button:hover {
+ background-color: #218838;
+}
+.leaderboard-table {
+ margin-top: 20px;
+ width: 100%;
+ max-height: 400px; /* Adjust the height as needed */
+ overflow-y: auto; /* Enable vertical scrolling */
+ overflow-x: auto; /* Enable horizontal scrolling */
+ border: 1px solid #ddd; /* Optional: Add a border around the table for better visibility */
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+ min-width: 600px; /* Ensure table doesn't shrink too much */
+}
+
+th, td {
+ padding: 10px;
+ text-align: left;
+ border-bottom: 1px solid #ddd;
+}
+
+th {
+ background-color: #f2f2f2;
+ color: #333;
+}
+
+tr:hover {
+ background-color: #f5f5f5;
+}
diff --git a/Frontend/src/App.css b/Frontend/src/App.css
index fe98225..2ef178b 100644
--- a/Frontend/src/App.css
+++ b/Frontend/src/App.css
@@ -1,222 +1,3 @@
-/* @import url('https://fonts.googleapis.com/css2?family=Lilita+One&display=swap');
-@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
-
-
-*{
- margin: 0;
- padding: 0;
-}
-.home{
- width: 100vw;
- height: 100vh;
- background-image: url('../src/assets/bg.png');
- background-size: cover;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.content{
- width: 90%;
- height: 85%;
- border: 3px solid black;
- background: linear-gradient(to top right, #ec77ab, #7873f5);
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-}
-
-.navbar{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10px 20px;
-}
-
-.left p{
- font-family: "Poppins";
- font-weight: 500;
- font-size: 20px;
-}
-
-.left{
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 10px;
-}
-
-.left .logo{
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.left .logo img{
- width: 30px;
- border-radius: 50%;
-}
-
-.center{
- background-color: white;
- width: 800px;
- padding: 5px 20px;
- border-radius: 50px;
- display: flex;
- justify-content: space-between;
-}
-
-.center p{
- font-family: "Poppins";
-}
-
-.browser-buttons {
- display: flex;
- gap: 20px;
-}
-
-.browser-buttons .button {
- width: 15px;
- height: 15px;
- display: inline-block;
- cursor: pointer;
- position: relative;
-}
-
-.browser-buttons .minimize::before,
-.browser-buttons .maximize::before,
-.browser-buttons .close::before {
- content: "";
- position: absolute;
- width: 15px;
- height: 2px;
- background-color: black;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
-}
-
-.browser-buttons .maximize::before {
- width: 13px;
- height: 13px;
- border: 2px solid black;
- background-color: transparent;
-}
-
-.browser-buttons .close::before {
- width: 2px;
- height: 20px;
- transform: translate(-50%, -50%) rotate(45deg);
-}
-
-.browser-buttons .close::after {
- content: "";
- position: absolute;
- width: 2px;
- height: 20px;
- background-color: black;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%) rotate(-45deg);
-}
-
-.main{
- padding: 30px;
- background-color: white;
- height: 75%;
- width: 92%;
- margin: auto auto;
- border: 3px solid black;
- display: flex;
- flex-direction: column;
- gap: 20px;
- align-items: center;
-}
-
-.main h2{
- font-family: "Poppins";
- font-weight: 500;
- text-align: center;
-}
-
-.main .q-button {
- padding: 10px;
- background-color: #56c0f0;
- font-size: 15px;
- font-family: "Poppins";
- font-weight: 500;
- border-radius: 5px;
- cursor: pointer;
- box-shadow: 2px 2px 5px grey;
-}
-
-.main .q-button button:hover{
- transform: scale(1.1);
-}
-
-.question-container{
- display: flex;
- flex-direction: column;
- gap: 30px;
- width: 100%;
-}
-
-.question-container h3{
- font-family: "Poppins";
- text-align: center;
-
-}
-
-.question{
- font-size: 30px;
- font-family: "Poppins";
- background-color: #56c0f0;
- border: 3px solid #224c8d;
- padding: 30px;
- border-radius: 10px;
-}
-
-.options{
- display: grid;
- grid-template-columns: auto auto;
- gap: 30px;
-
-}
-
-.options button{
- padding: 15px;
- background-color: #56c0f0;
- border: 3px solid #224c8d;
- cursor: pointer;
- font-size: 20px;
-}
-
-.options button:hover{
- background-color: #224c8d;
- border: 3px solid #56c0f0;
- color: white;
-}
-
-.modal-text{
- padding: 30px;
- color: white;
-}
-
-.modal-div{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 20px;
- padding: 50px;
-
-}
-
-.modal-div p{
- font-size: 20px;
- color: white;
- font-family: "Poppins";
-} */
@import url('https://fonts.googleapis.com/css2?family=Lilita+One&display=swap');
@@ -292,8 +73,8 @@ body, html {
.center {
background-color: white;
- width: 800px;
- padding: 5px 20px;
+ width: 50vw;
+ padding: 1vh 3vw;
border-radius: 50px;
display: flex;
justify-content: space-between;
@@ -301,6 +82,7 @@ body, html {
.center p {
font-family: "Poppins";
+ font-size: 1.8vw;
}
.browser-buttons {
@@ -354,9 +136,9 @@ body, html {
}
.main {
- padding: 30px;
+ padding: 2vw;
background-color: white;
- width: 92%;
+ width: 83vw;
margin: 20px auto;
border: 3px solid black;
display: flex;
@@ -389,7 +171,7 @@ body, html {
.question-container {
display: flex;
flex-direction: column;
- gap: 30px;
+ gap: 20px;
width: 100%;
}
@@ -399,26 +181,31 @@ body, html {
}
.question {
- font-size: 30px;
+ font-size: 2.5vw;
font-family: "Poppins";
background-color: #56c0f0;
border: 3px solid #224c8d;
- padding: 30px;
+ padding: 1vw 2vw;
border-radius: 10px;
}
.options {
display: grid;
grid-template-columns: auto auto;
- gap: 30px;
+ gap: 20px;
}
.options button {
- padding: 15px;
+ padding: 1vw;
background-color: #56c0f0;
border: 3px solid #224c8d;
cursor: pointer;
- font-size: 20px;
+ font-size: 1.8vw;
+}
+
+.options .option-clicked{
+ background-color: #6389c2;
+ pointer-events: none;
}
.options button:hover {
@@ -427,6 +214,7 @@ body, html {
color: white;
}
+
.modal-text {
padding: 30px;
color: white;
@@ -446,3 +234,173 @@ body, html {
color: white;
font-family: "Poppins";
}
+
+.form{
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+
+.form input{
+ padding: 10px;
+ border: 2px solid black;
+ color: black;
+}
+
+.result-container{
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ align-items: center;
+ justify-content: center;
+}
+
+.result-container button{
+ padding: 10px;
+ background-color: #7873f5;
+ color: white;
+ cursor: pointer;
+ border-radius: 5px;
+}
+
+.score-display{
+ background-color: #ec77ab;
+ padding: 10px;
+ border-radius: 10px;
+
+}
+
+.score-display h3{
+ font-family: "Poppins";
+ font-weight: 500;
+}
+
+@media(max-width: 720px){
+ .question-container{
+ gap: 15px;
+ }
+
+ .options{
+ gap: 15px;
+ }
+ .options button{
+ font-size: 2vw;
+ }
+ .question{
+ font-size: 3vw;
+ }
+ .center p{
+ font-size: 2vw;
+ }
+ .center{
+ width: 40vw;
+ }
+ .score-display, .result-container button{
+ padding: 5px;
+ }
+
+ .result-container h2{
+ font-size: 17px;
+ }
+ .score-display h3{
+ font-size: 15px;
+ }
+}
+
+@media(max-width: 480px){
+ .options button{
+ font-size: 2.5vw;
+ }
+ .question{
+ font-size: 3.5vw;
+ }
+ .main{
+ width: 80vw;
+ padding: 4.5vw 2vw;
+ }
+}
+/*
+@media (max-width: 1110px){
+ .center{
+ width: 500px;
+ }
+}
+
+@media (max-width: 790px){
+ .center{
+ width: 400px;
+ }
+
+ .main{
+ width: 85%;
+ }
+}
+
+@media (max-width: 660px){
+ .center{
+ width: 300px;
+ }
+
+ .main{
+ width: 80%;
+ }
+
+ .question p{
+ font-size: 20px;
+ }
+
+ .options button{
+ font-size: 15px;
+ }
+}
+
+@media (max-width: 480px){
+ .center{
+ width: 280px;
+ }
+ .center p{
+ font-size: 14px;;
+ }
+ .browser-buttons{
+ display: none;
+ }
+ .main{
+ width: 80%;
+ }
+
+ .question{
+ padding: 20px;
+ }
+
+ .question p{
+ font-size: 15px;
+ }
+
+ .options button{
+ padding: 10px;
+ font-size: 13px;
+ }
+}
+
+@media (max-width: 380px){
+ .center{
+ width: 230px;
+ }
+ .center p{
+ font-size: 10px;;
+ }
+ .browser-buttons{
+ display: none;
+ }
+ .main{
+ width: 75%;
+ }
+
+ .question p{
+ font-size: 13px;
+ }
+
+ .options button{
+ font-size: 12px;
+ }
+} */
\ No newline at end of file
diff --git a/Frontend/src/App.jsx b/Frontend/src/App.jsx
index 1ac71b4..1157097 100644
--- a/Frontend/src/App.jsx
+++ b/Frontend/src/App.jsx
@@ -1,7 +1,7 @@
import React from "react";
import Home from "../pages/Home";
import { RouterProvider, createBrowserRouter, Routes, Route} from "react-router-dom"
-import Result from "../pages/Result";
+import Admin from "../pages/Admin";
const router = createBrowserRouter([
{
@@ -9,8 +9,8 @@ const router = createBrowserRouter([
element:
},
{
- path: "/result",
- element:
+ path: "/admin",
+ element:
}
])
diff --git a/Frontend/vercel.json b/Frontend/vercel.json
new file mode 100644
index 0000000..b73cda2
--- /dev/null
+++ b/Frontend/vercel.json
@@ -0,0 +1,5 @@
+{
+ "rewrites": [
+ { "source": "/(.*)", "destination": "/" }
+ ]
+ }
\ No newline at end of file