|
|
|
@ -10,7 +10,7 @@ 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 dangerDarkIcon from "./mobile-danger-dark.svg";
|
|
|
|
|
import activationIcon from "./activation.svg"; |
|
|
|
|
import activationDarkIcon from "./activation-dark.svg"; |
|
|
|
|
import contactIcon from "./contact.svg"; |
|
|
|
@ -24,7 +24,7 @@ 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 arrowLeftVideo from "../../assets/icons/dropdown-white.svg";
|
|
|
|
|
import sunIcon from "./sun.svg"; |
|
|
|
|
import moonIcon from "./moon.svg"; |
|
|
|
|
|
|
|
|
@ -40,186 +40,192 @@ const MyDrawer = ({ |
|
|
|
|
setDialog, |
|
|
|
|
logout, |
|
|
|
|
}) => { |
|
|
|
|
const [addUserDropdown, setAddUserDropdown] = useState(false); |
|
|
|
|
const publicLink = [ |
|
|
|
|
{ |
|
|
|
|
name: window.t("صفحه اصلی"), |
|
|
|
|
link: "/", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={homeIcon} |
|
|
|
|
className="opacity-50 dark:bg-white" |
|
|
|
|
alt={window.t("صفحه اصلی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("ورود یا ثبت نام"), |
|
|
|
|
link: "/signup", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={logoutIcon} |
|
|
|
|
className="opacity-50 dark:bg-white" |
|
|
|
|
alt={window.t("کتابهای من")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("پشتیبانی"), |
|
|
|
|
link: "/contact-us", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={dangerIcon} |
|
|
|
|
className="opacity-50 dark:bg-white" |
|
|
|
|
alt={window.t("پشتیبانی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
const privateLink = [ |
|
|
|
|
{ |
|
|
|
|
name: window.t("صفحه اصلی"), |
|
|
|
|
link: "/", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? homeDarkIcon : homeIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("صفحه اصلی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
// const [addUserDropdown, setAddUserDropdown] = useState(false);
|
|
|
|
|
|
|
|
|
|
const privateLink = React.useMemo(() => { |
|
|
|
|
return [ |
|
|
|
|
{ |
|
|
|
|
name: window.t("صفحه اصلی"), |
|
|
|
|
link: "/", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? homeDarkIcon : homeIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("صفحه اصلی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("سبد خرید"), |
|
|
|
|
link: "/cart", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? cartDarkIcon : cartIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("سبد خرید")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("سبد خرید"), |
|
|
|
|
link: "/cart", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? cartDarkIcon : cartIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("سبد خرید")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("فعال سازی کتاب"), |
|
|
|
|
link: "/activation", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? activationDarkIcon : activationIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("فعال سازی کتاب")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("فعال سازی کتاب"), |
|
|
|
|
link: "/activation", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? activationDarkIcon : activationIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("فعال سازی کتاب")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("واقعیت افزوده"), |
|
|
|
|
link: "/ar", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? arDarkIcon : arIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("واقعیت افزوده")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("واقعیت افزوده"), |
|
|
|
|
link: "/ar", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? arDarkIcon : arIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("واقعیت افزوده")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("سفارشات"), |
|
|
|
|
link: "/orders", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? ordersDarkIcon : ordersIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("سفارشات")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("سفارشات"), |
|
|
|
|
link: "/orders", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? ordersDarkIcon : ordersIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("سفارشات")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("سوالات متداول"), |
|
|
|
|
link: "/faq", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? faqDarkIcon : faqIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("سوالات متداول")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("سوالات متداول"), |
|
|
|
|
link: "/faq", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? faqDarkIcon : faqIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("سوالات متداول")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("پشتیبانی"), |
|
|
|
|
link: "/contact", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? contactDarkIcon : contactIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("پشتیبانی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("پشتیبانی"), |
|
|
|
|
link: "/contact", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? contactDarkIcon : contactIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("پشتیبانی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("خروج از حساب کاربری"), |
|
|
|
|
link: "/", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? logoutDarkIcon : logoutIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("خروج از حساب کاربری")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDialog({ |
|
|
|
|
open: true, |
|
|
|
|
type: "confirm", |
|
|
|
|
accept: () => { |
|
|
|
|
logout(); |
|
|
|
|
}, |
|
|
|
|
text: window.t("قصد خروج از حساب کاربری رو داری؟"), |
|
|
|
|
}); |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
{ |
|
|
|
|
name: window.t("خروج از حساب کاربری"), |
|
|
|
|
link: "/", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? logoutDarkIcon : logoutIcon} |
|
|
|
|
className="opacity-50" |
|
|
|
|
alt={window.t("خروج از حساب کاربری")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
onClick: () => { |
|
|
|
|
setDialog({ |
|
|
|
|
open: true, |
|
|
|
|
type: "confirm", |
|
|
|
|
accept: () => { |
|
|
|
|
logout(); |
|
|
|
|
}, |
|
|
|
|
text: window.t("قصد خروج از حساب کاربری رو داری؟"), |
|
|
|
|
}); |
|
|
|
|
setDrawerOpen(false); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
]; |
|
|
|
|
},[isDark, user]); |
|
|
|
|
|
|
|
|
|
const publicLink = React.useMemo(() => { |
|
|
|
|
return [ |
|
|
|
|
{ |
|
|
|
|
name: window.t("صفحه اصلی"), |
|
|
|
|
link: "/", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={homeIcon} |
|
|
|
|
className="opacity-50 dark:bg-white" |
|
|
|
|
alt={window.t("صفحه اصلی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("ورود یا ثبت نام"), |
|
|
|
|
link: "/signup", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={logoutIcon} |
|
|
|
|
className="opacity-50 dark:bg-white" |
|
|
|
|
alt={window.t("کتابهای من")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: window.t("پشتیبانی"), |
|
|
|
|
link: "/contact-us", |
|
|
|
|
icon: ( |
|
|
|
|
<img |
|
|
|
|
src={dangerIcon} |
|
|
|
|
className="opacity-50 dark:bg-white" |
|
|
|
|
alt={window.t("پشتیبانی")} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
toast: "", |
|
|
|
|
message: "", |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
},[isDark, user]); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<Drawer |
|
|
|
@ -256,21 +262,21 @@ const MyDrawer = ({ |
|
|
|
|
{user?.cellphone} |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
<img |
|
|
|
|
{/* <img |
|
|
|
|
src={arrowLeftVideo} |
|
|
|
|
alt="" |
|
|
|
|
className={`transform ${ |
|
|
|
|
addUserDropdown ? "rotate-90" : "-rotate-90" |
|
|
|
|
} cursor-pointer`}
|
|
|
|
|
onClick={() => setAddUserDropdown(() => !addUserDropdown)} |
|
|
|
|
/> |
|
|
|
|
/> */} |
|
|
|
|
</div> |
|
|
|
|
</header> |
|
|
|
|
<ul |
|
|
|
|
{/* <ul |
|
|
|
|
className={`flex flex-col ${ |
|
|
|
|
addUserDropdown ? "h-20" : "h-0" |
|
|
|
|
} transition-all duration-500`}
|
|
|
|
|
></ul> |
|
|
|
|
></ul> */} |
|
|
|
|
<ul className="h-full flex flex-col py-6 px-4 gap-6"> |
|
|
|
|
{(!user ? publicLink : privateLink).map((item, key) => ( |
|
|
|
|
<Link to={item.link} key={key} onClick={() => item.onClick()}> |
|
|
|
|