diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-27 19:15:41 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-27 19:16:32 +0300 |
commit | 5b08023e0aa0e626264673ebb86dc82299a3b54b (patch) | |
tree | 2f7da24db42266bbe6a5c00d95e89b0a2ea18942 /src/pages/ProfilePage/ProfileInfo.tsx | |
parent | 3d4d7984ccc738f42c7ff287576e7e7e4b470672 (diff) | |
download | which-ui-5b08023e0aa0e626264673ebb86dc82299a3b54b.tar.gz |
style: fix ALL linting errors
Diffstat (limited to 'src/pages/ProfilePage/ProfileInfo.tsx')
-rw-r--r-- | src/pages/ProfilePage/ProfileInfo.tsx | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx index 27966e9..f52e374 100644 --- a/src/pages/ProfilePage/ProfileInfo.tsx +++ b/src/pages/ProfilePage/ProfileInfo.tsx @@ -1,12 +1,11 @@ -import React, {useRef, useState} from 'react'; -import {Avatar, Badge, TextField, withStyles} from '@material-ui/core/'; -import {makeStyles} from '@material-ui/core/styles'; -import {User} from 'which-types'; +import React, { useState } from 'react'; +import { Avatar, Badge } from '@material-ui/core/'; +import { makeStyles } from '@material-ui/core/styles'; +import { User } from 'which-types'; import CameraAltIcon from '@material-ui/icons/CameraAlt'; -import MoreMenu from "./MoreMenu"; -import {patch} from '../../requests'; -import Highlight from "../../components/Highlight/Highlight"; -import UploadImage from "../../components/UploadImage/UploadImage"; +import MoreMenu from './MoreMenu'; +import Highlight from './Highlight'; +import UploadImage from '../../components/UploadImage/UploadImage'; interface PropTypes { @@ -70,50 +69,54 @@ const useStyles = makeStyles(theme => ({ })); -const ProfileInfo: React.FC<PropTypes> = ({user, logOut,savedPolls, totalVotes, setUserInfo,setUser}) => { +const ProfileInfo: React.FC<PropTypes> = ({ + user, logOut, savedPolls, totalVotes, setUserInfo, setUser +}) => { const classes = useStyles(); - const [input,setInput] = useState(false); + const [input, setInput] = useState(false); + + const dateSince = new Date(user?.createdAt || '').toLocaleDateString(); const handleClick = () => { - input === false ? setInput(true) : setInput(false); + setInput(!input); }; return ( <div className={classes.root}> { user?._id === localStorage.getItem('userId') - ? - <div> - <MoreMenu logOut={logOut}/> - <div className={classes.avatarContainer}> - <Badge - onClick={handleClick} - overlap="circle" - anchorOrigin={{ - vertical: 'bottom', - horizontal: 'right', - }} - badgeContent= - { - <div className={classes.badge} > - <CameraAltIcon/> - </div> - } - > - <Avatar className={classes.avatar} src={user?.avatarUrl}/> - </Badge> + ? ( + <div> + <MoreMenu logOut={logOut} /> + <div className={classes.avatarContainer}> + <Badge + onClick={handleClick} + overlap="circle" + anchorOrigin={{ + vertical: 'bottom', + horizontal: 'right' + }} + badgeContent={( + <div className={classes.badge}> + <CameraAltIcon /> + </div> + )} + > + <Avatar className={classes.avatar} src={user?.avatarUrl} /> + </Badge> + </div> + <UploadImage displayD={input} setDisplayD={setInput} setUserInfo={setUserInfo} setUser={setUser} /> </div> - <UploadImage displayD={input} setDisplayD={setInput} setUserInfo={setUserInfo} setUser={setUser}/> - </div> - : <Avatar className={classes.avatar} src={user?.avatarUrl}/> +) + : <Avatar className={classes.avatar} src={user?.avatarUrl} /> } <div className={classes.name}> {user?.username} </div> <div className={classes.profileMenu}> - <Highlight text="Polls" value={savedPolls}/> - <Highlight text="Since" value={user?.createdAt.toString().substring(0,10).replace(/-/g, '.')}/> - <Highlight text="Total" value={totalVotes}/> + <Highlight text="Polls" value={savedPolls} /> + <Highlight text="Since" value={dateSince} /> + <Highlight text="Total" value={totalVotes} /> </div> </div> ); |