// src/components/TransferOwnership.js
import React, { Component } from 'react'
import { connect } from 'react-redux'
import * as photoActions from 'redux/actions/photos'
import ui from 'utils/ui'
import { isValidAddress } from 'utils/crypto'
import Input from 'components/Input'
import Button from 'components/Button'
import './TransferOwnership.scss'
class TransferOwnership extends Component {
handleInputChange = (e) => {
[e.target.name]: e.target.value,
const { id, transferOwnership } = this.props
const { to } = this.state
if (!isValidAddress(to)) {
warningMessage: '* Invalid wallet address',
transferOwnership(id, to)
const { id, issueDate, currentOwner } = this.props
<div className="TransferOwnership">
<h3 className="TransferOwnership__copyright">Copyright. {id}</h3>
<p className="TransferOwnership__issueDate">Issue Date {issueDate}</p>
<form className="TransferOwnership__form" onSubmit={this.handleSubmit}>
className="TransferOwnership__from"
className="TransferOwnership__to"
onChange={this.handleInputChange}
placeholder="Transfer Ownership to..."
err={this.state.warningMessage}
title="Transfer Ownership"
const mapDispatchToProps = (dispatch) => ({
transferOwnership: (id, to) => dispatch(photoActions.transferOwnership(id, to)),
export default connect(null, mapDispatchToProps)(TransferOwnership)