|
@ -18,6 +18,7 @@ export default class Upload extends ImmutablePureComponent { |
|
|
media: ImmutablePropTypes.map.isRequired, |
|
|
media: ImmutablePropTypes.map.isRequired, |
|
|
onUndo: PropTypes.func.isRequired, |
|
|
onUndo: PropTypes.func.isRequired, |
|
|
onOpenFocalPoint: PropTypes.func.isRequired, |
|
|
onOpenFocalPoint: PropTypes.func.isRequired, |
|
|
|
|
|
isEditingStatus: PropTypes.func.isRequired, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
handleUndoClick = e => { |
|
|
handleUndoClick = e => { |
|
@ -31,7 +32,7 @@ export default class Upload extends ImmutablePureComponent { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
render () { |
|
|
render () { |
|
|
const { media } = this.props; |
|
|
|
|
|
|
|
|
const { media, isEditingStatus } = this.props; |
|
|
const focusX = media.getIn(['meta', 'focus', 'x']); |
|
|
const focusX = media.getIn(['meta', 'focus', 'x']); |
|
|
const focusY = media.getIn(['meta', 'focus', 'y']); |
|
|
const focusY = media.getIn(['meta', 'focus', 'y']); |
|
|
const x = ((focusX / 2) + .5) * 100; |
|
|
const x = ((focusX / 2) + .5) * 100; |
|
@ -44,7 +45,7 @@ export default class Upload extends ImmutablePureComponent { |
|
|
<div className='compose-form__upload-thumbnail' style={{ transform: `scale(${scale})`, backgroundImage: `url(${media.get('preview_url')})`, backgroundPosition: `${x}% ${y}%` }}> |
|
|
<div className='compose-form__upload-thumbnail' style={{ transform: `scale(${scale})`, backgroundImage: `url(${media.get('preview_url')})`, backgroundPosition: `${x}% ${y}%` }}> |
|
|
<div className={classNames('compose-form__upload__actions', { active: true })}> |
|
|
<div className={classNames('compose-form__upload__actions', { active: true })}> |
|
|
<button className='icon-button' onClick={this.handleUndoClick}><Icon id='times' /> <FormattedMessage id='upload_form.undo' defaultMessage='Delete' /></button> |
|
|
<button className='icon-button' onClick={this.handleUndoClick}><Icon id='times' /> <FormattedMessage id='upload_form.undo' defaultMessage='Delete' /></button> |
|
|
<button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='pencil' /> <FormattedMessage id='upload_form.edit' defaultMessage='Edit' /></button> |
|
|
|
|
|
|
|
|
{!isEditingStatus && (<button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='pencil' /> <FormattedMessage id='upload_form.edit' defaultMessage='Edit' /></button>)} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
)} |
|
|
)} |
|
|