aboutsummaryrefslogtreecommitdiff
path: root/src/client/apis/GoogleAuthenticationManager.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-10-12 19:37:09 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-10-12 19:37:09 -0400
commiteb2957facbd14b2db8a980bd67e8a96ca1cc212e (patch)
treef8a8ed2f919b9e227f6dd6528b3f504f967ea183 /src/client/apis/GoogleAuthenticationManager.tsx
parent988822bdeeed82b0c1ef611f2f7a3111d029d564 (diff)
parent3c91dd189290a75dc5b05f475115e3f34acf5064 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/apis/GoogleAuthenticationManager.tsx')
-rw-r--r--src/client/apis/GoogleAuthenticationManager.tsx29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/client/apis/GoogleAuthenticationManager.tsx b/src/client/apis/GoogleAuthenticationManager.tsx
index d143d8273..01dac3996 100644
--- a/src/client/apis/GoogleAuthenticationManager.tsx
+++ b/src/client/apis/GoogleAuthenticationManager.tsx
@@ -19,6 +19,8 @@ export default class GoogleAuthenticationManager extends React.Component<{}> {
@observable private clickedState = false;
@observable private success: Opt<boolean> = undefined;
@observable private displayLauncher = true;
+ @observable private avatar: Opt<string> = undefined;
+ @observable private username: Opt<string> = undefined;
private set isOpen(value: boolean) {
runInAction(() => this.openState = value);
@@ -40,10 +42,14 @@ export default class GoogleAuthenticationManager extends React.Component<{}> {
authenticationCode => {
if (authenticationCode) {
Identified.PostToServer(RouteStore.writeGoogleAccessToken, { authenticationCode }).then(
- token => {
+ ({ access_token, avatar, name }) => {
+ runInAction(() => {
+ this.avatar = avatar;
+ this.username = name;
+ });
this.beginFadeout();
disposer();
- resolve(token);
+ resolve(access_token);
},
action(() => {
this.hasBeenClicked = false;
@@ -61,15 +67,18 @@ export default class GoogleAuthenticationManager extends React.Component<{}> {
beginFadeout = action(() => {
this.success = true;
+ this.authenticationCode = undefined;
+ this.displayLauncher = false;
+ this.hasBeenClicked = false;
setTimeout(action(() => {
this.isOpen = false;
- this.displayLauncher = false;
setTimeout(action(() => {
this.success = undefined;
this.displayLauncher = true;
- this.hasBeenClicked = false;
+ this.avatar = undefined;
+ this.username = undefined;
}), 500);
- }), 2000);
+ }), 3000);
});
constructor(props: {}) {
@@ -88,7 +97,7 @@ export default class GoogleAuthenticationManager extends React.Component<{}> {
private get renderPrompt() {
return (
- <div style={{ display: "flex", flexDirection: "column" }}>
+ <div className={'authorize-container'}>
{this.displayLauncher ? <button
className={"dispatch"}
onClick={this.handleClick}
@@ -99,6 +108,14 @@ export default class GoogleAuthenticationManager extends React.Component<{}> {
onChange={this.handlePaste}
placeholder={prompt}
/> : (null)}
+ {this.avatar ? <img
+ className={'avatar'}
+ src={this.avatar}
+ /> : (null)}
+ {this.username ? <span
+ className={'welcome'}
+ >Welcome to Dash, {this.username}
+ </span> : (null)}
</div>
);
}