Switching to @Radium decorator

This commit is contained in:
John Lyon-Smith
2018-03-22 15:27:12 -07:00
parent 06ae76047e
commit 1b35ac8b22
32 changed files with 115 additions and 122 deletions

View File

@@ -2,12 +2,11 @@ import React from 'react'
import { ProfileForm } from './ProfileForm'
import { api } from 'src/API'
import { WaitModal, MessageModal, ChangePasswordModal, ChangeEmailModal } from '../Modal'
import { autoBind } from 'auto-bind2'
import autobind from 'autobind-decorator'
export class Profile extends React.Component {
constructor(props) {
super(props)
autoBind(this, (name) => (name.startsWith('handle')))
const user = api.loggedInUser
this.state = {
@@ -29,6 +28,7 @@ export class Profile extends React.Component {
api.removeListener('newProfileImage', this.handleNewProfileImage)
}
@autobind
handleSaved(user) {
this.setState({ waitModal: { message: 'Updating Profile' } })
api.updateUser(user).then((updatedUser) => {
@@ -44,14 +44,17 @@ export class Profile extends React.Component {
})
}
@autobind
handleMessageModalDismiss() {
this.setState({ messageModal: null })
}
@autobind
handleChangePassword() {
this.setState({ changePasswordModal: true })
}
@autobind
handleProgress(uploadData) {
if (this.state.progressModal) {
this.setState({ uploadPercent: Math.round(uploadData.uploadedChunks / uploadData.numberOfChunks * 100) })
@@ -61,10 +64,12 @@ export class Profile extends React.Component {
}
}
@autobind
handleUploadCancel(result) {
this.setState({ progressModal: null })
}
@autobind
handleChangePasswordDismiss(passwords) {
this.setState({ changePasswordModal: false })
@@ -86,10 +91,12 @@ export class Profile extends React.Component {
}
}
@autobind
handleChangeEmail() {
this.setState({ changeEmailModal: {} })
}
@autobind
handleChangeEmailDismiss(newEmail) {
this.setState({ changeEmailModal: null })
if (!newEmail) {