update src/views/Dashboard/layouts/SidebarMenu/index.js

temp
mahdi 2 years ago
parent f4178f5e66
commit 7746f99f80
  1. 20
      src/views/Dashboard/layouts/SidebarMenu/index.js

@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import Avatar from "../../../../components/Avatar"; import Avatar from "../../../../components/Avatar";
import { connect } from "react-redux"; import { connect } from "react-redux";
import {useNavigate} from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { publicApi, user, dialog } from "../../../../redux/actions"; import { publicApi, user, dialog } from "../../../../redux/actions";
import "./index.scss"; import "./index.scss";
@ -12,7 +12,7 @@ import moon from "./moon.svg";
import sms from "./sms.svg"; import sms from "./sms.svg";
import userEdit from "./user-edit.svg"; import userEdit from "./user-edit.svg";
import dropdownIcon from "../../../../assets/icons/dropdown-blue.svg"; import dropdownIcon from "../../../../assets/icons/dropdown-blue.svg";
import myVideosIcon from "./myVideos.svg"; import myVideosIcon from "./myVideos.svg";
import myBooksIcon from "./myBooks.svg"; import myBooksIcon from "./myBooks.svg";
import ordersIcon from "./orders.svg"; import ordersIcon from "./orders.svg";
import favoritesIcon from "./favorites.svg"; import favoritesIcon from "./favorites.svg";
@ -136,10 +136,10 @@ const SidebarMenu = ({
]; ];
useEffect(() => { useEffect(() => {
if(!isLogin){ if (!isLogin) {
navigate('/'); navigate("/");
} }
},[isLogin]); }, [isLogin]);
return ( return (
<div <div
className="bg-gray-50 py-5 border-l-2 pl-4 pr-2 shadow-sm border-gray-300 border-solid overflow-y-scroll no-scrollbar divide-y divide-solid divide-gray-200" className="bg-gray-50 py-5 border-l-2 pl-4 pr-2 shadow-sm border-gray-300 border-solid overflow-y-scroll no-scrollbar divide-y divide-solid divide-gray-200"
@ -152,7 +152,9 @@ const SidebarMenu = ({
<div className="flex flex-row items-center mb-10"> <div className="flex flex-row items-center mb-10">
<Avatar size={60} rounded={true} /> <Avatar size={60} rounded={true} />
<p className="text-green7B font-bold text-base flex-1 mx-2"> <p className="text-green7B font-bold text-base flex-1 mx-2">
{user.firstName + " " + user.lastName} {`${user.firstName === null ? user.firstName : " "}` +
" " +
user.lastName}
</p> </p>
</div> </div>
<Dropdown <Dropdown
@ -204,7 +206,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = { const mapDispatchToProps = {
setDashboardOptions: publicApi.setDashboardOptions, setDashboardOptions: publicApi.setDashboardOptions,
logout: user.logout, logout: user.logout,
setDialog : dialog.set, setDialog: dialog.set,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu); export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu);
@ -222,8 +224,6 @@ SidebarMenu.defaultProps = {
icon: sms, icon: sms,
title: "پشتیبانی", title: "پشتیبانی",
notification: null, notification: null,
list: [ list: [{ title: "ثبت نظر", value: "setTicket" }],
{ title: "ثبت نظر", value: "setTicket" },
],
}, },
}; };

Loading…
Cancel
Save