From 1823538058859a9c26e37538c945b0fb13e2b7c8 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 20 Mar 2024 12:46:55 +0000 Subject: [PATCH 1/2] Added a link for admins to go to the CMS --- src/dashboards/Admin.tsx | 8 ++++++++ src/dashboards/IconCard.tsx | 5 +++-- src/pages/profile.tsx | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/dashboards/Admin.tsx b/src/dashboards/Admin.tsx index e01360b7..b0255104 100644 --- a/src/dashboards/Admin.tsx +++ b/src/dashboards/Admin.tsx @@ -16,6 +16,8 @@ import { BsPencilSquare, BsBank, BsCurrencyDollar, + BsLayoutWtf, + BsLayoutSidebar, } from "react-icons/bs"; import UserCard from "@/components/UserCard"; import useGroups from "@/hooks/useGroups"; @@ -309,6 +311,12 @@ export default function AdminDashboard({user}: Props) { value={pending.length} color="rose" /> + router.push("https://cms.encoach.com/admin")} + Icon={BsLayoutSidebar} + label="Content Management System (CMS)" + color="green" + />
diff --git a/src/dashboards/IconCard.tsx b/src/dashboards/IconCard.tsx index 4a8ae2d5..5fd55486 100644 --- a/src/dashboards/IconCard.tsx +++ b/src/dashboards/IconCard.tsx @@ -4,8 +4,8 @@ import {IconType} from "react-icons"; interface Props { Icon: IconType; label: string; - value: string | number; - color: "purple" | "rose" | "red"; + value?: string | number; + color: "purple" | "rose" | "red" | "green"; tooltip?: string; onClick?: () => void; } @@ -15,6 +15,7 @@ export default function IconCard({Icon, label, value, color, tooltip, onClick}: purple: "text-mti-purple-light", red: "text-mti-red-light", rose: "text-mti-rose-light", + green: "text-mti-green-light", }; return ( diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index 68e652d2..d2031cd1 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -41,7 +41,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => { redirect: { destination: "/login", permanent: false, - } + }, }; } @@ -50,7 +50,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => { redirect: { destination: "/", permanent: false, - } + }, }; } From 06684a4900ac16e6d307b28818c08eb32a2fdc77 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 20 Mar 2024 21:24:09 +0000 Subject: [PATCH 2/2] Added the exam information to the ticket submission --- src/components/High/TicketSubmission.tsx | 15 ++++++ src/components/Navbar.tsx | 2 +- src/interfaces/ticket.ts | 58 ++++++++++++++---------- src/pages/tickets.tsx | 1 + 4 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/components/High/TicketSubmission.tsx b/src/components/High/TicketSubmission.tsx index 5671e738..3ff0ccb3 100644 --- a/src/components/High/TicketSubmission.tsx +++ b/src/components/High/TicketSubmission.tsx @@ -1,5 +1,6 @@ import {Ticket, TicketType, TicketTypeLabel} from "@/interfaces/ticket"; import {User} from "@/interfaces/user"; +import useExamStore from "@/stores/examStore"; import axios from "axios"; import {useState} from "react"; import {toast} from "react-toastify"; @@ -20,6 +21,8 @@ export default function TicketSubmission({user, page, onClose}: Props) { const [description, setDescription] = useState(""); const [isLoading, setIsLoading] = useState(false); + const examState = useExamStore((state) => state); + const submit = () => { if (!type) return toast.error("Please choose a type!", {toastId: "missing-type"}); if (subject.trim() === "") @@ -48,6 +51,18 @@ export default function TicketSubmission({user, page, onClose}: Props) { type, reportedFrom: page, description, + examInformation: + page.includes("exam") || page.includes("exercises") + ? { + exam: examState.exam?.id || "", + exams: examState.exams.map((x) => x.id), + exerciseIndex: examState.exerciseIndex, + moduleIndex: examState.moduleIndex, + partIndex: examState.partIndex, + questionIndex: examState.questionIndex, + selectedModules: examState.selectedModules, + } + : undefined, }; axios diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 103d772f..243746b6 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -75,7 +75,7 @@ export default function Navbar({user, path, navDisabled = false, focusMode = fal