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