diff --git a/client/src/screens/browse/components/year-info/index.jsx b/client/src/screens/browse/components/year-info/index.jsx
index 4cb893a3..85949c2c 100644
--- a/client/src/screens/browse/components/year-info/index.jsx
+++ b/client/src/screens/browse/components/year-info/index.jsx
@@ -20,11 +20,13 @@ const YearInfo = ({
courseCode,
course, // years list
currYear,
+
}) => {
const dispatch = useDispatch();
const [showConfirm, setShowConfirm] = useState(false);
const [showConfirmDel, setShowConfirmDel] = useState(false);
const [newYearName, setNewYearName] = useState("");
+ const [newprofName, setNewProfName] = useState("");
const [isAddingYear, setIsAddingYear] = useState(false);
const user = useSelector((state) => state.user.user);
const isReadOnlyCourse = user?.readOnly?.some(
@@ -48,6 +50,7 @@ const YearInfo = ({
if (isAddingYear) return;
setIsAddingYear(true);
const yearName = newYearName.trim();
+ const profName = newprofName.trim();
if (!yearName) {
setIsAddingYear(false);
@@ -75,6 +78,7 @@ const YearInfo = ({
const newYear = await addYear({
name: yearName.trim(),
course: courseCode,
+ profName: profName.trim(),
});
course.push(newYear);
@@ -179,6 +183,8 @@ const YearInfo = ({
// onInputChange={(e) => setNewFolderName(e.target.value)}
yearName={newYearName}
onYearNameChange={setNewYearName}
+ profName={newprofName}
+ onProfNameChange={setNewProfName}
onConfirm={handleConfirmAddYear}
onCancel={() => setShowConfirm(false)}
confirmText="Create"
diff --git a/client/src/screens/browse/index.jsx b/client/src/screens/browse/index.jsx
index f8843457..4360d94e 100644
--- a/client/src/screens/browse/index.jsx
+++ b/client/src/screens/browse/index.jsx
@@ -483,28 +483,23 @@ const BrowseScreen = () => {
) : (
MY COURSES
- {user.user?.courses?.map((course, idx) => {
- return (
-
- );
- })}
- {user.localCourses?.map((course, idx) => {
- return (
-
- );
- })}
+ {user.user?.courses?.map((course, idx) => (
+
+ ))}
+ {user.localCourses?.map((course, idx) => (
+
+ ))}
{user.user?.readOnly?.length > 0 && OTHERS
}
-
{user.user?.readOnly?.map((course, idx) => (
{
)}
{user.user?.isBR &&
user.user?.previousCourses?.length > 0 &&
- user.user?.previousCourses?.map((course, idx) => {
- return (
-
- );
- })}
+ user.user?.previousCourses?.map((course, idx) => (
+
+ ))}
)}
{!isMobile && (
@@ -534,6 +527,7 @@ const BrowseScreen = () => {
isBR={user.user.isBR}
path={folderData?.path ? folderData.path : HeaderText}
name={folderData?.name ? folderData.name : HeaderText}
+ prof={folderData?.profName ? folderData.profName : ""}
canDownload={folderData?.childType === "File"}
contributionHandler={contributionHandler}
folderId={folderData?._id}
diff --git a/client/src/screens/browse/styles.scss b/client/src/screens/browse/styles.scss
index d8485cc4..9afbc48d 100644
--- a/client/src/screens/browse/styles.scss
+++ b/client/src/screens/browse/styles.scss
@@ -17,10 +17,12 @@
height: 1vh; // Extremely thin for very small screens
}
}
+
.controller {
&::-webkit-scrollbar {
display: none;
}
+
display: flex;
height: 92vh; // Keep original desktop height
@@ -36,11 +38,13 @@
@media (max-width: 480px) {
height: 98.8vh; // Compensate for 1.2vh navbar
}
+
.left {
flex: 3;
max-width: 300px;
border-right: 1px solid rgba(0, 0, 0, 0.33);
overflow-y: auto;
+
.heading {
padding: 10px 20px;
font-family: "Bold";
@@ -48,6 +52,7 @@
background-color: #fecf6f;
}
}
+
.middle {
flex: 6;
border-right: 1px solid rgba(0, 0, 0, 0.33);
@@ -59,26 +64,32 @@
flex-wrap: wrap;
// justify-content: space-between;
}
+
.empty-message {
font-size: 1.2rem;
}
+
&::-webkit-scrollbar {
display: none;
}
}
+
.right {
flex: 1;
max-width: 200px;
background-color: #000;
color: #fff;
+
.year-content {
display: flex;
flex-direction: column-reverse;
+
.year-title {
padding: 10px 20px;
font-family: "Bold";
font-size: 1.2rem;
}
+
.year {
cursor: pointer;
padding: 10px 20px;
@@ -87,9 +98,11 @@
display: flex;
align-items: center;
justify-content: space-between;
+
&.selected {
color: #000;
background-color: #fff;
+
.delete {
background: url(./components/browsefolder/Delete.svg), none;
@@ -109,10 +122,12 @@
border-radius: 2px;
}
}
+
&.selected:hover .delete {
opacity: 1;
}
}
+
&.add-year {
border-top: 1px solid #333;
margin-top: 10px;
@@ -245,11 +260,9 @@
box-shadow: 0 0 0 4px rgba(254, 207, 111, 0.12),
0 4px 12px rgba(254, 207, 111, 0.15);
transform: translateY(-2px); // More pronounced lift
- background: linear-gradient(
- 135deg,
- #ffffff 0%,
- #fffbf7 100%
- ); // Warm focus background
+ background: linear-gradient(135deg,
+ #ffffff 0%,
+ #fffbf7 100%); // Warm focus background
}
&:hover:not(:disabled) {
@@ -502,3 +515,38 @@
margin-bottom: 0;
}
}
+
+
+.input_profname {
+ width: 100%;
+ padding: 10px 12px;
+ border: 1px solid black;
+ border-radius: 0;
+ background-color: #fff;
+ font-size: 1rem;
+ color: #333;
+ margin-top: 6px;
+ margin-bottom: 12px;
+ box-sizing: border-box;
+ transition: border-color 0.2s;
+
+ &:focus {
+ outline: none;
+ border-color: #fecf6f;
+ box-shadow: 0 0 0 2px rgba(254, 207, 111, 0.2);
+ }
+
+ &::placeholder {
+ color: black;
+ font-style: italic;
+
+ }
+}
+
+.label_section {
+ font-weight: 600;
+ margin-bottom: 4px;
+ color: #333;
+ font-size: 0.95rem;
+ display: block;
+}
\ No newline at end of file
diff --git a/client/src/screens/dashboard/components/examcard/index.jsx b/client/src/screens/dashboard/components/examcard/index.jsx
index 9b8871bf..f2b4a205 100644
--- a/client/src/screens/dashboard/components/examcard/index.jsx
+++ b/client/src/screens/dashboard/components/examcard/index.jsx
@@ -1,7 +1,7 @@
import "./styles.scss";
-const ExamCard = ({ days, name, color }) => {
+const ExamCard = ({ days, name, color, onClick=()=>{} }) => {
return (
-
+
diff --git a/client/src/screens/dashboard/components/quizcard.jsx b/client/src/screens/dashboard/components/quizcard.jsx
new file mode 100644
index 00000000..0bd29ad1
--- /dev/null
+++ b/client/src/screens/dashboard/components/quizcard.jsx
@@ -0,0 +1,19 @@
+import React from "react";
+import "./quizcard.scss";
+
+const QuizCard = ({ code, name, date, time, color,children }) => {
+ return (
+ <>
+
+
{code}
+
{name}
+
{date}
+
{time}
+ {children}
+
+
+>
+ );
+};
+
+export default QuizCard;
diff --git a/client/src/screens/dashboard/components/quizcard.scss b/client/src/screens/dashboard/components/quizcard.scss
new file mode 100644
index 00000000..96eaa8b9
--- /dev/null
+++ b/client/src/screens/dashboard/components/quizcard.scss
@@ -0,0 +1,53 @@
+.quizcard {
+ width: 190px;
+ min-height: 150px;
+ background-color: #fff;
+ padding: 10px;
+ margin: 10px;
+ transition: 150ms ease;
+ position: relative;
+ flex-shrink: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ justify-content: flex-start;
+}
+
+.quizcard-code {
+ background-color: #000;
+ color: #fff;
+ padding: 3px 10px;
+ //text-align: center;
+ text-align: left;
+ font-family: "Bold";
+ font-size: 0.9rem;
+ margin-bottom: 10px;
+ margin-top: 0;
+ width: fit-content;
+}
+
+.quizcard-name {
+ color: #333;
+ font-family: "Bold";
+ font-size: 1.4rem;
+ text-align: left;
+ margin-bottom: 10px;
+ width: 100%;
+}
+
+.quizcard-date {
+ color: #555;
+ font-family: "Bold";
+ font-size: 1.1rem;
+ text-align: left;
+ margin-bottom: 10px;
+ width: 100%;
+}
+
+.quizcard-day {
+ color: #555;
+ font-family: "Bold";
+ font-size: 0.95em;
+ text-align: left;
+ width: 100%;
+}
\ No newline at end of file
diff --git a/client/src/screens/dashboard/index.jsx b/client/src/screens/dashboard/index.jsx
index b9b8f431..c4e3a432 100644
--- a/client/src/screens/dashboard/index.jsx
+++ b/client/src/screens/dashboard/index.jsx
@@ -7,8 +7,11 @@ import NavBar from "../../components/navbar";
import SubHeading from "../../components/subheading";
import CourseCard from "./components/coursecard";
import ContributionBanner from "./components/contributionbanner";
+import QuizCard from "./components/quizcard";
import Footer from "../../components/footer";
+
import FavouriteCard from "./components/favouritecard";
+import { getAllQuizEvents } from "../../api/Quiz";
import { ChangeCurrentCourse, ResetFileBrowserState } from "../../actions/filebrowser_actions";
import { useDispatch, useSelector } from "react-redux";
@@ -16,7 +19,7 @@ import { useNavigate } from "react-router-dom";
import formatName from "../../utils/formatName";
import formatBranch from "../../utils/formatBranch";
-import { useEffect, useState } from "react";
+import { useEffect, useState, useRef } from "react";
import { getColors } from "../../utils/colors";
import { LoadCourses } from "../../actions/filebrowser_actions";
import Contributions from "../contributions";
@@ -24,14 +27,17 @@ import { AddNewCourseLocal, ClearLocalCourses } from "../../actions/user_actions
import AddCourseModal from "./components/addcoursemodal";
import { AddNewCourseAPI, GetExamDates } from "../../api/User";
import { toast } from "react-toastify";
+import { getQuizEvents } from "../../api/Quiz";
const Dashboard = () => {
+ const [quizzes, setQuizzes] = useState([]);
const dispatch = useDispatch();
const navigate = useNavigate();
const user = useSelector((state) => state.user);
const [midSem, setMidSem] = useState(0);
const [endSem, setEndSem] = useState(0);
+ const [quizDate, setquizdate] = useState(0);
const contributionHandler = (event) => {
const collection = document.getElementsByClassName("contri");
@@ -102,6 +108,53 @@ const Dashboard = () => {
}
run();
}, []);
+ //
+ useEffect(() => {
+ const fetchQuizzes = async () => {
+ try {
+ const all_quizzes = await getAllQuizEvents();
+ if (!all_quizzes) {
+ console.log("Quizzes error fetching");
+ return;
+ }
+
+ console.log(all_quizzes);
+ const now = Date.now();
+
+ const user_quizzes = all_quizzes.filter((quiz) =>{
+ if(user?.user?.courses.find(course => course.code === quiz.course)){
+ if (new Date(quiz.eventDate).getTime() >= now){
+ return true;
+ }
+ else
+ return false;
+
+ }}
+ )
+ //user_quizzes.find().sort({eventDate:1})
+ setQuizzes(user_quizzes);
+
+ } catch (error) {
+ console.error("Error fetching quizzes:", error);
+ }
+ };
+
+ fetchQuizzes();
+ }, [user]);
+ useEffect(() => {
+ if (quizzes.length > 0 && quizzes[0]?.eventDate) {
+ const now = Date.now();
+
+ const daysTillQuiz = Math.ceil(
+ ((new Date(quizzes[0].eventDate).getTime()) - now) / (1000 * 3600 * 24)
+ );
+ console.log("daystill quiz:", daysTillQuiz);
+ setquizdate(daysTillQuiz);
+ }
+ }, [quizzes]);
+
+
+
const handleClick = (code) => {
let Code = code.replaceAll(" ", "");
@@ -137,12 +190,17 @@ const Dashboard = () => {
- {midSem >= 0 && (
+ {/* {midSem >= 0 && (
- )}
- {endSem >= 0 && (
-
- )}
+ )} */}
+ {(quizzes.length && quizDate > 0) &&
+ ({ navigate('/myquizzes')}} />)
+ }
+
+ {midSem > 0 ?
+ () :
+ ()
+ }
@@ -185,6 +243,50 @@ const Dashboard = () => {
}}
/> */}