Skip to content

social links fix #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions src/user/profile/popups/EditProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class EditProfile extends Component {
location: '',
github: '',
fb: '',
linkedIn: '',
linkedin: '',
twitter: '',
designation: '',
website: '',
longDesc: '',
Expand All @@ -29,7 +30,18 @@ class EditProfile extends Component {

onSave = (e) => {
e.preventDefault();
const { firstName, lastName, designation, location, website, shortDesc, longDesc } = this.state
const {
firstName,
lastName,
designation,
location,
website,
shortDesc,
longDesc,
github,
linkedin,
twitter
} = this.state
const info = {
name: {
firstName,
Expand All @@ -43,6 +55,11 @@ class EditProfile extends Component {
location,
website
}
},
socialMedia: {
github,
linkedin,
twitter
}
}
console.log('Updating data!', this.state)
Expand All @@ -54,6 +71,7 @@ class EditProfile extends Component {
const { userProfile } = nextProps.user
const permissions = nextProps?.org?.org?.options?.permissions
const about = userProfile?.info?.about
const { socialMedia } = userProfile
this.setState({
firstName: userProfile?.name?.firstName,
lastName: userProfile?.name?.lastName,
Expand All @@ -63,7 +81,10 @@ class EditProfile extends Component {
shortDesc: about?.shortDescription,
location: about?.location,
// canChangeEmail: permissions?.canChangeEmail,
canChangeName: permissions?.canChangeName
canChangeName: permissions?.canChangeName,
github: socialMedia?.github,
twitter: socialMedia?.twitter,
linkedin: socialMedia?.linkedin
}, () => {
console.log('updated state ', this.state)
})
Expand All @@ -79,8 +100,10 @@ class EditProfile extends Component {
designation,
website,
longDesc,
canChangeName
// canChangeEmail
canChangeName,
// canChangeEmail,
github,
linkedin,
} = this.state
return (
<Modal onHide={onHide} show={show} className="modal">
Expand Down Expand Up @@ -191,7 +214,7 @@ class EditProfile extends Component {
</Form.Group>
</Form.Row>
<div className="modal__secondary-title">PROFILE</div>
{/* <Form.Row className="modal__row">
<Form.Row className="modal__row">
<Form.Group
as={Col}
controlId="formGridGithub"
Expand All @@ -216,12 +239,12 @@ class EditProfile extends Component {
<Form.Control
type="text"
placeholder="LinkedIn URL"
defaultValue={linkedIn}
defaultValue={linkedin}
name="linkedIn"
onChange={this.onChange}
/>
</Form.Group>
</Form.Row> */}
</Form.Row>
<Form.Row className="modal__row">
<Form.Group
as={Col}
Expand Down
24 changes: 20 additions & 4 deletions src/user/profile/user-info/user-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,49 @@ class UserInfo extends Component {
designation: '',
location: '',
shortDesc: '',
website: ''
website: '',
github: '',
twitter: '',
linkedin: '',
facebook: ''
}
}

componentWillReceiveProps(nextProps) {
console.log('nextProps ', nextProps.userProfile)
const name = nextProps.userProfile?.name || "NA"
const about = nextProps.userProfile?.info?.about;
const { socialMedia } = nextProps.userProfile
this.setState({
name: `${name?.firstName + " " + name?.lastName}`,
designation: about?.designation,
shortDesc: about?.shortDescription,
location: about?.location,
website: about?.website
website: about?.website,
github: socialMedia?.github,
twitter: socialMedia?.twitter,
linkedin: socialMedia?.linkedin,
facebook: socialMedia?.facebook
})
}

onFbClick = () => {
// this.props.history.push()
this.state.facebook
? window.open(`${this.state.facebook}`, '_blank')
: window.location.href = '/profile'
}

onLinkedInClick = () => {

this.state.linkedin
? window.open(`${this.state.linkedin}`, '_blank')
: window.location.href = '/profile'
}

onGithubClick = () => {

this.state.github
? window.open(`${this.state.github}`, '_blank')
: window.location.href = '/profile'
}

render() {
Expand Down