From 030ea12c3e12bd4a599573dbbe9f2bac0c243038 Mon Sep 17 00:00:00 2001 From: jeremiahtenbrink Date: Thu, 14 Mar 2019 12:31:08 -0600 Subject: [PATCH 1/8] Fixed bug for not having enough users to make at least 5 cards. --- src/actions/accountActions.js | 8 +++++++- src/components/CompanyProfile.js | 34 ++++++++++++++++++++++++++++++++ src/components/MainStream.js | 7 ++++++- src/components/UserProfile.js | 13 +++++++++++- src/views/Profile.js | 9 +++++++++ 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 src/components/CompanyProfile.js diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index 5c645d5..99fd1ca 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -27,7 +27,13 @@ export const updateAccountInfo = ( } requestWithToken(token) - .put(url, { ...account }) + .put(url, { + firstName: account.firstName, + lastName: account.lastName, + occupation: account.occupation, + experience: account.experience, + interests: account.interests, + }) .then(res => { debugger; dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); diff --git a/src/components/CompanyProfile.js b/src/components/CompanyProfile.js new file mode 100644 index 0000000..4931375 --- /dev/null +++ b/src/components/CompanyProfile.js @@ -0,0 +1,34 @@ +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core'; + +class CompanyProfile extends Component { + state = {}; + + render() { + const { classes } = this.props; + return ( +
+

CompanyProfile

+
+ ); + } +} + +const styles = { + root: { + marginTop: '3rem', + }, +}; + +CompanyProfile.propTypes = {}; + +function mapStateToProps(state) { + return {}; +} + +export default connect( + mapStateToProps, + {} +)(withStyles(styles)(CompanyProfile)); diff --git a/src/components/MainStream.js b/src/components/MainStream.js index fc2b287..94b5251 100644 --- a/src/components/MainStream.js +++ b/src/components/MainStream.js @@ -23,13 +23,18 @@ class MainStream extends Component { } getCards = () => { + debugger; let cards = []; if (this.props.stream.length === 0) { return cards; } + let length = 5; + if (this.props.stream.length < 5) { + length = this.props.stream.length; + } - for (let i = 0; i < 5; i++) { + for (let i = 0; i < length; i++) { cards.push( { + let chips = []; + let number = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < number; i++) { + chips.push(faker.fake('{{company.bsAdjective}}')); + } + return chips; + }; + onSubmit = e => { e.preventDefault(); debugger; @@ -77,7 +87,7 @@ class UserProfile extends React.Component {

{this.props.profile.occupation}

{this.props.profile.interests ? ( - + ) : ( '' )} @@ -115,6 +125,7 @@ const styles = { root: { height: '100%', width: '100%', + marginTop: '3rem', }, }; diff --git a/src/views/Profile.js b/src/views/Profile.js index 6cdaf32..48cdfc3 100644 --- a/src/views/Profile.js +++ b/src/views/Profile.js @@ -6,6 +6,7 @@ import MyMatches from '../components/MyMatches'; import MiniDrawer from '../components/MiniDrawer'; import JobProfile from '../components/JobProfile'; import UserProfile from '../components/UserProfile'; +import CompanyProfile from '../components/CompanyProfile'; class Profile extends Component { state = { @@ -99,6 +100,14 @@ class Profile extends Component { ) : ( '' )} + {this.state.profileType === 'company' ? ( + + ) : ( + '' + )} From 8a6f4b3034e96cf6081ce33ec99a570ef4dd3c1f Mon Sep 17 00:00:00 2001 From: jeremiahtenbrink Date: Thu, 14 Mar 2019 13:42:31 -0600 Subject: [PATCH 2/8] Fixed bug for not having enough users to make at least 5 cards. --- src/actions/accountActions.js | 50 +++++++++----- src/actions/matchActions.js | 7 +- src/components/CompanyProfile.js | 110 +++++++++++++++++++++++++++++-- src/components/MainStream.js | 1 + src/components/MainStreamCard.js | 11 +++- src/reducers/accountReducer.js | 2 + src/views/Profile.js | 2 +- 7 files changed, 158 insertions(+), 25 deletions(-) diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index 99fd1ca..2396d59 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -26,22 +26,40 @@ export const updateAccountInfo = ( url = `/jobs/update/${account.id}`; } - requestWithToken(token) - .put(url, { - firstName: account.firstName, - lastName: account.lastName, - occupation: account.occupation, - experience: account.experience, - interests: account.interests, - }) - .then(res => { - debugger; - dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); - }) - .catch(err => { - debugger; - dispatch(actionCreator(ERROR, err)); - }); + if (accountType === 'user') { + requestWithToken(token) + .put(url, { + firstName: account.firstName, + lastName: account.lastName, + occupation: account.occupation, + experience: account.experience, + interests: account.interests, + }) + .then(res => { + debugger; + dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); + }) + .catch(err => { + debugger; + dispatch(actionCreator(ERROR, err)); + }); + } else if (accountType === 'company') { + requestWithToken(token) + .put(url, { + companyName: account.companyName, + email: account.email, + bio: account.bio, + address: account.address, + }) + .then(res => { + debugger; + dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); + }) + .catch(err => { + debugger; + dispatch(actionCreator(ERROR, err)); + }); + } }; export const logOut = () => { diff --git a/src/actions/matchActions.js b/src/actions/matchActions.js index 3a8f767..5a971f5 100644 --- a/src/actions/matchActions.js +++ b/src/actions/matchActions.js @@ -19,6 +19,7 @@ export const approveMatch = accountId => async dispatch => { }; export const getStream = (token, accountType) => async dispatch => { + debugger; let url = '/jobs'; if (accountType === 'company') { url = '/users'; @@ -27,12 +28,12 @@ export const getStream = (token, accountType) => async dispatch => { requestWithToken(token) .get(url) .then(res => { - let accountType = 'job'; + let profileType = 'job'; if (accountType === 'company') { - accountType = 'user'; + profileType = 'user'; } res.data = res.data.map(account => { - account.accountType = accountType; + account.accountType = profileType; return account; }); dispatch(actionCreator(MATCHES_FETCHED, res.data)); diff --git a/src/components/CompanyProfile.js b/src/components/CompanyProfile.js index 4931375..19d6b51 100644 --- a/src/components/CompanyProfile.js +++ b/src/components/CompanyProfile.js @@ -2,15 +2,115 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core'; +import DroomButton from './DroomButton'; +import SimpleModal from './SimpleModal'; +import InputText from './InputText'; +import { updateAccountInfo } from '../actions/accountActions'; class CompanyProfile extends Component { - state = {}; + state = { + modal: false, + profile: { + email: this.props.profile.email, + address: this.props.profile.address, + bio: this.props.profile.bio, + companyName: this.props.profile.companyName, + }, + }; + + editProfile = () => { + debugger; + this.setState(state => { + return { modal: !state.modal }; + }); + }; + + getModalContent = props => { + debugger; + return ( +
+ + + + + + + ); + }; + + onChange = e => { + e.persist(); + this.setState(state => { + return { + profile: { + ...state.profile, + [e.target.name]: e.target.value, + }, + }; + }); + }; + + onSubmit = e => { + e.preventDefault(); + debugger; + let profile = {}; + let errors = []; + for (let i = 0; i < e.target.length; i++) { + if (!!e.target[i].name) { + profile[e.target[i].name] = e.target[i].value; + + if (e.target[i].value === '') { + errors.push(e.target[i].name); + } + } + } + + this.props.updateAccountInfo(profile, this.props.token, 'company'); + this.setState({ modal: false }); + }; render() { + debugger; const { classes } = this.props; return (
-

CompanyProfile

+

{this.state.profile.companyName}

+

{this.state.profile.email}

+

{this.state.profile.address}

+

{this.state.profile.bio}

+ {this.props.myProfile && ( + + )} + +
); } @@ -25,10 +125,12 @@ const styles = { CompanyProfile.propTypes = {}; function mapStateToProps(state) { - return {}; + return { + token: state.appReducer.token, + }; } export default connect( mapStateToProps, - {} + { updateAccountInfo } )(withStyles(styles)(CompanyProfile)); diff --git a/src/components/MainStream.js b/src/components/MainStream.js index 94b5251..41a53aa 100644 --- a/src/components/MainStream.js +++ b/src/components/MainStream.js @@ -8,6 +8,7 @@ import { updateAccountInfo } from '../actions/accountActions'; class MainStream extends Component { componentDidMount() { + debugger; let accountType = 'user'; if (this.props.account.hasOwnProperty('companyName')) { diff --git a/src/components/MainStreamCard.js b/src/components/MainStreamCard.js index 003f1fb..15a5bb5 100644 --- a/src/components/MainStreamCard.js +++ b/src/components/MainStreamCard.js @@ -113,6 +113,7 @@ class MainStreamCard extends React.Component { }, }, }; + debugger; return ( ) : ( - + ) ) : ( '' diff --git a/src/reducers/accountReducer.js b/src/reducers/accountReducer.js index def6ce2..58085cb 100644 --- a/src/reducers/accountReducer.js +++ b/src/reducers/accountReducer.js @@ -13,10 +13,12 @@ const initialState = { }; export const accountReducer = (state = initialState, action) => { + debugger; switch (action.type) { case UPDATING_ACCOUNT_INFO: return { ...state, updatingAccountInfo: true }; case ACCOUNT_INFORMATION_UPDATED: + action.payload.account.id = state.account.id; return { ...state, updatingAccountInfo: false, diff --git a/src/views/Profile.js b/src/views/Profile.js index 48cdfc3..e51cf9b 100644 --- a/src/views/Profile.js +++ b/src/views/Profile.js @@ -36,7 +36,7 @@ class Profile extends Component { if (profileType === 'job') { url = `/jobs/${id}`; } else if (profileType === 'company') { - url = `/company/${id}`; + url = `/companies/${id}`; } if (profileType === 'user' && profileOwner) { From 1d3ac205da0637697d694bac91498f4acf565214 Mon Sep 17 00:00:00 2001 From: jeremiahtenbrink Date: Thu, 14 Mar 2019 14:09:56 -0600 Subject: [PATCH 3/8] Fixed scope naming conflict when storing data to local storage. --- src/actions/accountActions.js | 10 +++++----- src/actions/appActions.js | 8 ++++---- src/actions/matchActions.js | 2 +- src/components/AvatarComponent.js | 2 ++ src/components/CompanyProfile.js | 8 ++++---- src/components/LoginForm.js | 2 +- src/components/MainStream.js | 4 ++-- src/components/MainStreamCard.js | 2 +- src/components/RegistrationForm.js | 2 +- src/components/SimpleList.js | 2 +- src/components/UserProfile.js | 4 ++-- src/reducers/accountReducer.js | 2 +- src/views/Profile.js | 8 ++++---- 13 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index 2396d59..abfb1b3 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -18,7 +18,7 @@ export const updateAccountInfo = ( ) => async dispatch => { dispatch(actionCreator(UPDATING_ACCOUNT_INFO)); - debugger; + this.props; let url = `/users/update`; if (accountType === 'company') { url = `/companies/update`; @@ -36,11 +36,11 @@ export const updateAccountInfo = ( interests: account.interests, }) .then(res => { - debugger; + this.props; dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); }) .catch(err => { - debugger; + this.props; dispatch(actionCreator(ERROR, err)); }); } else if (accountType === 'company') { @@ -52,11 +52,11 @@ export const updateAccountInfo = ( address: account.address, }) .then(res => { - debugger; + this.props; dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); }) .catch(err => { - debugger; + this.props; dispatch(actionCreator(ERROR, err)); }); } diff --git a/src/actions/appActions.js b/src/actions/appActions.js index c55ad3b..5f7fb51 100644 --- a/src/actions/appActions.js +++ b/src/actions/appActions.js @@ -14,7 +14,7 @@ let registered = []; export const checkAuthentication = account => async dispatch => { dispatch(actionCreator(CHECKING_AUTHENTICATION)); - debugger; + this.props request() .post('/auth/login', { email: account.email, @@ -32,9 +32,9 @@ export const checkAuthentication = account => async dispatch => { let key = encrypt('token'); let tokenValue = encrypt(res.data.token); localStorage.setItem(key, tokenValue); - let account = encrypt(JSON.stringify(data)); + let accountToStore = encrypt(JSON.stringify(data)); let accountKey = encrypt('account'); - localStorage.setItem(accountKey, account); + localStorage.setItem(accountKey, accountToStore); } dispatch(actionCreator(AUTHENTICATED, res.data.token)); dispatch(actionCreator(LOGGED_IN, data)); @@ -46,7 +46,7 @@ export const checkAuthentication = account => async dispatch => { export const submitRegistration = account => async dispatch => { if (account.type === 'company') { - debugger; + this.props request() .post('/auth/register', { email: account.email, diff --git a/src/actions/matchActions.js b/src/actions/matchActions.js index 5a971f5..c6fc175 100644 --- a/src/actions/matchActions.js +++ b/src/actions/matchActions.js @@ -19,7 +19,7 @@ export const approveMatch = accountId => async dispatch => { }; export const getStream = (token, accountType) => async dispatch => { - debugger; + this.props let url = '/jobs'; if (accountType === 'company') { url = '/users'; diff --git a/src/components/AvatarComponent.js b/src/components/AvatarComponent.js index cd22ed1..2cc3997 100644 --- a/src/components/AvatarComponent.js +++ b/src/components/AvatarComponent.js @@ -22,10 +22,12 @@ class AvatarComponent extends React.Component { }; handlePopOverClose = () => { + this.props this.setState({ popOverElement: null }); }; handleVertIconClick = event => { + this.props this.setState({ popOverElement: event.currentTarget, }); diff --git a/src/components/CompanyProfile.js b/src/components/CompanyProfile.js index 19d6b51..06cea27 100644 --- a/src/components/CompanyProfile.js +++ b/src/components/CompanyProfile.js @@ -19,14 +19,14 @@ class CompanyProfile extends Component { }; editProfile = () => { - debugger; + this.props; this.setState(state => { return { modal: !state.modal }; }); }; getModalContent = props => { - debugger; + this.props; return (
{ e.preventDefault(); - debugger; + this.props; let profile = {}; let errors = []; for (let i = 0; i < e.target.length; i++) { @@ -86,7 +86,7 @@ class CompanyProfile extends Component { }; render() { - debugger; + this.props; const { classes } = this.props; return (
diff --git a/src/components/LoginForm.js b/src/components/LoginForm.js index ed55422..b2e1cf4 100644 --- a/src/components/LoginForm.js +++ b/src/components/LoginForm.js @@ -15,7 +15,7 @@ class LoginForm extends Component { e.preventDefault(); let account = {}; let errors = []; - debugger; + this.props; for (let i = 0; i < e.target.length; i++) { if (!!e.target[i].name) { if (e.target[i].name === 'rememberMe') { diff --git a/src/components/MainStream.js b/src/components/MainStream.js index 41a53aa..51d17e0 100644 --- a/src/components/MainStream.js +++ b/src/components/MainStream.js @@ -8,7 +8,7 @@ import { updateAccountInfo } from '../actions/accountActions'; class MainStream extends Component { componentDidMount() { - debugger; + this.props; let accountType = 'user'; if (this.props.account.hasOwnProperty('companyName')) { @@ -24,7 +24,7 @@ class MainStream extends Component { } getCards = () => { - debugger; + this.props; let cards = []; if (this.props.stream.length === 0) { diff --git a/src/components/MainStreamCard.js b/src/components/MainStreamCard.js index 15a5bb5..ce1bf3b 100644 --- a/src/components/MainStreamCard.js +++ b/src/components/MainStreamCard.js @@ -113,7 +113,7 @@ class MainStreamCard extends React.Component { }, }, }; - debugger; + this.props; return ( ({ }); function SimpleList(props) { - debugger; + this.props const { classes } = props; let url = `/profile/user/${props.account.id}`; if (props.account.hasOwnProperty('companyName')) { diff --git a/src/components/UserProfile.js b/src/components/UserProfile.js index 47686b6..704f2c1 100644 --- a/src/components/UserProfile.js +++ b/src/components/UserProfile.js @@ -57,7 +57,7 @@ class UserProfile extends React.Component { onSubmit = e => { e.preventDefault(); - debugger; + this.props; let profile = {}; let errors = []; for (let i = 0; i < e.target.length; i++) { @@ -76,7 +76,7 @@ class UserProfile extends React.Component { render() { const { classes } = this.props; - debugger; + this.props; return (
{this.props.profile.userImg ? ( diff --git a/src/reducers/accountReducer.js b/src/reducers/accountReducer.js index 58085cb..090c490 100644 --- a/src/reducers/accountReducer.js +++ b/src/reducers/accountReducer.js @@ -13,7 +13,7 @@ const initialState = { }; export const accountReducer = (state = initialState, action) => { - debugger; + this.props; switch (action.type) { case UPDATING_ACCOUNT_INFO: return { ...state, updatingAccountInfo: true }; diff --git a/src/views/Profile.js b/src/views/Profile.js index e51cf9b..92c4f3b 100644 --- a/src/views/Profile.js +++ b/src/views/Profile.js @@ -16,7 +16,7 @@ class Profile extends Component { }; componentDidMount() { - debugger; + this.props; let id = this.props.match.params.id; let profileType = this.props.match.params.accountType; let profileOwner = false; @@ -46,7 +46,7 @@ class Profile extends Component { requestWithToken(this.props.token) .get(url) .then(res => { - debugger; + this.props; if (accountType === 'company' && profileType === 'job') { if (res.data.company_id === this.props.account.id) { profileOwner = true; @@ -59,13 +59,13 @@ class Profile extends Component { }); }) .catch(err => { - debugger; + this.props; console.log(err.message); }); } render() { - debugger; + this.props; const { classes } = this.props; return (
From 9ad35de326adf8db96f49a38064944c365f9777b Mon Sep 17 00:00:00 2001 From: jeremiahtenbrink Date: Thu, 14 Mar 2019 14:13:12 -0600 Subject: [PATCH 4/8] Fixed scope naming conflict when storing data to local storage. --- src/actions/accountActions.js | 5 ----- src/actions/appActions.js | 3 +-- src/actions/matchActions.js | 1 - src/components/AvatarComponent.js | 2 -- src/components/CompanyProfile.js | 5 +---- src/components/LoginForm.js | 2 +- src/components/MainStream.js | 2 -- src/components/MainStreamCard.js | 1 - src/components/RegistrationForm.js | 2 +- src/components/SimpleList.js | 1 - src/components/UserProfile.js | 4 ++-- src/reducers/accountReducer.js | 1 - src/views/Profile.js | 4 ---- 13 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index abfb1b3..0773ab6 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -18,7 +18,6 @@ export const updateAccountInfo = ( ) => async dispatch => { dispatch(actionCreator(UPDATING_ACCOUNT_INFO)); - this.props; let url = `/users/update`; if (accountType === 'company') { url = `/companies/update`; @@ -36,11 +35,9 @@ export const updateAccountInfo = ( interests: account.interests, }) .then(res => { - this.props; dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); }) .catch(err => { - this.props; dispatch(actionCreator(ERROR, err)); }); } else if (accountType === 'company') { @@ -52,11 +49,9 @@ export const updateAccountInfo = ( address: account.address, }) .then(res => { - this.props; dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); }) .catch(err => { - this.props; dispatch(actionCreator(ERROR, err)); }); } diff --git a/src/actions/appActions.js b/src/actions/appActions.js index 5f7fb51..2a82a8e 100644 --- a/src/actions/appActions.js +++ b/src/actions/appActions.js @@ -14,7 +14,7 @@ let registered = []; export const checkAuthentication = account => async dispatch => { dispatch(actionCreator(CHECKING_AUTHENTICATION)); - this.props + request() .post('/auth/login', { email: account.email, @@ -46,7 +46,6 @@ export const checkAuthentication = account => async dispatch => { export const submitRegistration = account => async dispatch => { if (account.type === 'company') { - this.props request() .post('/auth/register', { email: account.email, diff --git a/src/actions/matchActions.js b/src/actions/matchActions.js index c6fc175..8f1f3be 100644 --- a/src/actions/matchActions.js +++ b/src/actions/matchActions.js @@ -19,7 +19,6 @@ export const approveMatch = accountId => async dispatch => { }; export const getStream = (token, accountType) => async dispatch => { - this.props let url = '/jobs'; if (accountType === 'company') { url = '/users'; diff --git a/src/components/AvatarComponent.js b/src/components/AvatarComponent.js index 2cc3997..cd22ed1 100644 --- a/src/components/AvatarComponent.js +++ b/src/components/AvatarComponent.js @@ -22,12 +22,10 @@ class AvatarComponent extends React.Component { }; handlePopOverClose = () => { - this.props this.setState({ popOverElement: null }); }; handleVertIconClick = event => { - this.props this.setState({ popOverElement: event.currentTarget, }); diff --git a/src/components/CompanyProfile.js b/src/components/CompanyProfile.js index 06cea27..ecfdcbb 100644 --- a/src/components/CompanyProfile.js +++ b/src/components/CompanyProfile.js @@ -19,14 +19,12 @@ class CompanyProfile extends Component { }; editProfile = () => { - this.props; this.setState(state => { return { modal: !state.modal }; }); }; getModalContent = props => { - this.props; return ( { e.preventDefault(); - this.props; + let profile = {}; let errors = []; for (let i = 0; i < e.target.length; i++) { @@ -86,7 +84,6 @@ class CompanyProfile extends Component { }; render() { - this.props; const { classes } = this.props; return (
diff --git a/src/components/LoginForm.js b/src/components/LoginForm.js index b2e1cf4..2d08ea5 100644 --- a/src/components/LoginForm.js +++ b/src/components/LoginForm.js @@ -15,7 +15,7 @@ class LoginForm extends Component { e.preventDefault(); let account = {}; let errors = []; - this.props; + for (let i = 0; i < e.target.length; i++) { if (!!e.target[i].name) { if (e.target[i].name === 'rememberMe') { diff --git a/src/components/MainStream.js b/src/components/MainStream.js index 51d17e0..8ac786a 100644 --- a/src/components/MainStream.js +++ b/src/components/MainStream.js @@ -8,7 +8,6 @@ import { updateAccountInfo } from '../actions/accountActions'; class MainStream extends Component { componentDidMount() { - this.props; let accountType = 'user'; if (this.props.account.hasOwnProperty('companyName')) { @@ -24,7 +23,6 @@ class MainStream extends Component { } getCards = () => { - this.props; let cards = []; if (this.props.stream.length === 0) { diff --git a/src/components/MainStreamCard.js b/src/components/MainStreamCard.js index ce1bf3b..52eb125 100644 --- a/src/components/MainStreamCard.js +++ b/src/components/MainStreamCard.js @@ -113,7 +113,6 @@ class MainStreamCard extends React.Component { }, }, }; - this.props; return ( ({ }); function SimpleList(props) { - this.props const { classes } = props; let url = `/profile/user/${props.account.id}`; if (props.account.hasOwnProperty('companyName')) { diff --git a/src/components/UserProfile.js b/src/components/UserProfile.js index 704f2c1..45b4d3a 100644 --- a/src/components/UserProfile.js +++ b/src/components/UserProfile.js @@ -57,7 +57,7 @@ class UserProfile extends React.Component { onSubmit = e => { e.preventDefault(); - this.props; + let profile = {}; let errors = []; for (let i = 0; i < e.target.length; i++) { @@ -76,7 +76,7 @@ class UserProfile extends React.Component { render() { const { classes } = this.props; - this.props; + return (
{this.props.profile.userImg ? ( diff --git a/src/reducers/accountReducer.js b/src/reducers/accountReducer.js index 090c490..372d8ea 100644 --- a/src/reducers/accountReducer.js +++ b/src/reducers/accountReducer.js @@ -13,7 +13,6 @@ const initialState = { }; export const accountReducer = (state = initialState, action) => { - this.props; switch (action.type) { case UPDATING_ACCOUNT_INFO: return { ...state, updatingAccountInfo: true }; diff --git a/src/views/Profile.js b/src/views/Profile.js index 92c4f3b..0de8bbf 100644 --- a/src/views/Profile.js +++ b/src/views/Profile.js @@ -16,7 +16,6 @@ class Profile extends Component { }; componentDidMount() { - this.props; let id = this.props.match.params.id; let profileType = this.props.match.params.accountType; let profileOwner = false; @@ -46,7 +45,6 @@ class Profile extends Component { requestWithToken(this.props.token) .get(url) .then(res => { - this.props; if (accountType === 'company' && profileType === 'job') { if (res.data.company_id === this.props.account.id) { profileOwner = true; @@ -59,13 +57,11 @@ class Profile extends Component { }); }) .catch(err => { - this.props; console.log(err.message); }); } render() { - this.props; const { classes } = this.props; return (
From 77d07dfaceca246a9553ff617057e13ecfd0a63d Mon Sep 17 00:00:00 2001 From: Divya Nair Date: Thu, 14 Mar 2019 15:19:23 -0700 Subject: [PATCH 5/8] remove all debuggers --- src/actions/accountActions.js | 3 --- src/actions/appActions.js | 2 -- src/components/LoginForm.js | 1 - src/components/RegistrationForm.js | 1 - src/components/SimpleList.js | 1 - src/components/UserProfile.js | 3 +-- src/views/Profile.js | 4 ---- 7 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index 5c645d5..8fd5fef 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -18,7 +18,6 @@ export const updateAccountInfo = ( ) => async dispatch => { dispatch(actionCreator(UPDATING_ACCOUNT_INFO)); - debugger; let url = `/users/update`; if (accountType === 'company') { url = `/companies/update`; @@ -29,11 +28,9 @@ export const updateAccountInfo = ( requestWithToken(token) .put(url, { ...account }) .then(res => { - debugger; dispatch(actionCreator(ACCOUNT_INFORMATION_UPDATED, account)); }) .catch(err => { - debugger; dispatch(actionCreator(ERROR, err)); }); }; diff --git a/src/actions/appActions.js b/src/actions/appActions.js index c55ad3b..f0b0230 100644 --- a/src/actions/appActions.js +++ b/src/actions/appActions.js @@ -14,7 +14,6 @@ let registered = []; export const checkAuthentication = account => async dispatch => { dispatch(actionCreator(CHECKING_AUTHENTICATION)); - debugger; request() .post('/auth/login', { email: account.email, @@ -46,7 +45,6 @@ export const checkAuthentication = account => async dispatch => { export const submitRegistration = account => async dispatch => { if (account.type === 'company') { - debugger; request() .post('/auth/register', { email: account.email, diff --git a/src/components/LoginForm.js b/src/components/LoginForm.js index ed55422..5860aba 100644 --- a/src/components/LoginForm.js +++ b/src/components/LoginForm.js @@ -15,7 +15,6 @@ class LoginForm extends Component { e.preventDefault(); let account = {}; let errors = []; - debugger; for (let i = 0; i < e.target.length; i++) { if (!!e.target[i].name) { if (e.target[i].name === 'rememberMe') { diff --git a/src/components/RegistrationForm.js b/src/components/RegistrationForm.js index 7d87f84..527c568 100644 --- a/src/components/RegistrationForm.js +++ b/src/components/RegistrationForm.js @@ -19,7 +19,6 @@ class RegistrationForm extends Component { e.preventDefault(); let account = {}; let errors = []; - debugger; for (let i = 0; i < e.target.length; i++) { if (!!e.target[i].name) { if (e.target[i].name === 'companySwitch') { diff --git a/src/components/SimpleList.js b/src/components/SimpleList.js index 4cb022d..57755d5 100644 --- a/src/components/SimpleList.js +++ b/src/components/SimpleList.js @@ -15,7 +15,6 @@ const styles = theme => ({ }); function SimpleList(props) { - debugger; const { classes } = props; let url = `/profile/user/${props.account.id}`; if (props.account.hasOwnProperty('companyName')) { diff --git a/src/components/UserProfile.js b/src/components/UserProfile.js index 9cb89de..abda8ad 100644 --- a/src/components/UserProfile.js +++ b/src/components/UserProfile.js @@ -47,7 +47,6 @@ class UserProfile extends React.Component { onSubmit = e => { e.preventDefault(); - debugger; let profile = {}; let errors = []; for (let i = 0; i < e.target.length; i++) { @@ -66,7 +65,7 @@ class UserProfile extends React.Component { render() { const { classes } = this.props; - debugger; + return (
{this.props.profile.userImg ? ( diff --git a/src/views/Profile.js b/src/views/Profile.js index 6cdaf32..37a68bf 100644 --- a/src/views/Profile.js +++ b/src/views/Profile.js @@ -15,7 +15,6 @@ class Profile extends Component { }; componentDidMount() { - debugger; let id = this.props.match.params.id; let profileType = this.props.match.params.accountType; let profileOwner = false; @@ -45,7 +44,6 @@ class Profile extends Component { requestWithToken(this.props.token) .get(url) .then(res => { - debugger; if (accountType === 'company' && profileType === 'job') { if (res.data.company_id === this.props.account.id) { profileOwner = true; @@ -58,13 +56,11 @@ class Profile extends Component { }); }) .catch(err => { - debugger; console.log(err.message); }); } render() { - debugger; const { classes } = this.props; return (
From 5a233cbb27270fa84298390d65f5e194a74f1a7c Mon Sep 17 00:00:00 2001 From: jeremiahtenbrink Date: Thu, 14 Mar 2019 16:35:31 -0600 Subject: [PATCH 6/8] Fixed pop over link not closing down. And will now change profiles in the profile view. --- src/App.js | 6 +-- src/actions/accountActions.js | 6 +-- src/actions/appActions.js | 6 +-- src/components/AvatarComponent.js | 64 +++++++++++++++++-------- src/components/CardDetails.js | 14 +++--- src/components/InputText.js | 13 +++-- src/components/JobComponent.js | 16 ++----- src/components/MainStreamCard.js | 7 +-- src/components/MaterialUiPopOver.js | 73 +++++++++++++++++++++++++++++ src/components/MyMatches.js | 6 ++- src/components/SimpleModal.js | 2 +- src/components/SimplePopOver.js | 53 --------------------- src/views/Login.js | 1 - src/views/Profile.js | 30 ++++++++---- 14 files changed, 169 insertions(+), 128 deletions(-) create mode 100644 src/components/MaterialUiPopOver.js delete mode 100644 src/components/SimplePopOver.js diff --git a/src/App.js b/src/App.js index f98f25f..3a5c079 100644 --- a/src/App.js +++ b/src/App.js @@ -1,21 +1,17 @@ import React, { Component } from 'react'; -import logo from './logo.svg'; import { Route, withRouter } from 'react-router-dom'; import PrivateRoute from './components/PrivateRoute'; import './App.scss'; import Main from './views/Main'; import Login from './views/Login'; import { connect } from 'react-redux'; -import { decrypt, encrypt } from './components/Cryptr'; +import { decrypt } from './components/Cryptr'; import { authenticateFromLocalStorage } from './actions/appActions'; import { loggedIn } from './actions/accountActions'; import Profile from './views/Profile'; -import MiniDrawer from './components/MiniDrawer'; -import unsplash from './actions/unsplash'; import Matches from './views/Matches'; import Messages from './views/Messages'; import SignOut from './views/SignOut'; -import MainStream from './components/MainStream'; class App extends Component { state = { diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index 0773ab6..5b2ca24 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -1,16 +1,12 @@ -import apiRequest, { requestWithToken } from './axios'; +import { requestWithToken } from './axios'; import actionCreator from './actionCreator'; -import uuid4 from 'uuid4'; export const UPDATING_ACCOUNT_INFO = 'UPDATING_ACCOUNT_INFO'; export const ACCOUNT_INFORMATION_UPDATED = 'ACCOUNT_INFORMATION_UPDATED'; export const ERROR = 'ERROR'; -export const REGISTERED = 'REGISTERED'; export const LOGGED_IN = 'LOGGED_IN'; export const LOGGED_OUT = 'LOGGED_OUT'; -let registered = []; - export const updateAccountInfo = ( account, token, diff --git a/src/actions/appActions.js b/src/actions/appActions.js index 2a82a8e..5ae64a5 100644 --- a/src/actions/appActions.js +++ b/src/actions/appActions.js @@ -1,7 +1,7 @@ -import { request, requestWithToken } from './axios'; +import { request } from './axios'; import actionCreator from './actionCreator'; import { LOGGED_IN } from './accountActions'; -import { decrypt, encrypt } from '../components/Cryptr'; +import { encrypt } from '../components/Cryptr'; export const CHECKING_AUTHENTICATION = 'CHECKING_AUTHENTICATION'; export const AUTHENTICATED = 'AUTHENTICATED'; @@ -10,8 +10,6 @@ export const REGISTERED = 'REGISTERED'; export const AUTHENTICATED_FROM_LOCAL_STORAGE = 'AUTHENTICATED_FROM_LOCAL_STORAGE'; -let registered = []; - export const checkAuthentication = account => async dispatch => { dispatch(actionCreator(CHECKING_AUTHENTICATION)); diff --git a/src/components/AvatarComponent.js b/src/components/AvatarComponent.js index cd22ed1..d62c592 100644 --- a/src/components/AvatarComponent.js +++ b/src/components/AvatarComponent.js @@ -10,37 +10,71 @@ import { Typography, } from '@material-ui/core'; import red from '@material-ui/core/colors/red'; -import MoreVertIcon from '@material-ui/icons/MoreVert'; import faker from 'faker'; import moment from 'moment'; -import SimplePopover from './SimplePopOver'; import { Link } from 'react-router-dom'; +import uuid4 from 'uuid4'; +import MaterialUiPopOver from './MaterialUiPopOver'; class AvatarComponent extends React.Component { state = { popOverElement: null, + popoverOpen: false, + popoverKey: uuid4(), }; - handlePopOverClose = () => { - this.setState({ popOverElement: null }); + handlePopOverClose = event => { + if (event.target.value !== this.state.popOverElement) { + console.log('click outer'); + if (this.state.popoverOpen === true) { + this.setState(prevState => { + return { + popoverOpen: false, + }; + }); + } + // this.setState(state => { + // console.log('click inner'); + // return { + // popOverElement: null, + // popoverOpen: false, + // }; + // }); + } }; handleVertIconClick = event => { this.setState({ popOverElement: event.currentTarget, + popoverOpen: true, }); }; getPopOverContent = id => { - return ( - - View Profile - - ); + if (this.props.avatar.hasOwnProperty('companyName')) { + return View Profile ; + } + return View Profile; }; + // componentWillUpdate(nextProps, nextState, nextContext) { + // : + // if (nextState.popoverOpen !== this.state.popoverOpen) { + // return true; + // } + // } + render() { const { classes } = this.props; + console.log(this.state); + + let url = `/profile/user/${this.props.avatar.id}`; + if (this.props.avatar.hasOwnProperty('companyName')) { + url = `/profile/company/${this.props.avatar.id}`; + } else if (this.props.avatar.hasOwnProperty('jobTitle')) { + url = `/profile/jobs/${this.props.avatar.id}`; + } + return ( } - action={ - - - - - } + action={} title={this.props.avatar.title} subheader={moment(faker.fake('{{date.past}}')).format( 'dddd, MMMM Do YYYY' diff --git a/src/components/CardDetails.js b/src/components/CardDetails.js index 0f44aa7..c94cfe4 100644 --- a/src/components/CardDetails.js +++ b/src/components/CardDetails.js @@ -8,10 +8,10 @@ import SimpleBottomNavigation from './SimpleBottomNavigation'; const CardDetails = ({ classes, - title, - subheader, - image, - imageTitle = null, + title = '', + subheader = '', + image = '', + imageTitle = '', chips = [], }) => { return ( @@ -36,9 +36,9 @@ const CardDetails = ({ CardDetails.propTypes = { classes: PropTypes.object.isRequired, - title: PropTypes.string.isRequired, - subheader: PropTypes.string.isRequired, - image: PropTypes.string.isRequired, + title: PropTypes.string, + subheader: PropTypes.string, + image: PropTypes.string, imageTitle: PropTypes.string, chips: PropTypes.array, }; diff --git a/src/components/InputText.js b/src/components/InputText.js index 23cf409..19a7610 100644 --- a/src/components/InputText.js +++ b/src/components/InputText.js @@ -1,7 +1,6 @@ -import React, { PureComponent } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import { TextField, withStyles } from '@material-ui/core'; -import classes from 'classnames'; function getName(words) { let splitWords = words.toLowerCase().split(' '); @@ -36,7 +35,15 @@ const InputText = ({ /> ); -InputText.propTypes = {}; +InputText.propTypes = { + label: PropTypes.string, + multiLine: PropTypes.bool, + rows: PropTypes.number, + fullWidth: PropTypes.bool, + name: PropTypes.string, + errors: PropTypes.array, + classes: PropTypes.object.isRequired, +}; const styles = { textField: {}, diff --git a/src/components/JobComponent.js b/src/components/JobComponent.js index 4eb4b5b..4e999c3 100644 --- a/src/components/JobComponent.js +++ b/src/components/JobComponent.js @@ -3,9 +3,9 @@ import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core'; import MoreVertIcon from '@material-ui/icons/MoreVert'; import { Card, CardHeader, IconButton } from '@material-ui/core'; -import SimplePopover from './SimplePopOver'; import { Link } from 'react-router-dom'; import moment from 'moment'; +import MaterialUiPopOver from './AvatarComponent'; class JobComponent extends React.Component { state = { @@ -32,21 +32,13 @@ class JobComponent extends React.Component { render() { const { classes } = this.props; + let url = `/profile/jobs/${this.props.job.id}`; + return (
- - - - } + action={} title={this.props.job.jobTitle} className={classes.cardHeader} subheader={moment(this.props.job.jobOpenDate).format( diff --git a/src/components/MainStreamCard.js b/src/components/MainStreamCard.js index 52eb125..17ad3d1 100644 --- a/src/components/MainStreamCard.js +++ b/src/components/MainStreamCard.js @@ -1,17 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { withStyles, Card, CardHeader, CardMedia } from '@material-ui/core'; +import { withStyles, Card } from '@material-ui/core'; import red from '@material-ui/core/colors/red'; import faker from 'faker'; import Hammer from 'react-hammerjs'; import { connect } from 'react-redux'; import { approveMatch, disApproveMatch } from '../actions/matchActions'; -import ControlledExpansionPanel from './ControlledExpansionPanel'; -import SimpleBottomNavigation from './SimpleBottomNavigation'; -import Chip from './Chip'; import CardDetails from './CardDetails'; -import JobCard from './JobCard'; -import UserCard from './UserCard'; class MainStreamCard extends React.Component { state = { diff --git a/src/components/MaterialUiPopOver.js b/src/components/MaterialUiPopOver.js new file mode 100644 index 0000000..049837c --- /dev/null +++ b/src/components/MaterialUiPopOver.js @@ -0,0 +1,73 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { withStyles, IconButton } from '@material-ui/core'; +import Popper from '@material-ui/core/Popper'; +import Typography from '@material-ui/core/Typography'; +import Button from '@material-ui/core/Button'; +import Fade from '@material-ui/core/Fade'; +import Paper from '@material-ui/core/Paper'; +import MoreVertIcon from '@material-ui/icons/MoreVert'; +import { Link } from 'react-router-dom'; + +const styles = theme => ({ + typography: { + padding: theme.spacing.unit * 2, + }, + navLink: { + color: 'black', + textDecoration: 'none', + }, +}); + +class MaterialUiPopOver extends React.Component { + state = { + anchorEl: null, + open: false, + }; + + handleClick = event => { + const { currentTarget } = event; + this.setState(state => ({ + anchorEl: currentTarget, + open: !state.open, + })); + }; + + render() { + const { classes } = this.props; + const { anchorEl, open } = this.state; + const id = open ? 'simple-popper' : null; + + return ( +
+ + + + + {({ TransitionProps }) => ( + + + +
+ + Profile + +
+
+
+
+ )} +
+
+ ); + } +} + +MaterialUiPopOver.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(MaterialUiPopOver); diff --git a/src/components/MyMatches.js b/src/components/MyMatches.js index ba521a6..7e336d5 100644 --- a/src/components/MyMatches.js +++ b/src/components/MyMatches.js @@ -24,7 +24,7 @@ class MyMatches extends Component {
({ - typography: { - margin: theme.spacing.unit * 2, - }, -}); - -const SimplePopover = ({ - anchorEl, - classes, - handleClose, - getContent, - anchorOrginVert = 'bottom', - anchorOrginHorz = 'center', - transformOrginVert = 'top', - transformOrginHorz = 'center', - id, -}) => { - const open = Boolean(anchorEl); - return ( - - {getContent(id)} - - ); -}; - -SimplePopover.propTypes = { - classes: PropTypes.object.isRequired, - anchorEl: PropTypes.element, - handleClose: PropTypes.func.isRequired, - getContent: PropTypes.func.isRequired, - anchorOrginVert: PropTypes.string, - anchorOrginHorz: PropTypes.string, -}; - -export default withStyles(styles)(SimplePopover); diff --git a/src/views/Login.js b/src/views/Login.js index 9b406c8..78a7c6e 100644 --- a/src/views/Login.js +++ b/src/views/Login.js @@ -32,7 +32,6 @@ class Login extends Component { if (this.props.authenticated) { return ; } - const { classes } = this.props; return ( { + let id = props.match.params.id; + let profileType = props.match.params.accountType; let profileOwner = false; let accountType = 'user'; - if (this.props.account.hasOwnProperty('companyName')) { + if (props.account.hasOwnProperty('companyName')) { accountType = 'company'; } - if ( - parseInt(id) === this.props.account.id && - profileType === accountType - ) { + if (parseInt(id) === props.account.id && profileType === accountType) { profileOwner = true; } @@ -42,11 +43,11 @@ class Profile extends Component { url = `/users/info`; } - requestWithToken(this.props.token) + requestWithToken(props.token) .get(url) .then(res => { if (accountType === 'company' && profileType === 'job') { - if (res.data.company_id === this.props.account.id) { + if (res.data.company_id === props.account.id) { profileOwner = true; } } @@ -59,6 +60,17 @@ class Profile extends Component { .catch(err => { console.log(err.message); }); + }; + + componentWillUpdate(nextProps, nextState, nextContext) { + if ( + nextProps.match.params.id !== this.props.match.params.id || + nextProps.match.params.accountType !== + this.props.match.params.accountType + ) { + this.getProfile(nextProps); + return true; + } } render() { From 45a14cc5bc1a417894d18711420aac212afafef8 Mon Sep 17 00:00:00 2001 From: jeremiahtenbrink Date: Thu, 14 Mar 2019 17:02:47 -0600 Subject: [PATCH 7/8] Merged Everything With Divya's Changes --- src/actions/accountActions.js | 1 + src/components/AvatarComponent.js | 21 +++++++++++++-------- src/components/JobComponent.js | 5 ++--- src/views/Profile.js | 1 + 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/actions/accountActions.js b/src/actions/accountActions.js index 5b2ca24..3b8fbd8 100644 --- a/src/actions/accountActions.js +++ b/src/actions/accountActions.js @@ -14,6 +14,7 @@ export const updateAccountInfo = ( ) => async dispatch => { dispatch(actionCreator(UPDATING_ACCOUNT_INFO)); + //debugger; let url = `/users/update`; if (accountType === 'company') { url = `/companies/update`; diff --git a/src/components/AvatarComponent.js b/src/components/AvatarComponent.js index d62c592..f6d8a3c 100644 --- a/src/components/AvatarComponent.js +++ b/src/components/AvatarComponent.js @@ -66,13 +66,16 @@ class AvatarComponent extends React.Component { render() { const { classes } = this.props; - console.log(this.state); - let url = `/profile/user/${this.props.avatar.id}`; - if (this.props.avatar.hasOwnProperty('companyName')) { - url = `/profile/company/${this.props.avatar.id}`; - } else if (this.props.avatar.hasOwnProperty('jobTitle')) { - url = `/profile/jobs/${this.props.avatar.id}`; + let url = ''; + if (this.props.avatar) { + if (this.props.avatar.hasOwnProperty('companyName')) { + url = `/profile/company/${this.props.avatar.id}`; + } else if (this.props.avatar.hasOwnProperty('jobTitle')) { + url = `/profile/jobs/${this.props.avatar.id}`; + } else { + url = `/profile/user/${this.props.avatar.id}`; + } } return ( @@ -80,13 +83,15 @@ class AvatarComponent extends React.Component { } action={} - title={this.props.avatar.title} + title={this.props.avatar && this.props.avatar.title} subheader={moment(faker.fake('{{date.past}}')).format( 'dddd, MMMM Do YYYY' )} diff --git a/src/components/JobComponent.js b/src/components/JobComponent.js index 4e999c3..5896be2 100644 --- a/src/components/JobComponent.js +++ b/src/components/JobComponent.js @@ -1,11 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core'; -import MoreVertIcon from '@material-ui/icons/MoreVert'; -import { Card, CardHeader, IconButton } from '@material-ui/core'; +import { Card, CardHeader } from '@material-ui/core'; import { Link } from 'react-router-dom'; import moment from 'moment'; -import MaterialUiPopOver from './AvatarComponent'; +import MaterialUiPopOver from './MaterialUiPopOver'; class JobComponent extends React.Component { state = { diff --git a/src/views/Profile.js b/src/views/Profile.js index bcec2cb..0f4592d 100644 --- a/src/views/Profile.js +++ b/src/views/Profile.js @@ -45,6 +45,7 @@ class Profile extends Component { requestWithToken(props.token) .get(url) .then(res => { + debugger; if (accountType === 'company' && profileType === 'job') { if (res.data.company_id === props.account.id) { profileOwner = true; From 0c1cc4ad10916b970279934a8f18b91d2e0e1e36 Mon Sep 17 00:00:00 2001 From: Divya Nair Date: Thu, 14 Mar 2019 16:31:54 -0700 Subject: [PATCH 8/8] toggle hamburger menulist and responsive style it --- src/components/ListItemLink.js | 14 +--- src/components/MiniDrawer.js | 116 ++++++++------------------------- src/components/SimpleList.js | 53 ++++++--------- 3 files changed, 48 insertions(+), 135 deletions(-) diff --git a/src/components/ListItemLink.js b/src/components/ListItemLink.js index dcedbbc..e126452 100644 --- a/src/components/ListItemLink.js +++ b/src/components/ListItemLink.js @@ -1,22 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; import ListItem from '@material-ui/core/ListItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; import { Link } from 'react-router-dom'; -const styles = theme => ({ - root: { - display: 'flex', - flexDirection: 'column', - width: 360, - }, - lists: { - backgroundColor: theme.palette.background.paper, - }, -}); - class ListItemLink extends React.Component { renderLink = itemProps => ; @@ -55,4 +43,4 @@ ListItemLink.propTypes = { // to: PropTypes.string.isRequired, // }; -export default withStyles(styles)(ListItemLink); +export default ListItemLink; diff --git a/src/components/MiniDrawer.js b/src/components/MiniDrawer.js index 834c051..7aea461 100644 --- a/src/components/MiniDrawer.js +++ b/src/components/MiniDrawer.js @@ -1,62 +1,30 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { withStyles, Hidden } from '@material-ui/core'; +import { withStyles } from '@material-ui/core'; import Drawer from '@material-ui/core/Drawer'; -import CssBaseline from '@material-ui/core/CssBaseline'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; -import List from '@material-ui/core/List'; import Typography from '@material-ui/core/Typography'; import Divider from '@material-ui/core/Divider'; -import ListItem from '@material-ui/core/ListItem'; -import ListItemIcon from '@material-ui/core/ListItemIcon'; -import ListItemText from '@material-ui/core/ListItemText'; -import InboxIcon from '@material-ui/icons/MoveToInbox'; -import MailIcon from '@material-ui/icons/Mail'; import MenuIcon from '@material-ui/icons/Menu'; import IconButton from '@material-ui/core/IconButton'; import SimpleList from './SimpleList'; import { Link } from 'react-router-dom'; -const drawerWidth = 240; - -const styles = theme => ({ - root: { - display: 'flex', - }, - appBar: { - marginRight: drawerWidth, - width: '100%', - [theme.breakpoints.down('lg')]: { - width: `calc(100% - ${drawerWidth}px)`, - }, - }, - drawer: { - width: drawerWidth, - flexShrink: 0, - }, - drawerPaper: { - width: drawerWidth, - }, - toolbar: theme.mixins.toolbar, - content: { - flexGrow: 1, - backgroundColor: theme.palette.background.default, - padding: theme.spacing.unit * 3, +const styles = { + menuList: { + minWidth: '15%', + height: '25%', }, header: { - marginLeft: '200px', + display: 'flex', + justifyContent: 'space-between', }, droomLink: { color: 'white', textDecoration: 'none', }, - - menuButton: { - display: 'flex', - alignSelf: 'flex-end', - }, -}); +}; class PermanentDrawerRight extends React.Component { state = { @@ -71,62 +39,34 @@ class PermanentDrawerRight extends React.Component { const { classes } = this.props; return ( -
- - - - - + + + + + + DROOM - - - - - - - - - - - - - - -
- - - - + + + +
); } diff --git a/src/components/SimpleList.js b/src/components/SimpleList.js index 57755d5..afd7958 100644 --- a/src/components/SimpleList.js +++ b/src/components/SimpleList.js @@ -1,19 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; import List from '@material-ui/core/List'; import ListItemLink from './ListItemLink'; import { connect } from 'react-redux'; import AccountBox from '@material-ui/icons/AccountBox'; -const styles = theme => ({ - root: { - width: '100%', - maxWidth: 360, - backgroundColor: theme.palette.background.paper, - }, -}); - function SimpleList(props) { const { classes } = props; let url = `/profile/user/${props.account.id}`; @@ -21,30 +12,24 @@ function SimpleList(props) { url = `/profile/company/${props.account.id}`; } return ( -
- - } - /> - } - /> - } - /> - } - /> - -
+ + } /> + } + /> + } + /> + } + /> + ); } @@ -59,4 +44,4 @@ const mapStateToProps = state => ({ export default connect( mapStateToProps, {} -)(withStyles(styles)(SimpleList)); +)(SimpleList);