From 9852ed44fca2c71e6992e583d4cd3b874b6b18fa Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Thu, 25 Jun 2020 21:48:05 +0300
Subject: upload photo icon appear only on yours profile

---
 src/pages/ProfilePage/ProfileInfo.tsx | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

(limited to 'src/pages/ProfilePage/ProfileInfo.tsx')

diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx
index 2d2c67b..18a9fca 100644
--- a/src/pages/ProfilePage/ProfileInfo.tsx
+++ b/src/pages/ProfilePage/ProfileInfo.tsx
@@ -14,6 +14,7 @@ const useStyles = makeStyles({
   avatar: {
     width: 150,
     height: 150,
+    margin: '0 auto'
   },
   name: {
     fontSize: 20,
@@ -57,18 +58,22 @@ const ProfileInfo: React.FC<PropTypes> = ({ user, logOut }) => {
   const classes = useStyles();
   return (
     <div>
-      <div className={classes.avatarContainer}>
-        <StyledBadge
-          overlap="circle"
-          anchorOrigin={{
-            vertical: 'bottom',
-            horizontal: 'right',
-          }}
-          badgeContent={<CameraAltIcon />}
-         >
-          <Avatar className={classes.avatar} src={user?.avatarUrl} />
-        </StyledBadge>
-      </div>
+      {
+        user?._id === localStorage.getItem('userId')
+          ? <div className={classes.avatarContainer}>
+            <StyledBadge
+              overlap="circle"
+              anchorOrigin={{
+                vertical: 'bottom',
+                horizontal: 'right',
+              }}
+              badgeContent={<CameraAltIcon />}
+            >
+              <Avatar className={classes.avatar} src={user?.avatarUrl} />
+            </StyledBadge>
+          </div>
+          : <Avatar className={classes.avatar} src={user?.avatarUrl} />
+      }
       <div className={classes.name}>
         {user?.username}
       </div>
-- 
cgit v1.2.3

