mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-11 21:19:43 +00:00
Convert name field into controlled component
This commit is contained in:
parent
6ac9853fd4
commit
aea1c7e6ee
1 changed files with 7 additions and 1 deletions
|
@ -111,6 +111,7 @@ var PublishPage = React.createClass({
|
||||||
this._tempFilePath = null;
|
this._tempFilePath = null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
rawName: '',
|
||||||
name: '',
|
name: '',
|
||||||
bid: '',
|
bid: '',
|
||||||
feeAmount: '',
|
feeAmount: '',
|
||||||
|
@ -152,6 +153,7 @@ var PublishPage = React.createClass({
|
||||||
|
|
||||||
if (!rawName) {
|
if (!rawName) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
rawName: '',
|
||||||
name: '',
|
name: '',
|
||||||
nameResolved: false,
|
nameResolved: false,
|
||||||
});
|
});
|
||||||
|
@ -159,6 +161,10 @@ var PublishPage = React.createClass({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
rawName: rawName,
|
||||||
|
});
|
||||||
|
|
||||||
var name = lbry.formatName(rawName);
|
var name = lbry.formatName(rawName);
|
||||||
|
|
||||||
lbry.resolveName(name, (info) => {
|
lbry.resolveName(name, (info) => {
|
||||||
|
@ -340,7 +346,7 @@ var PublishPage = React.createClass({
|
||||||
<section className="card">
|
<section className="card">
|
||||||
<h4>LBRY Name</h4>
|
<h4>LBRY Name</h4>
|
||||||
<div className="form-row">
|
<div className="form-row">
|
||||||
lbry://<FormField type="text" ref="name" onChange={this.handleNameChange} />
|
lbry://<FormField type="text" ref="name" value={this.state.rawName} onChange={this.handleNameChange} />
|
||||||
{
|
{
|
||||||
(!this.state.name ? '' :
|
(!this.state.name ? '' :
|
||||||
(! this.state.nameResolved ? <em> The name <strong>{this.state.name}</strong> is available.</em>
|
(! this.state.nameResolved ? <em> The name <strong>{this.state.name}</strong> is available.</em>
|
||||||
|
|
Loading…
Add table
Reference in a new issue