|
@ -12,7 +12,7 @@ const checkUsernameTakenMethod = "isUserNameTaken"; |
|
|
const signUpMethod = "signUp"; |
|
|
const signUpMethod = "signUp"; |
|
|
|
|
|
|
|
|
class UsernameFormContainer extends Component { |
|
|
class UsernameFormContainer extends Component { |
|
|
constructor(props, context) { |
|
|
constructor(props) { |
|
|
super(props); |
|
|
super(props); |
|
|
|
|
|
|
|
|
this.handleInputChange = this.handleInputChange.bind(this); |
|
|
this.handleInputChange = this.handleInputChange.bind(this); |
|
@ -33,7 +33,7 @@ class UsernameFormContainer extends Component { |
|
|
this.setState({ |
|
|
this.setState({ |
|
|
[name]: value, |
|
|
[name]: value, |
|
|
error: false |
|
|
error: false |
|
|
}) |
|
|
}); |
|
|
if (value !== '') { |
|
|
if (value !== '') { |
|
|
if (this.checkedUsernames.length > 0) { |
|
|
if (this.checkedUsernames.length > 0) { |
|
|
if (this.checkedUsernames.some(e => e.usernameChecked === value)){ |
|
|
if (this.checkedUsernames.some(e => e.usernameChecked === value)){ |
|
@ -78,16 +78,16 @@ class UsernameFormContainer extends Component { |
|
|
|
|
|
|
|
|
componentDidUpdate() { |
|
|
componentDidUpdate() { |
|
|
if (this.state.signingUp) { |
|
|
if (this.state.signingUp) { |
|
|
var txHash = this.props.transactionStack[this.stackId]; |
|
|
const txHash = this.props.transactionStack[this.stackId]; |
|
|
if (txHash && this.props.transactions[txHash].status === "error") { |
|
|
if (txHash && this.props.transactions[txHash].status === "error") { |
|
|
this.setState({signingUp: false}); |
|
|
this.setState({signingUp: false}); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
var temp = Object.values(this.props.contracts[contract][checkUsernameTakenMethod]); |
|
|
const temp = Object.values(this.props.contracts[contract][checkUsernameTakenMethod]); |
|
|
this.checkedUsernames = temp.map(checked => {return { |
|
|
this.checkedUsernames = temp.map(checked => {return { |
|
|
usernameChecked: checked.args[0], |
|
|
usernameChecked: checked.args[0], |
|
|
isTaken: checked.value |
|
|
isTaken: checked.value |
|
|
}}) |
|
|
}}); |
|
|
|
|
|
|
|
|
if (this.checkedUsernames.length > 0){ |
|
|
if (this.checkedUsernames.length > 0){ |
|
|
this.checkedUsernames.forEach( checked => { |
|
|
this.checkedUsernames.forEach( checked => { |
|
@ -111,7 +111,7 @@ class UsernameFormContainer extends Component { |
|
|
if(hasSignedUp !== null) { |
|
|
if(hasSignedUp !== null) { |
|
|
const buttonText = hasSignedUp ? "Update" : "Sign Up"; |
|
|
const buttonText = hasSignedUp ? "Update" : "Sign Up"; |
|
|
const placeholderText = hasSignedUp ? this.props.user.username : "Username"; |
|
|
const placeholderText = hasSignedUp ? this.props.user.username : "Username"; |
|
|
var withError = this.state.error && {error: true}; |
|
|
const withError = this.state.error && {error: true}; |
|
|
|
|
|
|
|
|
return( |
|
|
return( |
|
|
<div> |
|
|
<div> |
|
@ -134,7 +134,7 @@ class UsernameFormContainer extends Component { |
|
|
</Form> |
|
|
</Form> |
|
|
<Dimmer active={this.state.signingUp} page> |
|
|
<Dimmer active={this.state.signingUp} page> |
|
|
<Header as='h2' inverted> |
|
|
<Header as='h2' inverted> |
|
|
<Loader size='large'>Magic elfs are processing your nobel request.</Loader> |
|
|
<Loader size='large'>Magic elves are processing your noble request.</Loader> |
|
|
</Header> |
|
|
</Header> |
|
|
</Dimmer> |
|
|
</Dimmer> |
|
|
</div> |
|
|
</div> |
|
|