diff --git a/eduaid_web/src/App.test.js b/eduaid_web/src/App.test.js index 1f03afe..27468e8 100644 --- a/eduaid_web/src/App.test.js +++ b/eduaid_web/src/App.test.js @@ -1,8 +1,21 @@ import { render, screen } from '@testing-library/react'; import App from './App'; -test('renders learn react link', () => { +test('renders EduAid title and start button', () => { render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); + + // Check for the EduAid title + const eduElement = screen.getByText(/Edu/i); + const aidElement = screen.getByText(/Aid/i); + expect(eduElement).toBeInTheDocument(); + expect(aidElement).toBeInTheDocument(); + + // Check for the "Let's get Started" button + const startButton = screen.getByText(/Let's get Started/i); + expect(startButton).toBeInTheDocument(); + + // Check for the description text + const descriptionElement = screen.getByText(/A tool that can auto-generate short quizzes based on user input/i); + expect(descriptionElement).toBeInTheDocument(); }); + diff --git a/eduaid_web/src/index.css b/eduaid_web/src/index.css index 31dc491..4bf1c5d 100644 --- a/eduaid_web/src/index.css +++ b/eduaid_web/src/index.css @@ -14,12 +14,4 @@ body { code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; -} - -.border-gradient { - border-width: 2px; - border-style: solid; - border-image: linear-gradient(to right, #ff005c, #7600f2, #00cbe7); - border-image-slice: 1; - border-radius: 2rem; } \ No newline at end of file diff --git a/eduaid_web/src/pages/Home.jsx b/eduaid_web/src/pages/Home.jsx index ec3a412..77adeb3 100644 --- a/eduaid_web/src/pages/Home.jsx +++ b/eduaid_web/src/pages/Home.jsx @@ -1,9 +1,5 @@ import React, { useState, useEffect } from "react"; -import "../index.css"; import logo from "../assets/aossie_logo.png"; -import starsImg from "../assets/stars.png"; -import arrow from "../assets/arrow.png"; -import gitStar from "../assets/gitStar.png"; import { FaGithub } from "react-icons/fa"; const Home = () => { @@ -22,7 +18,7 @@ const Home = () => { } function isMoreThanOneDayOld(timestamp) { - const oneDay = 24 * 60 * 60 * 1000; // One day in milliseconds + const oneDay = 24 * 60 * 60 * 1000; return Date.now() - timestamp > oneDay; } @@ -49,89 +45,62 @@ const Home = () => { }, []); return ( -
-
-
- logo -
- - Edu - - - Aid - +
+
+ AOSSIE logo +
+ +
+

+ Edu + Aid +

+ +

+ A tool that can auto-generate short quizzes based on user input +

+ +
+
+ Doc/Audio Input
-
-
A tool that can auto-generate short quizzes
-
- based on user input{" "} - -
+
+ In-depth questions gen
-
-
-
- -
Doc/Audio Input
-
-
-
-
- -
In-depth questions gen
-
-
-
-
- -
- Dynamic Google Form Integration -
-
-
+
+ Dynamic Google Form Integration
- - -
- -
- {stars !== null ? ( - - {stars} - - - ) : ( - {error} - )} -
-
+
+ + -
+
+ +
); }; -export default Home; +export default Home; \ No newline at end of file diff --git a/eduaid_web/src/pages/Output.jsx b/eduaid_web/src/pages/Output.jsx index 126aec1..1d2a50f 100644 --- a/eduaid_web/src/pages/Output.jsx +++ b/eduaid_web/src/pages/Output.jsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from "react"; import { PDFDocument } from "pdf-lib"; -import "../index.css"; import logo from "../assets/aossie_logo.png"; +import { FaFilePdf, FaGoogle } from "react-icons/fa"; const Output = () => { const [qaPairs, setQaPairs] = useState([]); @@ -244,87 +244,72 @@ const Output = () => { }; return ( -
-
-
- -
- logo -
- - Edu - - - Aid - -
-
-
-
- Generated Questions +
+
+ + logo +
+ Edu + Aid
-
+ +
+
+ {qaPairs && qaPairs.map((qaPair, index) => { + const combinedOptions = qaPair.options + ? [...qaPair.options, qaPair.answer] + : [qaPair.answer]; + const shuffledOptions = shuffleArray(combinedOptions); + return ( +
+

+ Question {index + 1} +

+

{qaPair.question}

+ {qaPair.question_type !== "Boolean" && ( + <> +

Answer

+

{qaPair.answer}

+ {qaPair.options && qaPair.options.length > 0 && ( +
+

Options

+
    + {shuffledOptions.map((option, idx) => ( +
  • {option}
  • + ))} +
+
)} -
- ); - })} -
-
- - -
+ + )} +
+ ); + })}
-
+ + +
+ + +
); }; -export default Output; +export default Output; \ No newline at end of file diff --git a/eduaid_web/src/pages/Previous.jsx b/eduaid_web/src/pages/Previous.jsx index 608eeaa..dbc5dfe 100644 --- a/eduaid_web/src/pages/Previous.jsx +++ b/eduaid_web/src/pages/Previous.jsx @@ -1,8 +1,6 @@ import React from "react"; -import "../index.css"; import logo from "../assets/aossie_logo.png"; -import stars from "../assets/stars.png"; -import { FaArrowRight } from "react-icons/fa"; +import { FaArrowRight, FaTrash, FaChevronLeft } from "react-icons/fa"; const Previous = () => { const getQuizzesFromLocalStorage = () => { @@ -27,82 +25,68 @@ const Previous = () => { }; return ( -
-
- -
- logo -
- - Edu - - - Aid - -
+
+
+ + logo +
+ Edu + Aid
-
-
Quiz Dashboard
-
- Your{" "} - - Generated Quizzes - {" "} - stars -
-
-
- - Your Quizzes - {" "} -
-
+

Quiz Dashboard

+
+ +
+

+ Your Generated Quizzes +

+ +
{quizzes.length === 0 ? ( -
+
No quizzes available
) : ( -
    +
      {quizzes.map((quiz, index) => (
    • handleQuizClick(quiz)} > -
      -
      - {quiz.difficulty} - {quiz.numQuestions} Questions +
      +
      +
      + {quiz.difficulty} - {quiz.numQuestions} Questions +
      +
      {quiz.date}
      -
      {quiz.date}
      +
      -
    • ))}
    )}
-
-
- -
-
- -
-
-
+
+ +
+ + +
); }; -export default Previous; +export default Previous; \ No newline at end of file diff --git a/eduaid_web/src/pages/Question_Type.jsx b/eduaid_web/src/pages/Question_Type.jsx index 2068620..4ecc654 100644 --- a/eduaid_web/src/pages/Question_Type.jsx +++ b/eduaid_web/src/pages/Question_Type.jsx @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import "../index.css"; import logo from "../assets/aossie_logo.png"; const Question_Type = () => { @@ -15,111 +14,79 @@ const Question_Type = () => { } }; + const questionTypes = [ + { id: "get_shortq", label: "Short-Answer Type Questions" }, + { id: "get_mcq", label: "Multiple Choice Questions" }, + { id: "get_boolq", label: "True/False Questions" }, + { id: "get_problems", label: "All Questions" }, + ]; + return ( -
-
- -
- logo -
- - Edu - - - Aid - -
+
+
+ + logo +
+ Edu + Aid
-
- What’s on your Mind? -
-
+
+ +
+

+ What's on your Mind? +

+

Choose one +

+ +
+ {questionTypes.map((type) => ( + + ))}
-
-
handleOptionClick("get_shortq")} - className="flex my-3 items-center w-full max-w-lg cursor-pointer rounded-xl gap-6 px-6 py-6 bg-opacity-50 bg-[#202838]" - > -
-
- Short-Answer Type Questions -
-
-
handleOptionClick("get_mcq")} - className="flex my-3 items-center w-full max-w-lg cursor-pointer rounded-xl gap-6 px-6 py-6 bg-opacity-50 bg-[#202838]" - > -
-
- Multiple Choice Questions -
-
-
handleOptionClick("get_boolq")} - className="flex my-3 items-center w-full max-w-lg cursor-pointer rounded-xl gap-6 px-6 py-6 bg-opacity-50 bg-[#202838]" - > -
-
- True/False Questions -
-
-
handleOptionClick("get_problems")} - className="flex my-3 items-center w-full max-w-lg cursor-pointer rounded-xl gap-6 px-6 py-6 bg-opacity-50 bg-[#202838]" - > -
-
All Questions
-
-
-
+ +
{selectedOption ? ( ) : ( )}
-
+
); }; -export default Question_Type; +export default Question_Type; \ No newline at end of file diff --git a/eduaid_web/src/pages/Text_Input.jsx b/eduaid_web/src/pages/Text_Input.jsx index f89e079..58e9626 100644 --- a/eduaid_web/src/pages/Text_Input.jsx +++ b/eduaid_web/src/pages/Text_Input.jsx @@ -1,9 +1,6 @@ import React, { useState, useRef } from "react"; -import "../index.css"; import logo from "../assets/aossie_logo.png"; -import stars from "../assets/stars.png"; -import cloud from "../assets/cloud.png"; -import { FaClipboard } from "react-icons/fa"; +import { FaClipboard, FaCloudUploadAlt, FaGoogle, FaMinus, FaPlus, FaWikipediaW } from "react-icons/fa"; import Switch from "react-switch"; const Text_Input = () => { @@ -12,7 +9,6 @@ const Text_Input = () => { const [numQuestions, setNumQuestions] = useState(10); const [loading, setLoading] = useState(false); const fileInputRef = useRef(null); - const [fileContent, setFileContent] = useState(""); const [docUrl, setDocUrl] = useState(""); const [isToggleOn, setIsToggleOn] = useState(0); @@ -41,17 +37,14 @@ const Text_Input = () => { }; const handleClick = (event) => { - event.preventDefault(); // Prevent default behavior - event.stopPropagation(); // Stop event propagation - - // Open file input dialog + event.preventDefault(); + event.stopPropagation(); fileInputRef.current.click(); }; const handleSaveToLocalStorage = async () => { setLoading(true); - // Check if a Google Doc URL is provided if (docUrl) { try { const response = await fetch("http://localhost:5000/get_content", { @@ -77,7 +70,6 @@ const Text_Input = () => { setLoading(false); } } else if (text) { - // Proceed with existing functionality for local storage localStorage.setItem("textContent", text); localStorage.setItem("difficulty", difficulty); localStorage.setItem("numQuestions", numQuestions); @@ -134,7 +126,6 @@ const Text_Input = () => { const responseData = await response.json(); localStorage.setItem("qaPairs", JSON.stringify(responseData)); - // Save quiz details to local storage const quizDetails = { difficulty, numQuestions, @@ -146,7 +137,7 @@ const Text_Input = () => { JSON.parse(localStorage.getItem("last5Quizzes")) || []; last5Quizzes.push(quizDetails); if (last5Quizzes.length > 5) { - last5Quizzes.shift(); // Keep only the last 5 quizzes + last5Quizzes.shift(); } localStorage.setItem("last5Quizzes", JSON.stringify(last5Quizzes)); @@ -162,155 +153,123 @@ const Text_Input = () => { }; return ( -
+
{loading && ( -
-
+
+
)} -
- -
- logo -
- - Edu - - - Aid - -
+
+ + logo +
+ Edu + Aid
-
-
Enter the Content
-
- to Generate{" "} - - Questionaries - {" "} - stars -
-
+

Enter Content

+
-
- -