diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-10-09 23:21:17 -0400 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-10-09 23:21:17 -0400 |
commit | bd346692a29ea5c0960bbb086c856c4890d7c089 (patch) | |
tree | 2d4c3effb44ea9957f6801139b1f18d68df477dc | |
parent | bfdbc495c0327b87ee0f896778968e65e2f18af6 (diff) |
cleanup
-rw-r--r-- | src/client/apis/GoogleAuthenticationManager.tsx | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/client/apis/GoogleAuthenticationManager.tsx b/src/client/apis/GoogleAuthenticationManager.tsx index db108ad94..d143d8273 100644 --- a/src/client/apis/GoogleAuthenticationManager.tsx +++ b/src/client/apis/GoogleAuthenticationManager.tsx @@ -41,23 +41,14 @@ export default class GoogleAuthenticationManager extends React.Component<{}> { if (authenticationCode) { Identified.PostToServer(RouteStore.writeGoogleAccessToken, { authenticationCode }).then( token => { - runInAction(() => this.success = true); - setTimeout(() => { - this.isOpen = false; - runInAction(() => this.displayLauncher = false); - setTimeout(() => { - runInAction(() => this.success = undefined); - runInAction(() => this.displayLauncher = true); - this.hasBeenClicked = false; - }, 500); - }, 1000); + this.beginFadeout(); disposer(); resolve(token); }, - () => { + action(() => { this.hasBeenClicked = false; - runInAction(() => this.success = false); - } + this.success = false; + }) ); } } @@ -68,6 +59,19 @@ export default class GoogleAuthenticationManager extends React.Component<{}> { return response; } + beginFadeout = action(() => { + this.success = true; + setTimeout(action(() => { + this.isOpen = false; + this.displayLauncher = false; + setTimeout(action(() => { + this.success = undefined; + this.displayLauncher = true; + this.hasBeenClicked = false; + }), 500); + }), 2000); + }); + constructor(props: {}) { super(props); GoogleAuthenticationManager.Instance = this; @@ -99,6 +103,11 @@ export default class GoogleAuthenticationManager extends React.Component<{}> { ); } + private get dialogueBoxStyle() { + const borderColor = this.success === undefined ? "black" : this.success ? "green" : "red"; + return { borderColor, transition: "0.2s borderColor ease" }; + } + render() { return ( <MainViewModal @@ -106,7 +115,7 @@ export default class GoogleAuthenticationManager extends React.Component<{}> { interactive={true} contents={this.renderPrompt} overlayDisplayedOpacity={0.9} - dialogueBoxStyle={{ borderColor: this.success === undefined ? "black" : this.success ? "green" : "red" }} + dialogueBoxStyle={this.dialogueBoxStyle} /> ); } |