diff --git a/README.md b/README.md
index accdfc8..e69905f 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
# Daisy UI Admin Dashboard Template - DashWind
[](https://choosealicense.com/licenses/mit/)
-This is a free admin dashboard template that uses **Daisy UI** and React js. It has **fully customizable and themable CSS** CSS and is powered by Tailwind CSS utility classes. Additionally, it comes with **redux toolkit** and other libraries already set up.
+This is a free admin dashboard template that uses **Daisy UI** and React js. It has **fully customizable and themable CSS** CSS and is powered by Tailwind CSS utility classes. Additionally, it comes with **zustand** and other libraries already set up.
## Preview
@@ -21,7 +21,7 @@ This is a free admin dashboard template that uses **Daisy UI** and React js. It
- **Light/dark** mode toggle
- Token based user **authentication**
- **Submenu support** in sidebar
-- Store management using **redux toolkit**
+- Store management using **zustand**
- **Daisy UI** components and **Tailwind** support
- **Right and left sidebar**, Universal loader, notifications
- **Calendar**, global modal, **chart js 2** and other components
@@ -47,7 +47,7 @@ Go to project directory and run (make sure you have node installed first)
- [Tailwind CSS v3.3.6](https://tailwindcss.com/)
- [Daisy UI v4.4.19](https://daisyui.com/)
- [HeroIcons](https://heroicons.com/)
-- [Redux toolkit v1.9](https://redux-toolkit.js.org/)
+- [Zustand v5.0.3](https://zustand-demo.pmnd.rs/)
- [React ChartJS 2 v5](https://react-chartjs-2.js.org/)
## Documentation
diff --git a/package-lock.json b/package-lock.json
index 53bd284..8e9f754 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,6 @@
"license": "ISC",
"dependencies": {
"@heroicons/react": "^2.0.13",
- "@reduxjs/toolkit": "^1.9.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
@@ -23,12 +22,12 @@
"react-chartjs-2": "^5.0.1",
"react-dom": "^18.2.0",
"react-notifications": "^1.7.4",
- "react-redux": "^8.0.5",
"react-router-dom": "^6.4.3",
"react-scripts": "5.0.1",
"react-tailwindcss-datepicker": "^1.6.0",
"theme-change": "^2.2.0",
- "web-vitals": "^2.1.4"
+ "web-vitals": "^2.1.4",
+ "zustand": "^5.0.3"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.8",
@@ -2900,28 +2899,6 @@
}
}
},
- "node_modules/@reduxjs/toolkit": {
- "version": "1.9.0",
- "license": "MIT",
- "dependencies": {
- "immer": "^9.0.16",
- "redux": "^4.2.0",
- "redux-thunk": "^2.4.2",
- "reselect": "^4.1.7"
- },
- "peerDependencies": {
- "react": "^16.9.0 || ^17.0.0 || ^18",
- "react-redux": "^7.2.1 || ^8.0.2"
- },
- "peerDependenciesMeta": {
- "react": {
- "optional": true
- },
- "react-redux": {
- "optional": true
- }
- }
- },
"node_modules/@remix-run/router": {
"version": "1.0.3",
"license": "MIT",
@@ -3558,14 +3535,6 @@
"@types/node": "*"
}
},
- "node_modules/@types/hoist-non-react-statics": {
- "version": "3.3.1",
- "license": "MIT",
- "dependencies": {
- "@types/react": "*",
- "hoist-non-react-statics": "^3.3.0"
- }
- },
"node_modules/@types/html-minifier-terser": {
"version": "6.1.0",
"license": "MIT"
@@ -3918,10 +3887,6 @@
"version": "2.0.2",
"license": "MIT"
},
- "node_modules/@types/use-sync-external-store": {
- "version": "0.0.3",
- "license": "MIT"
- },
"node_modules/@types/ws": {
"version": "8.5.3",
"license": "MIT",
@@ -7982,17 +7947,6 @@
"he": "bin/he"
}
},
- "node_modules/hoist-non-react-statics": {
- "version": "3.3.2",
- "license": "BSD-3-Clause",
- "dependencies": {
- "react-is": "^16.7.0"
- }
- },
- "node_modules/hoist-non-react-statics/node_modules/react-is": {
- "version": "16.13.1",
- "license": "MIT"
- },
"node_modules/hoopy": {
"version": "0.1.4",
"license": "MIT",
@@ -13225,47 +13179,6 @@
"node": ">=0.4.0"
}
},
- "node_modules/react-redux": {
- "version": "8.0.5",
- "license": "MIT",
- "dependencies": {
- "@babel/runtime": "^7.12.1",
- "@types/hoist-non-react-statics": "^3.3.1",
- "@types/use-sync-external-store": "^0.0.3",
- "hoist-non-react-statics": "^3.3.2",
- "react-is": "^18.0.0",
- "use-sync-external-store": "^1.0.0"
- },
- "peerDependencies": {
- "@types/react": "^16.8 || ^17.0 || ^18.0",
- "@types/react-dom": "^16.8 || ^17.0 || ^18.0",
- "react": "^16.8 || ^17.0 || ^18.0",
- "react-dom": "^16.8 || ^17.0 || ^18.0",
- "react-native": ">=0.59",
- "redux": "^4"
- },
- "peerDependenciesMeta": {
- "@types/react": {
- "optional": true
- },
- "@types/react-dom": {
- "optional": true
- },
- "react-dom": {
- "optional": true
- },
- "react-native": {
- "optional": true
- },
- "redux": {
- "optional": true
- }
- }
- },
- "node_modules/react-redux/node_modules/react-is": {
- "version": "18.2.0",
- "license": "MIT"
- },
"node_modules/react-refresh": {
"version": "0.11.0",
"license": "MIT",
@@ -13446,20 +13359,6 @@
"node": ">=8"
}
},
- "node_modules/redux": {
- "version": "4.2.0",
- "license": "MIT",
- "dependencies": {
- "@babel/runtime": "^7.9.2"
- }
- },
- "node_modules/redux-thunk": {
- "version": "2.4.2",
- "license": "MIT",
- "peerDependencies": {
- "redux": "^4"
- }
- },
"node_modules/regenerate": {
"version": "1.4.2",
"license": "MIT"
@@ -13585,10 +13484,6 @@
"version": "1.0.0",
"license": "MIT"
},
- "node_modules/reselect": {
- "version": "4.1.7",
- "license": "MIT"
- },
"node_modules/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -15086,6 +14981,8 @@
"node_modules/use-sync-external-store": {
"version": "1.2.0",
"license": "MIT",
+ "optional": true,
+ "peer": true,
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
@@ -16007,6 +15904,35 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
+ },
+ "node_modules/zustand": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.3.tgz",
+ "integrity": "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.20.0"
+ },
+ "peerDependencies": {
+ "@types/react": ">=18.0.0",
+ "immer": ">=9.0.6",
+ "react": ">=18.0.0",
+ "use-sync-external-store": ">=1.2.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "immer": {
+ "optional": true
+ },
+ "react": {
+ "optional": true
+ },
+ "use-sync-external-store": {
+ "optional": true
+ }
+ }
}
},
"dependencies": {
@@ -17626,15 +17552,6 @@
"source-map": "^0.7.3"
}
},
- "@reduxjs/toolkit": {
- "version": "1.9.0",
- "requires": {
- "immer": "^9.0.16",
- "redux": "^4.2.0",
- "redux-thunk": "^2.4.2",
- "reselect": "^4.1.7"
- }
- },
"@remix-run/router": {
"version": "1.0.3"
},
@@ -18017,13 +17934,6 @@
"@types/node": "*"
}
},
- "@types/hoist-non-react-statics": {
- "version": "3.3.1",
- "requires": {
- "@types/react": "*",
- "hoist-non-react-statics": "^3.3.0"
- }
- },
"@types/html-minifier-terser": {
"version": "6.1.0"
},
@@ -18276,9 +18186,6 @@
"@types/trusted-types": {
"version": "2.0.2"
},
- "@types/use-sync-external-store": {
- "version": "0.0.3"
- },
"@types/ws": {
"version": "8.5.3",
"requires": {
@@ -20742,17 +20649,6 @@
"he": {
"version": "1.2.0"
},
- "hoist-non-react-statics": {
- "version": "3.3.2",
- "requires": {
- "react-is": "^16.7.0"
- },
- "dependencies": {
- "react-is": {
- "version": "16.13.1"
- }
- }
- },
"hoopy": {
"version": "0.1.4"
},
@@ -23741,22 +23637,6 @@
}
}
},
- "react-redux": {
- "version": "8.0.5",
- "requires": {
- "@babel/runtime": "^7.12.1",
- "@types/hoist-non-react-statics": "^3.3.1",
- "@types/use-sync-external-store": "^0.0.3",
- "hoist-non-react-statics": "^3.3.2",
- "react-is": "^18.0.0",
- "use-sync-external-store": "^1.0.0"
- },
- "dependencies": {
- "react-is": {
- "version": "18.2.0"
- }
- }
- },
"react-refresh": {
"version": "0.11.0"
},
@@ -23876,16 +23756,6 @@
"strip-indent": "^3.0.0"
}
},
- "redux": {
- "version": "4.2.0",
- "requires": {
- "@babel/runtime": "^7.9.2"
- }
- },
- "redux-thunk": {
- "version": "2.4.2",
- "requires": {}
- },
"regenerate": {
"version": "1.4.2"
},
@@ -23965,9 +23835,6 @@
"requires-port": {
"version": "1.0.0"
},
- "reselect": {
- "version": "4.1.7"
- },
"resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -24877,6 +24744,8 @@
},
"use-sync-external-store": {
"version": "1.2.0",
+ "optional": true,
+ "peer": true,
"requires": {}
},
"util-deprecate": {
@@ -25487,6 +25356,12 @@
},
"yocto-queue": {
"version": "0.1.0"
+ },
+ "zustand": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.3.tgz",
+ "integrity": "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==",
+ "requires": {}
}
}
}
diff --git a/package.json b/package.json
index 4caceb2..312150e 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "admin-dashboard-template-dashwind",
"version": "1.0.0",
- "description": "Admin Dashboard template built with create-react-app, tailwind css and daisy UI. Template uses rich tailwind css utility classes and have components of daisy UI, also have redux toolkit implemented for store management.",
+ "description": "Admin Dashboard template built with create-react-app, tailwind css and daisy UI. Template uses rich tailwind css utility classes and have components of daisy UI, also have Zustand implemented for store management.",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
@@ -10,7 +10,6 @@
},
"dependencies": {
"@heroicons/react": "^2.0.13",
- "@reduxjs/toolkit": "^1.9.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
@@ -23,12 +22,12 @@
"react-chartjs-2": "^5.0.1",
"react-dom": "^18.2.0",
"react-notifications": "^1.7.4",
- "react-redux": "^8.0.5",
"react-router-dom": "^6.4.3",
"react-scripts": "5.0.1",
"react-tailwindcss-datepicker": "^1.6.0",
"theme-change": "^2.2.0",
- "web-vitals": "^2.1.4"
+ "web-vitals": "^2.1.4",
+ "zustand": "^5.0.3"
},
"repository": {
"type": "git",
@@ -39,7 +38,7 @@
"tailwind-css",
"starter-kit",
"saas-starter-kit",
- "reduxt-toolkit-dashboard-template",
+ "zustand-dashboard-template",
"daisyui-template",
"dashboard-template",
"react-router",
diff --git a/public/index.html b/public/index.html
index e2bd832..0c50ee2 100644
--- a/public/index.html
+++ b/public/index.html
@@ -25,7 +25,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
Daisy UI Admin Dashboard Template - DashWind
-
+
You need to enable JavaScript to run this app.
diff --git a/src/app/store.js b/src/app/store.js
deleted file mode 100644
index 1decc15..0000000
--- a/src/app/store.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { configureStore } from '@reduxjs/toolkit'
-import headerSlice from '../features/common/headerSlice'
-import modalSlice from '../features/common/modalSlice'
-import rightDrawerSlice from '../features/common/rightDrawerSlice'
-import leadsSlice from '../features/leads/leadSlice'
-
-const combinedReducer = {
- header : headerSlice,
- rightDrawer : rightDrawerSlice,
- modal : modalSlice,
- lead : leadsSlice
-}
-
-export default configureStore({
- reducer: combinedReducer
-})
\ No newline at end of file
diff --git a/src/app/store_zustand.js b/src/app/store_zustand.js
new file mode 100644
index 0000000..46aef80
--- /dev/null
+++ b/src/app/store_zustand.js
@@ -0,0 +1,117 @@
+import { create } from "zustand";
+import axios from "axios";
+
+const useStore = create((set, get) => ({
+ // Initial state combined from slices
+ header: {
+ pageTitle: "Home",
+ noOfNotifications: 15,
+ newNotificationMessage: "",
+ newNotificationStatus: 1,
+ },
+ modal: {
+ title: "",
+ isOpen: false,
+ bodyType: "",
+ size: "md", // Default size
+ extraObject: {},
+ },
+ rightDrawer: {
+ header: "",
+ isOpen: false,
+ bodyType: "",
+ extraObject: {},
+ },
+ lead: {
+ isLoading: false,
+ leads: [],
+ },
+
+ // Header actions
+ setPageTitle: (title) =>
+ set((state) => ({ header: { ...state.header, pageTitle: title } })),
+ removeNotificationMessage: () =>
+ set((state) => ({
+ header: { ...state.header, newNotificationMessage: "" },
+ })),
+ showNotification: ({ message, status }) =>
+ set((state) => ({
+ header: {
+ ...state.header,
+ newNotificationMessage: message,
+ newNotificationStatus: status,
+ },
+ })),
+
+ // Modal actions
+ openModal: ({ title, bodyType, extraObject, size }) =>
+ set((state) => ({
+ modal: {
+ ...state.modal,
+ isOpen: true,
+ title,
+ bodyType,
+ size: size || "md",
+ extraObject,
+ },
+ })),
+ closeModal: () =>
+ set((state) => ({
+ modal: {
+ ...state.modal,
+ isOpen: false,
+ bodyType: "",
+ title: "",
+ extraObject: {},
+ },
+ })),
+
+ // Right Drawer actions
+ openRightDrawer: ({ header, bodyType, extraObject }) =>
+ set((state) => ({
+ rightDrawer: {
+ ...state.rightDrawer,
+ isOpen: true,
+ header,
+ bodyType,
+ extraObject,
+ },
+ })),
+ closeRightDrawer: () =>
+ set((state) => ({
+ rightDrawer: {
+ ...state.rightDrawer,
+ isOpen: false,
+ bodyType: "",
+ header: "",
+ extraObject: {},
+ },
+ })),
+
+ // Lead actions
+ addNewLead: (newLeadObj) =>
+ set((state) => ({
+ lead: { ...state.lead, leads: [...state.lead.leads, newLeadObj] },
+ })),
+ deleteLead: (index) =>
+ set((state) => {
+ const newLeads = [...state.lead.leads];
+ newLeads.splice(index, 1);
+ return { lead: { ...state.lead, leads: newLeads } };
+ }),
+ getLeadsContent: async () => {
+ set((state) => ({ lead: { ...state.lead, isLoading: true } }));
+ try {
+ const response = await axios.get("/api/users?page=2"); // Assuming the API endpoint remains the same
+ set((state) => ({
+ lead: { ...state.lead, leads: response.data.data, isLoading: false },
+ }));
+ } catch (error) {
+ console.error("Failed to fetch leads:", error);
+ set((state) => ({ lead: { ...state.lead, isLoading: false } }));
+ // Optionally, handle the error state in the store
+ }
+ },
+}));
+
+export default useStore;
diff --git a/src/containers/Header.js b/src/containers/Header.js
index 0988c4c..cd22e07 100644
--- a/src/containers/Header.js
+++ b/src/containers/Header.js
@@ -1,68 +1,67 @@
-import { themeChange } from 'theme-change'
-import React, { useEffect, useState } from 'react'
-import { useSelector, useDispatch } from 'react-redux'
-import BellIcon from '@heroicons/react/24/outline/BellIcon'
-import Bars3Icon from '@heroicons/react/24/outline/Bars3Icon'
-import MoonIcon from '@heroicons/react/24/outline/MoonIcon'
-import SunIcon from '@heroicons/react/24/outline/SunIcon'
-import { openRightDrawer } from '../features/common/rightDrawerSlice';
-import { RIGHT_DRAWER_TYPES } from '../utils/globalConstantUtil'
-
-import { NavLink, Routes, Link , useLocation} from 'react-router-dom'
-
-
-function Header(){
-
- const dispatch = useDispatch()
- const {noOfNotifications, pageTitle} = useSelector(state => state.header)
- const [currentTheme, setCurrentTheme] = useState(localStorage.getItem("theme"))
-
- useEffect(() => {
- themeChange(false)
- if(currentTheme === null){
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ) {
- setCurrentTheme("dark")
- }else{
- setCurrentTheme("light")
- }
- }
- // 👆 false parameter is required for react project
- }, [])
-
-
- // Opening right sidebar for notification
- const openNotification = () => {
- dispatch(openRightDrawer({header : "Notifications", bodyType : RIGHT_DRAWER_TYPES.NOTIFICATION}))
+import { themeChange } from "theme-change";
+import React, { useEffect, useState } from "react";
+import useStore from "../app/store_zustand";
+import BellIcon from "@heroicons/react/24/outline/BellIcon";
+import Bars3Icon from "@heroicons/react/24/outline/Bars3Icon";
+import MoonIcon from "@heroicons/react/24/outline/MoonIcon";
+import SunIcon from "@heroicons/react/24/outline/SunIcon";
+import { RIGHT_DRAWER_TYPES } from "../utils/globalConstantUtil";
+
+import { Link } from "react-router-dom";
+
+function Header() {
+ const { noOfNotifications, pageTitle } = useStore((state) => state.header);
+ const openRightDrawer = useStore((state) => state.openRightDrawer);
+
+ const [currentTheme, setCurrentTheme] = useState(
+ localStorage.getItem("theme")
+ );
+
+ useEffect(() => {
+ themeChange(false);
+ if (currentTheme === null) {
+ if (
+ window.matchMedia &&
+ window.matchMedia("(prefers-color-scheme: dark)").matches
+ ) {
+ setCurrentTheme("dark");
+ } else {
+ setCurrentTheme("light");
+ }
}
-
-
- function logoutUser(){
- localStorage.clear();
- window.location.href = '/'
- }
-
- return(
- // navbar fixed flex-none justify-between bg-base-300 z-10 shadow-md
-
- <>
-
-
-
- {/* Menu toogle for mobile view or small screen */}
-
-
-
-
{pageTitle}
-
-
-
-
-
-
- {/* Multiple theme selection, uncomment this if you want to enable multiple themes selection,
+ }, []);
+
+ const openNotification = () => {
+ openRightDrawer({
+ header: "Notifications",
+ bodyType: RIGHT_DRAWER_TYPES.NOTIFICATION,
+ });
+ };
+
+ function logoutUser() {
+ localStorage.clear();
+ window.location.href = "/";
+ }
+
+ return (
+ <>
+
+ {/* Menu toogle for mobile view or small screen */}
+
+
+
+
+
{pageTitle}
+
+
+
+ {/* Multiple theme selection, uncomment this if you want to enable multiple themes selection,
also includes corporate and retro themes in tailwind.config file */}
-
- {/*
+
+ {/*
Theme
Default
Dark
@@ -70,48 +69,72 @@ function Header(){
Retro
*/}
-
- {/* Light and dark theme selection toogle **/}
-
-
-
-
-
-
-
- {/* Notification icon */}
- openNotification()}>
-
-
- {noOfNotifications > 0 ? {noOfNotifications} : null }
-
-
-
-
- {/* Profile icon, opening menu on click */}
-
-
-
-
-
-
-
-
-
- Profile Settings
- New
-
-
- Bill History
-
- Logout
-
-
+ {/* Light and dark theme selection toogle **/}
+
+
+
+
+
+
+ {/* Notification icon */}
+ openNotification()}
+ >
+
+
+ {noOfNotifications > 0 ? (
+
+ {noOfNotifications}
+
+ ) : null}
-
-
- >
- )
+
+
+ {/* Profile icon, opening menu on click */}
+
+
+
+
+
+
+
+
+
+ Profile Settings
+ New
+
+
+
+ Bill History
+
+
+
+ Logout
+
+
+
+
+
+ >
+ );
}
-export default Header
\ No newline at end of file
+export default Header;
diff --git a/src/containers/Layout.js b/src/containers/Layout.js
index e8cd62d..2481b2d 100644
--- a/src/containers/Layout.js
+++ b/src/containers/Layout.js
@@ -1,47 +1,56 @@
-import PageContent from "./PageContent"
-import LeftSidebar from "./LeftSidebar"
-import { useSelector, useDispatch } from 'react-redux'
-import RightSidebar from './RightSidebar'
-import { useEffect } from "react"
-import { removeNotificationMessage } from "../features/common/headerSlice"
-import {NotificationContainer, NotificationManager} from 'react-notifications';
-import 'react-notifications/lib/notifications.css';
-import ModalLayout from "./ModalLayout"
-
-function Layout(){
- const dispatch = useDispatch()
- const {newNotificationMessage, newNotificationStatus} = useSelector(state => state.header)
-
+import PageContent from "./PageContent";
+import LeftSidebar from "./LeftSidebar";
+import useStore from "../app/store_zustand";
+import RightSidebar from "./RightSidebar";
+import { useEffect } from "react";
+import {
+ NotificationContainer,
+ NotificationManager,
+} from "react-notifications";
+import "react-notifications/lib/notifications.css";
+import ModalLayout from "./ModalLayout";
+
+function Layout() {
+ const { newNotificationMessage, newNotificationStatus } = useStore(
+ (state) => state.header
+ );
+ const removeNotificationMessage = useStore(
+ (state) => state.removeNotificationMessage
+ );
useEffect(() => {
- if(newNotificationMessage !== ""){
- if(newNotificationStatus === 1)NotificationManager.success(newNotificationMessage, 'Success')
- if(newNotificationStatus === 0)NotificationManager.error( newNotificationMessage, 'Error')
- dispatch(removeNotificationMessage())
- }
- }, [newNotificationMessage])
-
- return(
- <>
- { /* Left drawer - containing page content and side bar (always open) */ }
-
-
- { /* Right drawer - containing secondary content like notifications list etc.. */ }
-
-
-
- {/** Notification layout container */}
-
+ if (newNotificationMessage !== "") {
+ if (newNotificationStatus === 1)
+ NotificationManager.success(newNotificationMessage, "Success");
+ if (newNotificationStatus === 0)
+ NotificationManager.error(newNotificationMessage, "Error");
+ removeNotificationMessage();
+ }
+ }, [newNotificationMessage, removeNotificationMessage]);
+
+ return (
+ <>
+ {/* Left drawer - containing page content and side bar (always open) */}
+
+
+ {/* Right drawer - containing secondary content like notifications list etc.. */}
+
+
+ {/** Notification layout container */}
+
{/* Modal layout container */}
-
-
- >
- )
+
+ >
+ );
}
-export default Layout
\ No newline at end of file
+export default Layout;
diff --git a/src/containers/LeftSidebar.js b/src/containers/LeftSidebar.js
index b06fcb2..31399fb 100644
--- a/src/containers/LeftSidebar.js
+++ b/src/containers/LeftSidebar.js
@@ -1,57 +1,66 @@
-import routes from '../routes/sidebar'
-import { NavLink, Routes, Link , useLocation} from 'react-router-dom'
-import SidebarSubmenu from './SidebarSubmenu';
-import XMarkIcon from '@heroicons/react/24/outline/XMarkIcon'
-import { useDispatch } from 'react-redux';
+import routes from "../routes/sidebar";
+import { NavLink, Link, useLocation } from "react-router-dom";
+import SidebarSubmenu from "./SidebarSubmenu";
+import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon";
-function LeftSidebar(){
- const location = useLocation();
+function LeftSidebar() {
+ const location = useLocation();
- const dispatch = useDispatch()
+ const close = (e) => {
+ document.getElementById("left-sidebar-drawer").click();
+ };
+ return (
+
+
+
+ close()}
+ >
+
+
- const close = (e) => {
- document.getElementById('left-sidebar-drawer').click()
- }
-
- return(
-
-
-
- close()}>
-
-
-
-
-
- DashWind
- {
- routes.map((route, k) => {
- return(
-
- {
- route.submenu ?
- :
- ( `${isActive ? 'font-semibold bg-base-200 ' : 'font-normal'}`} >
- {route.icon} {route.name}
- {
- location.pathname === route.path ? ( ) : null
- }
- )
- }
-
-
- )
- })
- }
-
-
-
- )
+
+
+
+ DashWind
+ {" "}
+
+ {routes.map((route, k) => {
+ return (
+
+ {route.submenu ? (
+
+ ) : (
+
+ `${
+ isActive ? "font-semibold bg-base-200 " : "font-normal"
+ }`
+ }
+ >
+ {route.icon} {route.name}
+ {location.pathname === route.path ? (
+
+ ) : null}
+
+ )}
+
+ );
+ })}
+
+
+ );
}
-export default LeftSidebar
\ No newline at end of file
+export default LeftSidebar;
diff --git a/src/containers/ModalLayout.js b/src/containers/ModalLayout.js
index 37a87f9..6376f44 100644
--- a/src/containers/ModalLayout.js
+++ b/src/containers/ModalLayout.js
@@ -1,46 +1,55 @@
-import { useEffect } from 'react'
-import { MODAL_BODY_TYPES } from '../utils/globalConstantUtil'
-import { useSelector, useDispatch } from 'react-redux'
-import { closeModal } from '../features/common/modalSlice'
-import AddLeadModalBody from '../features/leads/components/AddLeadModalBody'
-import ConfirmationModalBody from '../features/common/components/ConfirmationModalBody'
-
-
-function ModalLayout(){
-
-
- const {isOpen, bodyType, size, extraObject, title} = useSelector(state => state.modal)
- const dispatch = useDispatch()
-
- const close = (e) => {
- dispatch(closeModal(e))
- }
-
-
-
- return(
- <>
- {/* The button to open modal */}
-
- {/* Put this part before tag */}
-
-
-
close()}>✕
-
{title}
-
-
- {/* Loading modal body according to different modal type */}
- {
- {
- [MODAL_BODY_TYPES.LEAD_ADD_NEW] :
,
- [MODAL_BODY_TYPES.CONFIRMATION] : ,
- [MODAL_BODY_TYPES.DEFAULT] :
- }[bodyType]
- }
-
-
- >
- )
+import { MODAL_BODY_TYPES } from "../utils/globalConstantUtil";
+import useStore from "../app/store_zustand";
+import AddLeadModalBody from "../features/leads/components/AddLeadModalBody";
+import ConfirmationModalBody from "../features/common/components/ConfirmationModalBody";
+
+function ModalLayout() {
+ const { isOpen, bodyType, size, extraObject, title } = useStore(
+ (state) => state.modal
+ );
+ const closeModal = useStore((state) => state.closeModal);
+
+ const close = (e) => {
+ closeModal();
+ };
+
+ return (
+ <>
+ {/* The button to open modal */}
+
+ {/* Put this part before