diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx
index 124bd88..b06f923 100644
--- a/src/Layout/DefaultLayout.jsx
+++ b/src/Layout/DefaultLayout.jsx
@@ -64,7 +64,7 @@ import { MdNotificationsNone, MdOutlineAddChart } from "react-icons/md";
import { HiOutlineChartSquareBar } from "react-icons/hi";
import { GrManual } from "react-icons/gr";
import { LuContact } from "react-icons/lu";
-import shield from "../assets/shield.png"
+import shield from "../assets/shield.png";
import SplashScreen from "../Pages/SplashScreen";
const DashboardLayout = () => {
@@ -74,9 +74,28 @@ const DashboardLayout = () => {
const path = location.pathname;
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
const [openDrawerClick, setOpenDrawerClick] = useState(true);
- const { setIsAuthenticate, colorMode, toggleColorMode, setSlideFormRight, slideFromRight } = useContext(GlobalStateContext);
+ const {
+ setIsAuthenticate,
+ colorMode,
+ toggleColorMode,
+ setSlideFormRight,
+ slideFromRight,
+ } = useContext(GlobalStateContext);
const [isSplashVisible, setSplashVisible] = useState(true);
+ const [openIndex, setOpenIndex] = useState(null);
+ useEffect(() => {
+ const savedIndex = localStorage.getItem("openAccordionIndex");
+ if (savedIndex !== null) {
+ setOpenIndex(parseInt(savedIndex));
+ }
+ }, []);
+
+ const handleAccordionChange = (index) => {
+ const newIndex = openIndex === index ? null : index;
+ setOpenIndex(newIndex);
+ localStorage.setItem("openAccordionIndex", newIndex);
+ };
useEffect(() => {
// Set a timer to hide the splash screen after 3 seconds
@@ -355,12 +374,11 @@ const DashboardLayout = () => {
height={"10%"}
>
{isDrawerOpen || openDrawerClick ? (
-
) : (
@@ -368,7 +386,7 @@ const DashboardLayout = () => {
style={{
width: 30,
}}
- src={colorMode === "light"?logoMini : logoMiniDark }
+ src={colorMode === "light" ? logoMini : logoMiniDark}
alt="Logo"
/>
)}
@@ -376,9 +394,20 @@ const DashboardLayout = () => {
-
+
{nav.map(({ title, type, Icon, submenu, path }, index) => {
if (type === "accordion") {
return (
@@ -398,14 +427,17 @@ const DashboardLayout = () => {
alignItems={"center"}
>
{/* {Icon && title === "Admin" ? : } */}
- {Icon && }
+ {Icon && (
+
+ )}
@@ -567,7 +599,6 @@ const DashboardLayout = () => {
style={{
width: `calc(100% - ${isDrawerOpen || openDrawerClick ? 232 : 74}px)`,
transition: "width 0.3s ease-in-out",
-
}}
>
{/*
@@ -594,7 +625,7 @@ const DashboardLayout = () => {
style={{
width: isDrawerOpen || openDrawerClick ? 232 : 74,
transition: "width 0.3s ease-in-out", // Smooth transition for width change
- // overflow: "hidden",
+ // overflow: "hidden",
backgroundColor: "#0041180A",
position: "relative",
// backgroundColor: "#002F0F",
@@ -809,7 +840,7 @@ const DashboardLayout = () => {
}}
>
{isDrawerOpen || openDrawerClick ? (
-
+
) : (
)}