Skip to content

Commit

Permalink
remove unused variables and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cidneyweng committed Feb 12, 2021
1 parent 94fb3fc commit 3b773a4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 65 deletions.
56 changes: 9 additions & 47 deletions client/src/components/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,12 @@ import * as decode from 'jwt-decode';
import { getAnovaToken } from '../utils/utils';

const Profile = () => {
// constructor(props) {
// super(props);
// this.state = {
// profileimage: 'https://image.flaticon.com/icons/png/128/1141/1141771.png',
// username: '',
// email: '',
// candy: '',
// hobby: '',
// showEdit: false,
// };
const [profileimage, setProfileIMG] = useState('https://image.flaticon.com/icons/png/128/1141/1141771.png');
const profileimage = 'https://image.flaticon.com/icons/png/128/1141/1141771.png';
const [username, setUsername] = useState('');
const [email, setEmail] = useState('');
const [candy, setCandy] = useState('');
const [hobby, setHobby] = useState('');
const [showEdit, setShowEdit] = useState(false);
const [isLoaded, setIsLoaded] = useState('');
const [error, setError] = useState('');


useEffect(() => {
const tok = localStorage.getItem('anovaToken');
Expand All @@ -36,31 +23,16 @@ const Profile = () => {
.then(res => res.json())
.then(
profile => {
setIsLoaded(true);
setUsername(profile[0].name);
setEmail(profile[0].email);
setCandy(profile[0].candy);
setHobby(profile[0].hobby);
// this.setState({
// isLoaded: true,
// username: profile[0].name,
// //TODO: picture
// email: profile[0].email,
// candy: profile[0].candy,
// hobby: profile[0].hobby,
// });
},
error => {
setIsLoaded(true);
setError(error);
// this.setState({
// isLoaded: true,
// error,
// });
console.log(error);
},
);
}, []
);
}, []);

const applyChanges = () => {
const candyEdit = document.getElementById('candyEdit');
Expand All @@ -79,29 +51,19 @@ const Profile = () => {
setShowEdit(false);
setCandy(candyEdit.value);
setHobby(hobbyEdit.value);
// this.setState({
// showEdit: false,
// candy: candyEdit.value,
// hobby: hobbyEdit.value,
// });
});
}
};

const showModal = (bool) => {
const showModal = bool => {
setShowEdit(bool);
// this.setState({ showEdit: bool });
}
};

return (
<div className="profileContainer">
<div className="profileBox">
<Row type="flex">
<Col>
<Avatar
style={{ marginRight: '20px' }}
src={profileimage}
size="large"
/>
<Avatar style={{ marginRight: '20px' }} src={profileimage} size="large" />
</Col>
<Col>
<p id="username" className="title">
Expand Down Expand Up @@ -174,6 +136,6 @@ const Profile = () => {
</div>
</div>
);
}
};

export default Profile;
export default Profile;
10 changes: 3 additions & 7 deletions client/src/components/Roster.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ import RosterCard from './RosterCard';
import 'antd/dist/antd.css';

const Roster = props => {
const [roster, setRoster] = useState([]);
const { ismentor } = props;
// state = {
// roster: [],
// isMentor: this.props.ismentor,
// };

const [roster, setRoster] = useState([]);

useEffect(() => {
const tok = localStorage.getItem('anovaToken');
const dTok = decode(tok);
// const { isMentor } = useState(ismentor);

let rosterFetchCall = `/api/v1/roster?uid=${dTok.id}`;
if (ismentor) {
Expand All @@ -29,7 +25,7 @@ const Roster = props => {
.then(roster => {
setRoster(roster);
});
}, []);
}, [ismentor]);

const rosterCards = roster.map(person => (
<RosterCard key={person.id} person={person} mentor={ismentor} />
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/RosterCard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import '../stylesheets/Roster.css';
import { Card, Button, Modal, Input, Row, Col } from 'antd';
import PropTypes from 'prop-types';
Expand Down
7 changes: 2 additions & 5 deletions client/src/components/SiteLessons.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const SiteLessons = props => {
const [otherLessons, setOtherLessons] = useState([]);
const [modalSelectedValue, setModalSelectedValue] = useState('');
const [modalDate, setModalDate] = useState('');
const [error, setError] = useState('');
const history = useHistory();
const [dTok, setDTok] = useState({});

Expand All @@ -34,7 +33,7 @@ const SiteLessons = props => {
}
};
getToken();
}, []);
}, [history]);

useEffect(() => {
if (Object.keys(dTok).length > 0) {
Expand All @@ -43,8 +42,6 @@ const SiteLessons = props => {
}, [dTok]);

const loadData = () => {
console.log('LOAD DATA DTOK');
console.log(dTok);
fetch(`/api/v1/site/current?uid=${dTok.id}`)
.then(res => res.json())
.then(site => {
Expand Down Expand Up @@ -186,7 +183,7 @@ const SiteLessons = props => {
deleteHandler={deleteHandler}
lessonDetails={lesson}
pool={false}
isMentor={isMentor}
isMentor={ismentor}
/>
))}
{maybeAddCard}
Expand Down
9 changes: 4 additions & 5 deletions client/src/stylesheets/Roster.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 200px;
}

.containerGrid {
background-color: #e6f4fc;
width: 80%;
Expand All @@ -24,13 +26,13 @@
}

@media (max-width: 1024px) {
.containerGrid{
.containerGrid {
grid-template-columns: 50% 50%;
}
}

@media (max-width: 767px) {
.containerGrid{
.containerGrid {
grid-template-columns: 100%;
}
}
Expand All @@ -42,9 +44,6 @@
font-size: 12px;
}




.linktext {
text-decoration: underline;
padding-bottom: 5px;
Expand Down

0 comments on commit 3b773a4

Please sign in to comment.