diff --git a/client/src/Services/mindServices.js b/client/src/Services/mindServices.js
new file mode 100644
index 0000000..c87f127
--- /dev/null
+++ b/client/src/Services/mindServices.js
@@ -0,0 +1,37 @@
+import thaliaAPI from "../API/thaliaAPI";
+
+export const getMind = async () => {
+ try {
+ const response = await thaliaAPI.get('/admin/my-mind', {}, { withCredentials: true });
+ return response.data;
+ } catch (error) {
+ return error;
+ }
+}
+
+export const editMind = async (mindDetails, rightId) => {
+ try {
+ const response = await thaliaAPI.put(`/admin/my-mind/${rightId}`, mindDetails, { withCredentials: true });
+ return response.data;
+ } catch (error) {
+ return error;
+ }
+}
+
+export const createMind = async (mindDetails) => {
+ try {
+ const response = await thaliaAPI.post("/admin/my-mind", mindDetails, { withCredentials: true });
+ return response.data;
+ } catch (error) {
+ return error;
+ }
+}
+
+export const getDelete = async (mindId) => {
+ try {
+ const response = await thaliaAPI.delete(`/admin/my-mind/${mindId}`, {}, { withCredentials: true });
+ return response.data;
+ } catch (error) {
+ return error;
+ }
+}
\ No newline at end of file
diff --git a/client/src/components/AddMind/AddMind.jsx b/client/src/components/AddMind/AddMind.jsx
new file mode 100644
index 0000000..cc03a40
--- /dev/null
+++ b/client/src/components/AddMind/AddMind.jsx
@@ -0,0 +1,78 @@
+import { useState } from "react";
+import { Modal } from "flowbite-react";
+import { toast } from "react-toastify";
+import { createMind } from "../../Services/mindServices";
+
+function AddMind({ setOpenModal, openModal }) {
+ const [formData, setFormData] = useState({
+ name: "",
+ content: "",
+ });
+ const handleChange = (e) => {
+ const { name, value } = e.target;
+ setFormData({
+ ...formData,
+ [name]: value,
+ });
+ };
+
+ const handleCreate = async () => {
+ if (!formData.name || !formData.content) {
+ return;
+ }
+ try {
+ const response = await createMind(formData);
+ if (response.success === true) {
+ formData.name = "";
+ formData.content = "";
+ toast.success(response.message);
+ setOpenModal(false);
+ }
+ } catch (error) {
+ console.log("Error occurred", error);
+ }
+ };
+ return (
+ <>
+ setOpenModal(false)}>
+
+ Add New Mind
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+}
+export default AddMind;
diff --git a/client/src/components/EditMind/EditMind.jsx b/client/src/components/EditMind/EditMind.jsx
new file mode 100644
index 0000000..e59b826
--- /dev/null
+++ b/client/src/components/EditMind/EditMind.jsx
@@ -0,0 +1,79 @@
+import { Modal } from "flowbite-react";
+import { useEffect, useState } from "react";
+import { toast } from "react-toastify";
+import { editMind } from "../../Services/mindServices";
+
+function EditMind({ setOpenModal, openModal, mindDetails }) {
+ const [formData, setFormData] = useState({
+ name: "",
+ content: "",
+ });
+ useEffect(() => {
+ console.log(mindDetails);
+ if (mindDetails) {
+ setFormData({
+ name: mindDetails?.name || "",
+ content: mindDetails?.content || "",
+ });
+ }
+ }, [mindDetails]);
+ const handleChange = (e) => {
+ const { name, value } = e.target;
+ setFormData((prevData) => ({
+ ...prevData,
+ [name]: value,
+ }));
+ };
+ const handleEdit = async () => {
+ const response = await editMind(formData, mindDetails?._id);
+ if (response.success === true) {
+ toast.success(response.message);
+ formData.name = "";
+ formData.content = "";
+ setOpenModal(false);
+ }
+ };
+ return (
+ <>
+ setOpenModal(false)}>
+
+ Add New Mind
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+}
+export default EditMind;
diff --git a/client/src/components/Sidebar/Sidebar.jsx b/client/src/components/Sidebar/Sidebar.jsx
index 7d968d9..d12f747 100644
--- a/client/src/components/Sidebar/Sidebar.jsx
+++ b/client/src/components/Sidebar/Sidebar.jsx
@@ -3,6 +3,7 @@ import { MdDashboard } from "react-icons/md";
import { FaUsers } from "react-icons/fa";
import { TbFileReport } from "react-icons/tb";
import { IoBody } from "react-icons/io5";
+import { FaBrain } from "react-icons/fa";
function Sidebar() {
return (
<>
@@ -35,6 +36,12 @@ function Sidebar() {
My Body
+
>
diff --git a/client/src/pages/AdminPages/MyMind/MyMind.jsx b/client/src/pages/AdminPages/MyMind/MyMind.jsx
new file mode 100644
index 0000000..d891bad
--- /dev/null
+++ b/client/src/pages/AdminPages/MyMind/MyMind.jsx
@@ -0,0 +1,141 @@
+import { useEffect } from "react";
+import { useState } from "react";
+import { toast } from "react-toastify";
+import EditMind from "../../../components/EditMind/EditMind";
+import AddMind from "../../../components/AddMind/AddMind";
+import { getDelete } from "../../../Services/mindServices";
+import { getMind } from "../../../Services/mindServices";
+import timeFormat from "../../../utils/timeFormat";
+
+function MyMind() {
+ const [openModal, setOpenModal] = useState(false);
+ const [mindDetails, setmindDetails] = useState([]);
+
+ const [editMind, setEditMind] = useState();
+ const [mindModal, setMindModal] = useState(false);
+
+ const handleModal = () => {
+ setOpenModal(true);
+ };
+ const handleEditModal = (mindId) => {
+ setMindModal(true);
+ const mindToEdit = mindDetails.find((mind) => {
+ return mind?._id === mindId;
+ });
+ console.log(mindToEdit);
+ setEditMind(mindToEdit);
+ };
+ useEffect(() => {
+ const getMindData = async () => {
+ const response = await getMind();
+ if (response.success === true) {
+ console.log(response.contents);
+ setmindDetails(response.contents);
+ }
+ };
+ getMindData();
+ }, [
+ setOpenModal,
+ setMindModal,
+ openModal,
+ mindModal,
+ setmindDetails,
+ setEditMind,
+ ]);
+ const handleDelete = async (mindId) => {
+ const response = await getDelete(mindId);
+ if (response.success === true) {
+ setmindDetails((prevDetails) =>
+ prevDetails.filter((mind) => mind._id !== mindId)
+ );
+ toast.success(response.message);
+ }
+ };
+ return (
+ <>
+
+
+
+
+ {/* Text Components */}
+
+
+
Mind Management
+
+
+
+
+
+ {/* Table Component */}
+
+ <>
+
+
+
+
+ No
+ |
+
+ Name
+ |
+
+ Date
+ |
+
+ Edit or Delete
+ |
+
+
+ {mindDetails.map((mind, index) => {
+ return (
+ <>
+
+
+
+ {index + 1}
+ |
+ {mind?.name} |
+
+ {timeFormat(mind?.createdAt)}
+ |
+
+
+
+ |
+
+
+ >
+ );
+ })}
+
+ >
+
+
+
+ >
+ );
+}
+
+export default MyMind;
diff --git a/client/src/pages/AdminPages/Rights/Rights.jsx b/client/src/pages/AdminPages/Rights/Rights.jsx
index f963f04..3228639 100644
--- a/client/src/pages/AdminPages/Rights/Rights.jsx
+++ b/client/src/pages/AdminPages/Rights/Rights.jsx
@@ -63,7 +63,7 @@ function Rights() {