import React, { Component } from "react"; import { connect } from "react-redux"; import AddCircleOutlineRoundedIcon from "@material-ui/icons/AddCircleOutlineRounded"; import { Link } from "react-router-dom"; import { toast } from "react-toastify"; import Avatar from "@material-ui/core/Avatar"; import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp"; import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown"; import { user } from "~/Redux/actions"; import mobileHome from "~/assets/icons/mobileHome.svg"; import mobileAr from "~/assets/icons/mobileAr.svg"; import qrcode from "~/assets/icons/drawer-qr.png"; import mobileBasket from "~/assets/icons/mobileBasket.svg"; import mobileBlog from "~/assets/icons/mobileBlog.svg"; import mobileMail from "~/assets/icons/mobileMail.svg"; import mobileProfile from "~/assets/icons/mobileProfile.svg"; import mobileDanger from "~/assets/icons/mobileDanger.svg"; import mobileLogout from "~/assets/icons/mobileLogout.svg"; import proxy from "~/Redux/proxy"; import "./NavbarDrawer.scss"; class NavbarDrawer extends Component { state = { dropdown: false, }; render() { const statusx = proxy.status(); this.links = [ { name: window.t("صفحه اصلی"), link: "/", icon: {window.t("صفحه, toast: "", message: "", }, { name: "ورود یا ثبت نام", link: "/auth", icon: {window.t("کتاب‌های, toast: "", message: "", }, { name: window.t("درباره ما"), link: "/about", icon: {window.t("کتاب‌های, toast: "", message: "", }, { name: window.t("فروشگاه"), link: "/products", icon: {window.t("کتاب‌های, toast: "", message: "", }, { name: window.t("سبد خرید"), link: "/cart", icon: {window.t("کتاب‌های, toast: "", message: "", }, { name: "بلاگ", link: "/blogs", icon: بلاگ, toast: "", message: "", }, { name: window.t("پشتیبانی"), link: "/support", icon: {window.t("پشتیبانی")}, toast: "", message: "", // onClick: this.props.logout, }, ]; this.links2 = [ { name: window.t("صفحه اصلی"), link: "/", icon: {window.t("صفحه, toast: "", message: "", }, { name: window.t("واقعیت افزوده"), link: "/ar", icon: {window.t("واقعیت, toast: "", message: "", }, { name: window.t("بارکد خوان"), link: "/qr-scan", icon: {window.t("بارکد, toast: "", message: "", }, { name: window.t("کتاب‌های من"), link: "/mybooks", icon: {window.t("کتاب‌های, toast: "", message: "", }, { name: window.t("سبد خرید"), link: "/cart", icon: {window.t("فروشگاه")}, toast: "", message: "", }, { name: "بلاگ", link: "/blogs", icon: بلاگ, toast: "", message: "", }, { name: window.t("دانوینی‌ها"), link: "/", icon: {window.t("دانوینی‌ها")}, toast: window.t("به زودی این بخش فعال می شود"), message: "به زودی", }, { name: window.t("پشتیبانی"), link: "/support", icon: {window.t("پشتیبانی")}, toast: "", message: "", // onClick: this.props.logout, }, { name: window.t("ویرایش مشخصات"), link: "/profile", icon: {window.t("ویرایش, toast: "", // message: "4 پیام", }, { name: window.t("بروز رسانی"), link: "/", icon: {window.t("خروج")}, toast: "", message: "", onClick: () => { window.location.reload(true); }, }, { name: window.t("خروج"), link: "/auth", icon: {window.t("خروج")}, toast: "", message: "", onClick: () => { this.props.logout({}); }, }, ]; const { status } = this.props; let score = 2; return (
{statusx ? (
<>

{status.firstName + " " + status.lastName}

{this.state.dropdown ? (
this.setState({ dropdown: false })} > {score ? {score} امتیاز : null}
) : (
this.setState({ dropdown: true })} > {score ? {score} امتیاز : null}{" "}
)}
) : null} {this.state.dropdown ? (
{/* {this.props.users.map((item, i) => ( ))} */}
اضافه کردن کاربر
{/* {item.message &&
{item.message}
} */}
) : null}
{(statusx ? this.links2 : this.links).map((item, key) => ( (item.link === "" ? toast.error(item.toast) : null)) } >
{item.icon}
{item.name}
{item.message &&
{item.message}
}
))} {/*
نسخه نرم‌افزار 3.1
*/}
); } } export default connect((state) => ({ status: state.user.status }), { logout: user.logout, })(NavbarDrawer);