e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
>
{/* {type === "confirm" && (
exit
diff --git a/src/components/Drawer/AR-dark.svg b/src/components/Drawer/AR-dark.svg
new file mode 100644
index 0000000..7668878
--- /dev/null
+++ b/src/components/Drawer/AR-dark.svg
@@ -0,0 +1,8 @@
+
diff --git a/src/components/Drawer/AR.svg b/src/components/Drawer/AR.svg
new file mode 100644
index 0000000..ad01fdd
--- /dev/null
+++ b/src/components/Drawer/AR.svg
@@ -0,0 +1,8 @@
+
diff --git a/src/components/Drawer/activation-dark.svg b/src/components/Drawer/activation-dark.svg
new file mode 100644
index 0000000..65cf9fa
--- /dev/null
+++ b/src/components/Drawer/activation-dark.svg
@@ -0,0 +1,6 @@
+
diff --git a/src/components/Drawer/activation.svg b/src/components/Drawer/activation.svg
new file mode 100644
index 0000000..b411bf2
--- /dev/null
+++ b/src/components/Drawer/activation.svg
@@ -0,0 +1,6 @@
+
diff --git a/src/components/Drawer/contact-dark.svg b/src/components/Drawer/contact-dark.svg
new file mode 100644
index 0000000..030dd7c
--- /dev/null
+++ b/src/components/Drawer/contact-dark.svg
@@ -0,0 +1,10 @@
+
diff --git a/src/components/Drawer/contact.svg b/src/components/Drawer/contact.svg
new file mode 100644
index 0000000..8a1aa33
--- /dev/null
+++ b/src/components/Drawer/contact.svg
@@ -0,0 +1,10 @@
+
diff --git a/src/components/Drawer/faq-dark.svg b/src/components/Drawer/faq-dark.svg
new file mode 100644
index 0000000..8d7e17d
--- /dev/null
+++ b/src/components/Drawer/faq-dark.svg
@@ -0,0 +1,7 @@
+
diff --git a/src/components/Drawer/faq.svg b/src/components/Drawer/faq.svg
new file mode 100644
index 0000000..e918e6e
--- /dev/null
+++ b/src/components/Drawer/faq.svg
@@ -0,0 +1,7 @@
+
diff --git a/src/components/Drawer/home-dark.svg b/src/components/Drawer/home-dark.svg
new file mode 100644
index 0000000..993cb32
--- /dev/null
+++ b/src/components/Drawer/home-dark.svg
@@ -0,0 +1,7 @@
+
diff --git a/src/components/Drawer/home.svg b/src/components/Drawer/home.svg
new file mode 100644
index 0000000..e671e48
--- /dev/null
+++ b/src/components/Drawer/home.svg
@@ -0,0 +1,7 @@
+
diff --git a/src/components/Drawer/index.js b/src/components/Drawer/index.js
index eb6d373..4bee42a 100644
--- a/src/components/Drawer/index.js
+++ b/src/components/Drawer/index.js
@@ -1,112 +1,47 @@
import React, { useState } from "react";
import { connect } from "react-redux";
-import { publicApi } from "../../redux/actions";
+import { publicApi, dialog, user } from "../../redux/actions";
import { Link } from "react-router-dom";
import Drawer from "react-modern-drawer";
-import homeIcon from "./mobile-home.svg";
-import logoutIcon from "./mobile-logout.svg";
-import blogIcon from "./mobile-blog.svg";
+//assets
+import homeIcon from "./home.svg";
+import homeDarkIcon from "./home-dark.svg";
+import logoutIcon from "./logout.svg";
+import logoutDarkIcon from "./logout-dark.svg";
import dangerIcon from "./mobile-danger.svg";
+import dangerDarkIcon from "./mobile-danger-dark.svg";
+import activationIcon from "./activation.svg";
+import activationDarkIcon from "./activation-dark.svg";
+import contactIcon from "./contact.svg";
+import contactDarkIcon from "./contact-dark.svg";
+import ordersIcon from "./orders.svg";
+import ordersDarkIcon from "./orders-dark.svg";
+import arIcon from "./AR.svg";
+import arDarkIcon from "./AR-dark.svg";
import cartIcon from "./mobile-basket.svg";
-import profileIcon from "./mobile-profile.svg";
-import Avatar from "../../components/Avatar";
+import cartDarkIcon from "./mobile-basket-dark.svg"
+import faqIcon from "./faq.svg";
+import faqDarkIcon from "./faq-dark.svg";
+
import arrowLeftVideo from "../../assets/icons/dropdown-white.svg";
import sunIcon from "./sun.svg";
import moonIcon from "./moon.svg";
+//components
+import Avatar from "../../components/Avatar";
+
const MyDrawer = ({
setDrawerOpen,
drawerOpen,
- publicLink,
- privateLink,
isDark,
user,
changeDarkMode,
+ setDialog,
+ logout,
}) => {
const [addUserDropdown, setAddUserDropdown] = useState(false);
-
- return (
-
setDrawerOpen(() => !drawerOpen)}
- size={"80%"}
- direction="right"
- >
- e.stopPropagation()}
- >
-
-
-
- {(!user ? publicLink : privateLink).map((item, key) => (
- setDrawerOpen(false)}>
-
- {item.icon}
-
- {item.name}
-
- {item.message &&
{item.message}
}
-
-
- ))}
-
-
-
- );
-};
-
-const mapStateToProps = (state) => ({
- isDark: state.publicApi.isDark,
- user: state.user.status,
-});
-
-const mapDispatchToProps = {
- changeDarkMode: publicApi.setIsDark,
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(MyDrawer);
-
-MyDrawer.defaultProps = {
- publicLink: [
+ const publicLink = [
{
name: "صفحه اصلی",
link: "/",
@@ -133,28 +68,6 @@ MyDrawer.defaultProps = {
toast: "",
message: "",
},
- {
- name: "فروشگاه",
- link: "/products",
- icon: (
-
- ),
- toast: "",
- message: "",
- },
- {
- name: "بلاگ",
- link: "/blogs",
- icon: (
-
- ),
- toast: "",
- message: "",
- },
{
name: "پشتیبانی",
link: "/contact-us",
@@ -168,94 +81,219 @@ MyDrawer.defaultProps = {
toast: "",
message: "",
},
- ],
- privateLink: [
+ ];
+ const privateLink = [
{
name: "صفحه اصلی",
link: "/",
icon: (
),
toast: "",
message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
},
{
- name: "پروفایل",
- link: "/profile",
+ name: "سبد خرید",
+ link: "/cart",
icon: (
),
toast: "",
message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
},
{
- name: "فروشگاه",
- link: "/products",
+ name: "فعال سازی کتاب",
+ link: "/activation",
+ icon: (
+
+ ),
+ toast: "",
+ message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
+ },
+ {
+ name: "واقعیت افزوده",
+ link: "/ar",
icon: (
),
toast: "",
message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
},
{
- name: "سبد خرید",
- link: "/cart",
+ name: "سفارشات",
+ link: "/orders",
icon: (
),
toast: "",
message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
},
{
- name: "بلاگ",
- link: "/blogs",
+ name: "سوالات متداول",
+ link: "/faq",
icon: (
-
+
),
toast: "",
message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
},
{
name: "پشتیبانی",
- link: "/support",
+ link: "/contact",
icon: (
),
toast: "",
message: "",
+ onClick: () => {
+ setDrawerOpen(false);
+ },
},
{
name: "خروج از حساب کاربری",
link: "/",
icon: (
),
toast: "",
message: "",
+ onClick: () => {
+ setDialog({
+ open: true,
+ type: "confirm",
+ accept: () => {
+ logout();
+ },
+ text: "قصد خروج از حساب کاربری رو داری؟",
+ });
+ setDrawerOpen(false);
+ },
},
- ],
+ ];
+
+ return (
+
setDrawerOpen(() => !drawerOpen)}
+ size={"80%"}
+ direction="right"
+ >
+ e.stopPropagation()}
+ >
+
+
+
+ {(!user ? publicLink : privateLink).map((item, key) => (
+ item.onClick()}>
+
+ {item.icon}
+
+ {item.name}
+
+ {item.message &&
{item.message}
}
+
+
+ ))}
+
+
+
+ );
+};
+
+const mapStateToProps = (state) => ({
+ isDark: state.publicApi.isDark,
+ user: state.user.status,
+});
+
+const mapDispatchToProps = {
+ changeDarkMode: publicApi.setIsDark,
+ setDialog: dialog.set,
+ logout: user.logout,
};
+
+export default connect(mapStateToProps, mapDispatchToProps)(MyDrawer);
diff --git a/src/components/Drawer/logout-dark.svg b/src/components/Drawer/logout-dark.svg
new file mode 100644
index 0000000..a7e0758
--- /dev/null
+++ b/src/components/Drawer/logout-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-logout.svg b/src/components/Drawer/logout.svg
similarity index 100%
rename from src/components/Drawer/mobile-logout.svg
rename to src/components/Drawer/logout.svg
diff --git a/src/components/Drawer/mobile-ar.svg b/src/components/Drawer/mobile-ar.svg
deleted file mode 100644
index 84c5a51..0000000
--- a/src/components/Drawer/mobile-ar.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-basket-dark.svg b/src/components/Drawer/mobile-basket-dark.svg
new file mode 100644
index 0000000..1968e06
--- /dev/null
+++ b/src/components/Drawer/mobile-basket-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-blog.svg b/src/components/Drawer/mobile-blog.svg
deleted file mode 100644
index ac1ec9f..0000000
--- a/src/components/Drawer/mobile-blog.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-danger-dark.svg b/src/components/Drawer/mobile-danger-dark.svg
new file mode 100644
index 0000000..e60b26e
--- /dev/null
+++ b/src/components/Drawer/mobile-danger-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-home.svg b/src/components/Drawer/mobile-home.svg
deleted file mode 100644
index ded13a2..0000000
--- a/src/components/Drawer/mobile-home.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-mail.svg b/src/components/Drawer/mobile-mail.svg
deleted file mode 100644
index 2554836..0000000
--- a/src/components/Drawer/mobile-mail.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/Drawer/mobile-profile.svg b/src/components/Drawer/mobile-profile.svg
deleted file mode 100644
index 2fddb7a..0000000
--- a/src/components/Drawer/mobile-profile.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/Drawer/orders-dark.svg b/src/components/Drawer/orders-dark.svg
new file mode 100644
index 0000000..f2b0817
--- /dev/null
+++ b/src/components/Drawer/orders-dark.svg
@@ -0,0 +1,11 @@
+
diff --git a/src/components/Drawer/orders.svg b/src/components/Drawer/orders.svg
new file mode 100644
index 0000000..35c2643
--- /dev/null
+++ b/src/components/Drawer/orders.svg
@@ -0,0 +1,11 @@
+