|
|
@ -20,7 +20,7 @@ import mobileMail from "~/assets/icons/mobileMail.svg"; |
|
|
|
import mobileProfile from "~/assets/icons/mobileProfile.svg"; |
|
|
|
import mobileProfile from "~/assets/icons/mobileProfile.svg"; |
|
|
|
import mobileDanger from "~/assets/icons/mobileDanger.svg"; |
|
|
|
import mobileDanger from "~/assets/icons/mobileDanger.svg"; |
|
|
|
import mobileLogout from "~/assets/icons/mobileLogout.svg"; |
|
|
|
import mobileLogout from "~/assets/icons/mobileLogout.svg"; |
|
|
|
|
|
|
|
import proxy from "~/Redux/proxy"; |
|
|
|
import "./NavbarDrawer.scss"; |
|
|
|
import "./NavbarDrawer.scss"; |
|
|
|
class NavbarDrawer extends Component { |
|
|
|
class NavbarDrawer extends Component { |
|
|
|
state = { |
|
|
|
state = { |
|
|
@ -28,44 +28,102 @@ class NavbarDrawer extends Component { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
|
|
|
|
const statusx = proxy.status(); |
|
|
|
|
|
|
|
this.links = [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "صفحه اصلی", |
|
|
|
|
|
|
|
link: "/", |
|
|
|
|
|
|
|
icon: <img src={mobileHome} alt="صفحه اصلی" />, |
|
|
|
|
|
|
|
toast: "", |
|
|
|
|
|
|
|
message: "", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "ورود یا ثبت نام", |
|
|
|
|
|
|
|
link: "/auth", |
|
|
|
|
|
|
|
icon: <img src={mobileLogout} alt="کتابهای من" />, |
|
|
|
|
|
|
|
toast: "", |
|
|
|
|
|
|
|
message: "", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "فروشگاه", |
|
|
|
|
|
|
|
link: "/products", |
|
|
|
|
|
|
|
icon: <img src={mobileBlog} alt="کتابهای من" />, |
|
|
|
|
|
|
|
toast: "", |
|
|
|
|
|
|
|
message: "", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "بلاگ", |
|
|
|
|
|
|
|
link: "/blogs", |
|
|
|
|
|
|
|
icon: <img src={mobileBlog} alt="بلاگ" />, |
|
|
|
|
|
|
|
toast: "", |
|
|
|
|
|
|
|
message: "", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "پشتیبانی", |
|
|
|
|
|
|
|
link: "/support", |
|
|
|
|
|
|
|
icon: <img src={mobileDanger} alt="پشتیبانی" />, |
|
|
|
|
|
|
|
toast: "", |
|
|
|
|
|
|
|
message: "", |
|
|
|
|
|
|
|
// onClick: this.props.logout,
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "خروج", |
|
|
|
|
|
|
|
link: "/auth", |
|
|
|
|
|
|
|
icon: <img src={mobileLogout} alt="خروج" />, |
|
|
|
|
|
|
|
toast: "", |
|
|
|
|
|
|
|
message: "", |
|
|
|
|
|
|
|
onClick: () => { |
|
|
|
|
|
|
|
localStorage.removeItem("refresh"); |
|
|
|
|
|
|
|
localStorage.removeItem("access"); |
|
|
|
|
|
|
|
localStorage.removeItem("userData"); |
|
|
|
|
|
|
|
window.location.reload(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]; |
|
|
|
const { status } = this.props; |
|
|
|
const { status } = this.props; |
|
|
|
|
|
|
|
|
|
|
|
let score = 2; |
|
|
|
let score = 2; |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="navbar-drawer d-flex flex-column"> |
|
|
|
<div className="navbar-drawer d-flex flex-column"> |
|
|
|
<div className="navbar-drawer__header d-flex align-items-center"> |
|
|
|
{statusx ? ( |
|
|
|
<> |
|
|
|
<div className="navbar-drawer__header d-flex align-items-center"> |
|
|
|
<Avatar |
|
|
|
<> |
|
|
|
style={{ width: 60, height: 60 }} |
|
|
|
<Avatar |
|
|
|
alt="Remy Sharp" |
|
|
|
style={{ width: 60, height: 60 }} |
|
|
|
src={ |
|
|
|
alt="Remy Sharp" |
|
|
|
status.picFileId |
|
|
|
src={ |
|
|
|
? `https://dnvn.ir/api/v1/file/${status.picFileId}` |
|
|
|
status.picFileId |
|
|
|
: "" |
|
|
|
? `https://dnvn.ir/api/v1/file/${status.picFileId}` |
|
|
|
} |
|
|
|
: "" |
|
|
|
/> |
|
|
|
} |
|
|
|
<div className="navbar-drawer__header--right d-fex flex-column"> |
|
|
|
/> |
|
|
|
<h1>{status.firstName + " " + status.lastName}</h1> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{this.state.dropdown ? ( |
|
|
|
<div className="navbar-drawer__header--right d-fex flex-column"> |
|
|
|
<div |
|
|
|
<h1>{status.firstName + " " + status.lastName}</h1> |
|
|
|
className="navbar-drawer__header--dropdown" |
|
|
|
</div> |
|
|
|
onClick={() => this.setState({ dropdown: false })} |
|
|
|
</> |
|
|
|
> |
|
|
|
|
|
|
|
{score ? <span>{score} امتیاز</span> : null} |
|
|
|
{this.state.dropdown ? ( |
|
|
|
<KeyboardArrowUpIcon style={{ color: "grey", fontSize: 30 }} /> |
|
|
|
<div |
|
|
|
</div> |
|
|
|
className="navbar-drawer__header--dropdown" |
|
|
|
) : ( |
|
|
|
onClick={() => this.setState({ dropdown: false })} |
|
|
|
<div |
|
|
|
> |
|
|
|
className="navbar-drawer__header--dropdown" |
|
|
|
{score ? <span>{score} امتیاز</span> : null} |
|
|
|
onClick={() => this.setState({ dropdown: true })} |
|
|
|
<KeyboardArrowUpIcon style={{ color: "grey", fontSize: 30 }} /> |
|
|
|
> |
|
|
|
</div> |
|
|
|
{score ? <span>{score} امتیاز</span> : null}{" "} |
|
|
|
) : ( |
|
|
|
<KeyboardArrowDownIcon style={{ color: "grey", fontSize: 30 }} /> |
|
|
|
<div |
|
|
|
</div> |
|
|
|
className="navbar-drawer__header--dropdown" |
|
|
|
)} |
|
|
|
onClick={() => this.setState({ dropdown: true })} |
|
|
|
</div> |
|
|
|
> |
|
|
|
|
|
|
|
{score ? <span>{score} امتیاز</span> : null}{" "} |
|
|
|
|
|
|
|
<KeyboardArrowDownIcon |
|
|
|
|
|
|
|
style={{ color: "grey", fontSize: 30 }} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
) : null} |
|
|
|
{this.state.dropdown ? ( |
|
|
|
{this.state.dropdown ? ( |
|
|
|
<div className="navbar-drawer__dropdown d-flex flex-column"> |
|
|
|
<div className="navbar-drawer__dropdown d-flex flex-column"> |
|
|
|
{/* {this.props.users.map((item, i) => ( |
|
|
|
{/* {this.props.users.map((item, i) => ( |
|
|
@ -87,7 +145,7 @@ class NavbarDrawer extends Component { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
<div className="navbar-drawer__bottom mt-3"> |
|
|
|
<div className="navbar-drawer__bottom mt-3"> |
|
|
|
{this.props.links.map((item, key) => ( |
|
|
|
{(statusx ? this.props.links : this.links).map((item, key) => ( |
|
|
|
<Link |
|
|
|
<Link |
|
|
|
to={item.link} |
|
|
|
to={item.link} |
|
|
|
key={key} |
|
|
|
key={key} |
|
|
|