[PLT-4790] Crop profile picture in middle (#5653)

Этот коммит содержится в:
Tudor Gergely
2017-03-13 15:26:48 +02:00
коммит произвёл Christopher Speller
родитель b299bc8999
Коммит 5ec49c0db0
2 изменённых файлов: 53 добавлений и 12 удалений

Просмотреть файл

@@ -101,6 +101,7 @@ class UserSettingsGeneralTab extends React.Component {
this.updatePicture = this.updatePicture.bind(this);
this.updateSection = this.updateSection.bind(this);
this.updatePosition = this.updatePosition.bind(this);
this.updatedCroppedPicture = this.updatedCroppedPicture.bind(this);
this.state = this.setupInitialState(props);
}
@@ -311,6 +312,17 @@ class UserSettingsGeneralTab extends React.Component {
this.setState({confirmEmail: e.target.value});
}
updatedCroppedPicture(file) {
if (file) {
this.setState({picture: file});
this.submitActive = true;
this.setState({clientError: null});
} else {
this.setState({picture: null});
}
}
updatePicture(e) {
if (e.target.files && e.target.files[0]) {
this.setState({picture: e.target.files[0]});
@@ -1088,6 +1100,7 @@ class UserSettingsGeneralTab extends React.Component {
pictureChange={this.updatePicture}
submitActive={this.submitActive}
loadingPicture={this.state.loadingPicture}
imageCropChange={this.updatedCroppedPicture}
/>
);
} else {