From 28a0027e212cfe2b3f5d397464dbbfe14a5a186c Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Fri, 26 Jun 2020 23:54:55 +0300 Subject: take all info from user to highlight --- src/pages/ProfilePage/ProfileInfo.tsx | 31 ++++++++++--------------------- src/pages/ProfilePage/ProfilePage.tsx | 11 ++++++++++- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src/pages') diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx index 07a6df0..a445b51 100644 --- a/src/pages/ProfilePage/ProfileInfo.tsx +++ b/src/pages/ProfilePage/ProfileInfo.tsx @@ -5,11 +5,15 @@ 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 UserStatus from "../../components/UserStatus/UserStatus"; interface PropTypes { user: User | undefined; logOut: () => void; + savedPolls: number; + totalVotes: number; } const useStyles = makeStyles({ @@ -51,11 +55,7 @@ const useStyles = makeStyles({ }, menuText: { color: 'darkgray' - }, - status: { - textAlign: 'center', - color: 'darkgray' - }, + } }); @@ -69,7 +69,7 @@ const StyledBadge = withStyles((theme) => ({ }, }))(Badge); -const ProfileInfo: React.FC = ({user, logOut}) => { +const ProfileInfo: React.FC = ({user, logOut,savedPolls, totalVotes}) => { const classes = useStyles(); const [input,setInput] = useState('hide'); const urlRef = useRef(); @@ -131,22 +131,11 @@ const ProfileInfo: React.FC = ({user, logOut}) => {
{user?.username}
-
- I am not alcoholic -
+
-
-
11
-
Polls
-
-
-
05.05.2020
-
Since
-
-
-
17
-
Total votes
-
+ + +
); diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index 363d4ff..3506995 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -14,6 +14,7 @@ interface PropTypes { const ProfilePage: React.FC = ({ logOut, id, navigate }) => { const [userInfo, setUserInfo] = useState(); const [polls, setPolls] = useState([]); + const [totalVotes, setTotalVotes] = useState(0); useEffect(() => { get(`/users/${id}`).then(response => { @@ -24,13 +25,21 @@ const ProfilePage: React.FC = ({ logOut, id, navigate }) => { useEffect(() => { get(`/profiles/${id}`).then(response => { setPolls(response.data); + // const x = response.data.reduce((a: any, c: any) => a.contents.left.votes + c.contents.left.votes); + // const y = response.data.reduce((a: any, c: any) => a.contents.right.votes + c.contents.right.votes); + let sum = 0; + for(let i = 0;i - + ); -- cgit v1.2.3