From 5ec49c0db03d4ec6fd36619055f99c9a3bb34148 Mon Sep 17 00:00:00 2001 From: Tudor Gergely Date: Mon, 13 Mar 2017 15:26:48 +0200 Subject: [PLT-4790] Crop profile picture in middle (#5653) --- webapp/components/user_settings/user_settings_general.jsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'webapp/components/user_settings/user_settings_general.jsx') diff --git a/webapp/components/user_settings/user_settings_general.jsx b/webapp/components/user_settings/user_settings_general.jsx index d50a934a0..18d79e12c 100644 --- a/webapp/components/user_settings/user_settings_general.jsx +++ b/webapp/components/user_settings/user_settings_general.jsx @@ -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 { -- cgit v1.2.3-1-g7c22