Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes:-174 Migrate <a> Tags to React Router DOM #174 #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions eduaid_web/src/pages/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import "../index.css";
import logo from "../assets/aossie_logo.png";
import starsImg from "../assets/stars.png";
Expand Down Expand Up @@ -92,20 +93,20 @@ const Home = () => {
</div>
<div className="flex justify-center gap-6">
<div className="mt-8 rounded-2xl">
<a href="question-type">
<Link to="/question-type">
<button className="items-center text-lg flex justify-center gap-4 text-white px-6 py-3 mx-auto mt-6 border-gradient hover:wave-effect rounded-md">
Lets get Started{" "}
Let's get Started{" "}
<img src={arrow} width={28} height={24} alt="" />
</button>
</a>
</Link>
</div>
<div className="mt-8 rounded-2xl">
<a href="history">
<Link to="/history">
<button className="items-center text-lg flex justify-center gap-4 text-white px-6 py-3 mx-auto mt-6 border-gradient hover:wave-effect rounded-md">
Your previous Work!
<img src={arrow} width={28} height={24} alt="" />
</button>
</a>
</Link>
</div>
</div>
<a
Expand Down
5 changes: 3 additions & 2 deletions eduaid_web/src/pages/Output.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from "react";
import { PDFDocument, rgb } from "pdf-lib";
import { Link } from "react-router-dom";
import "../index.css";
import logo from "../assets/aossie_logo.png";
import logoPNG from "../assets/aossie_logo_transparent.png";
Expand Down Expand Up @@ -347,7 +348,7 @@ const Output = () => {
<div className="popup w-full h-full bg-[#02000F] flex justify-center items-center">
<div className="w-full h-full bg-cust bg-opacity-50 bg-custom-gradient">
<div className="flex flex-col h-full">
<a href="/">
<Link to="/">
<div className="flex items-end gap-[2px]">
<img src={logo} alt="logo" className="w-16 my-4 ml-4 block" />
<div className="text-2xl mb-3 font-extrabold">
Expand All @@ -359,7 +360,7 @@ const Output = () => {
</span>
</div>
</div>
</a>
</Link>
<div className="font-bold text-xl text-white mt-3 mx-2">
Generated Questions
</div>
Expand Down
10 changes: 6 additions & 4 deletions eduaid_web/src/pages/Previous.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from "react";
import { Link, useNavigate } from "react-router-dom";
import "../index.css";
import logo from "../assets/aossie_logo.png";
import stars from "../assets/stars.png";
import { FaArrowRight } from "react-icons/fa";

const Previous = () => {
const navigate = useNavigate();
const getQuizzesFromLocalStorage = () => {
const quizzes = localStorage.getItem("last5Quizzes");
return quizzes ? JSON.parse(quizzes) : [];
Expand All @@ -14,7 +16,7 @@ const Previous = () => {

const handleQuizClick = (quiz) => {
localStorage.setItem("qaPairs", JSON.stringify(quiz.qaPair));
window.location.href = "/output";
navigate("/output");
};

const handleClearQuizzes = () => {
Expand All @@ -23,13 +25,13 @@ const Previous = () => {
};

const handleBack = () => {
window.location.href = "/";
navigate("/");
};

return (
<div className="popup w-screen h-screen bg-[#02000F] flex flex-col justify-center items-center">
<div className="w-full h-full bg-cust bg-opacity-50 bg-custom-gradient">
<a href="/">
<Link to="/">
<div className="flex items-end gap-[2px]">
<img src={logo} alt="logo" className="w-16 my-4 ml-4 block" />
<div className="text-2xl mb-3 font-extrabold">
Expand All @@ -41,7 +43,7 @@ const Previous = () => {
</span>
</div>
</div>
</a>
</Link>
<div className="text-right mt-[-8px] mx-1">
<div className="text-white text-xl font-bold">Quiz Dashboard</div>
<div className="text-white text-right justify-end flex gap-2 text-xl font-bold">
Expand Down
11 changes: 6 additions & 5 deletions eduaid_web/src/pages/Question_Type.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import "../index.css";
import logo from "../assets/aossie_logo.png";

Expand All @@ -18,8 +19,8 @@ const Question_Type = () => {
return (
<div className="popup w-screen h-screen bg-[#02000F] flex justify-center items-center">
<div className="w-full h-full bg-cust bg-opacity-50 bg-custom-gradient p-6">
<a href="/">
<div className="flex items-end gap-4">
<Link to="/">
<div className="flex items-end gap-[2px]">
<img src={logo} alt="logo" className="w-24 my-6 block" />
<div className="text-5xl mb-5 font-extrabold">
<span className="bg-gradient-to-r from-[#FF005C] to-[#7600F2] text-transparent bg-clip-text">
Expand All @@ -30,7 +31,7 @@ const Question_Type = () => {
</span>
</div>
</div>
</a>
</Link>
<div className="text-4xl mt-6 text-white text-center font-extrabold">
What’s on your Mind?
</div>
Expand Down Expand Up @@ -99,14 +100,14 @@ const Question_Type = () => {
</div>
<div className="mx-auto text-center mt-10">
{selectedOption ? (
<a href="input">
<Link to="/input">
<button
onClick={handleSaveToLocalStorage}
className="rounded-2xl text-2xl text-white w-fit px-8 font-bold py-3 bg-gradient-to-r from-[#FF005C] via-[#7600F2] to-[#00CBE7]"
>
Fire Up{" "}🚀
</button>
</a>
</Link>
) : (
<button
onClick={() => alert("Please select a question type.")}
Expand Down
13 changes: 7 additions & 6 deletions eduaid_web/src/pages/Text_Input.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useRef } from "react";
import { Link, useNavigate } from "react-router-dom";
import "../index.css";
import logo from "../assets/aossie_logo.png";
import stars from "../assets/stars.png";
Expand All @@ -7,6 +8,7 @@ import { FaClipboard } from "react-icons/fa";
import Switch from "react-switch";

const Text_Input = () => {
const navigate = useNavigate();
const [text, setText] = useState("");
const [difficulty, setDifficulty] = useState("Easy Difficulty");
const [numQuestions, setNumQuestions] = useState(10);
Expand Down Expand Up @@ -87,6 +89,7 @@ const Text_Input = () => {
difficulty,
localStorage.getItem("selectedQuestionType")
);
navigate("/output");
}
};

Expand Down Expand Up @@ -149,8 +152,6 @@ const Text_Input = () => {
last5Quizzes.shift(); // Keep only the last 5 quizzes
}
localStorage.setItem("last5Quizzes", JSON.stringify(last5Quizzes));

window.location.href = "output";
} else {
console.error("Backend request failed.");
}
Expand All @@ -173,7 +174,7 @@ const Text_Input = () => {
loading ? "pointer-events-none" : ""
}`}
>
<a href="/">
<Link to="/">
<div className="flex items-end gap-[2px]">
<img src={logo} alt="logo" className="w-24 my-6 ml-6 block" />
<div className="text-4xl mb-5 font-extrabold">
Expand All @@ -185,7 +186,7 @@ const Text_Input = () => {
</span>
</div>
</div>
</a>
</Link>
<div className="text-right mt-[-8px] mx-1">
<div className="text-white text-xl font-bold">Enter the Content</div>
<div className="text-white text-right justify-end flex gap-2 text-xl font-bold">
Expand Down Expand Up @@ -294,11 +295,11 @@ const Text_Input = () => {
</div>
</div>
<div className="flex justify-center gap-8 my-6">
<a href="question-type">
<Link to="/question-type">
<button className="bg-black items-center text-xl text-white px-4 py-2 border-gradient">
Back
</button>
</a>
</Link>
{/* <a href="output"> */}
<button
onClick={handleSaveToLocalStorage}
Expand Down