Merge pull request #2406 from urbit/mp/os1/publish/join-disabler

publish: disable button after joining book
This commit is contained in:
ixv 2020-03-06 12:31:59 -08:00 committed by GitHub
commit af98e6e6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,8 @@ export class JoinScreen extends Component {
this.state = {
book: '/',
error: false,
awaiting: null
awaiting: null,
disable: false
};
this.bookChange = this.bookChange.bind(this);
@ -91,10 +92,11 @@ export class JoinScreen extends Component {
// TODO: askHistory setting
window.api.setSpinner(true);
this.setState({disable: true});
window.api.action("publish","publish-action", actionData).catch((err) => {
console.log(err)
}).then(() => {
this.setState({awaiting: text})
this.setState({awaiting: text, disable: false, book: ""})
window.api.setSpinner(false);
});
@ -110,7 +112,7 @@ export class JoinScreen extends Component {
const { props, state } = this;
let joinClasses = "db f9 green2 ba pa2 b--green2 bg-gray0-d pointer";
if ((!state.book) || (state.book === "/")) {
if ((state.disable) || (!state.book) || (state.book === "/")) {
joinClasses = 'db f9 gray2 ba pa2 b--gray3 bg-gray0-d';
}
@ -154,7 +156,7 @@ export class JoinScreen extends Component {
{errElem}
<br />
<button
disabled={(!state.book) || (state.book === "/")}
disabled={(this.state.disable) || (!state.book) || (state.book === "/")}
onClick={this.onClickJoin.bind(this)}
className={joinClasses}
>Join Chat</button>