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 Avatar from "../../../../components/Avatar";
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 "./index.scss";
@ -12,7 +12,7 @@ import moon from "./moon.svg";
import sms from "./sms.svg";
import userEdit from "./user-edit.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 ordersIcon from "./orders.svg";
import favoritesIcon from "./favorites.svg";
@ -136,10 +136,10 @@ const SidebarMenu = ({
];
useEffect(() => {
if(!isLogin){
navigate('/');
if (!isLogin) {
navigate("/");
}
},[isLogin]);
}, [isLogin]);
return (
<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"
@ -152,7 +152,9 @@ const SidebarMenu = ({
<div className="flex flex-row items-center mb-10">
<Avatar size={60} rounded={true} />
<p className="text-green7B font-bold text-base flex-1 mx-2">
{user.firstName + " " + user.lastName}
{`${user.firstName === null ? user.firstName : " "}` +
" " +
user.lastName}
</p>
</div>
<Dropdown
@ -204,7 +206,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = {
setDashboardOptions: publicApi.setDashboardOptions,
logout: user.logout,
setDialog : dialog.set,
setDialog: dialog.set,
};
export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu);
@ -222,8 +224,6 @@ SidebarMenu.defaultProps = {
icon: sms,
title: "پشتیبانی",
notification: null,
list: [
{ title: "ثبت نظر", value: "setTicket" },
],
list: [{ title: "ثبت نظر", value: "setTicket" }],
},
};

Loading…
Cancel
Save