Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Commit

Permalink
Changes to the popup to fit Stadia+DB
Browse files Browse the repository at this point in the history
  • Loading branch information
Mafrans committed Aug 22, 2020
1 parent 4cf8f86 commit dd8ff97
Show file tree
Hide file tree
Showing 15 changed files with 522 additions and 340 deletions.
13 changes: 13 additions & 0 deletions dist/2509d2a0f85cd6711e47a76d3ae6fc1a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions dist/app.js

Large diffs are not rendered by default.

592 changes: 360 additions & 232 deletions dist/popup.js

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/StadiaPlusDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class StadiaPlusDB {
})
}

console.log(`${StadiaPlusDB.url}/auth/google?redirect=${chrome.identity.getRedirectURL('database')}`);
chrome.identity.launchWebAuthFlow(
{
url: `${StadiaPlusDB.url}/auth/google?redirect=${chrome.identity.getRedirectURL('database')}`,
Expand All @@ -84,6 +85,16 @@ export class StadiaPlusDB {
);
});
}

static signout(): Promise<any> {
return axios({
method: 'post',
url: `${StadiaPlusDB.url}/api/signout`,
data: {
token: StadiaPlusDB.authToken
},
});
}
}

export class LFGConnector {
Expand All @@ -102,7 +113,7 @@ export class LFGConnector {
method: 'post',
url: `${StadiaPlusDB.url}/api/lfg`,
data: {
authToken: StadiaPlusDB.authToken,
token: StadiaPlusDB.authToken,
game: game
},
})
Expand Down
7 changes: 4 additions & 3 deletions src/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
"github": "Github"
},
"user-page": {
"title": "Profile",
"motd": "Hello {{name}}!",
"login-with-google": "Login with Google"
"title": "Login",
"login-button": "Sign in with Google",
"accept-label": "By signing into Stadia+ DB you accept the",
"privacy-policy": "privacy policy"
},
"settings-page": {
"title": "Settings",
Expand Down
4 changes: 4 additions & 0 deletions src/popup/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ hr {
margin: 0 -0.5rem;
}
.container {
padding: 1rem;
}
.col {
margin: 0 0.5rem;
width: 100%;
Expand Down
4 changes: 0 additions & 4 deletions src/popup/src/ComponentPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ export default {
</script>

<style lang="scss" scoped>
.container {
padding: 1rem;
}
.components {
height: 250px;
overflow-y: scroll;
Expand Down
4 changes: 0 additions & 4 deletions src/popup/src/DeveloperPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ export default {
</script>

<style lang="scss" scoped>
.container {
padding: 1rem;
}
h3 {
margin-bottom: 0.5rem;
}
Expand Down
10 changes: 1 addition & 9 deletions src/popup/src/MainPage.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<template>
<div class="main-page">
<div class="container">
<page-header
:img="logo"
icon="settings"
v-on:icon-click="settings"
>{{ Language.get('popup.main-page.title') }}</page-header
>
<page-header :img="logo" >{{ Language.get('popup.main-page.title') }}</page-header >
<p>
{{ Language.get('popup.main-page.ready-text') }}
</p>
Expand Down Expand Up @@ -84,7 +79,4 @@ export default {
</script>

<style lang="scss" scoped>
.container {
padding: 1rem;
}
</style>
4 changes: 0 additions & 4 deletions src/popup/src/SettingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ export default {
</script>

<style lang="scss" scoped>
.container {
padding: 1rem;
}
.icon {
float: left;
margin-right: 4px;
Expand Down
72 changes: 19 additions & 53 deletions src/popup/src/UserPage.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
<template>
<div class="user-page">
<div class="container">
<page-header :back-button="true">{{
Language.get('popup.user-page.title')
}}</page-header>
<page-header :back-button="true">{{ Language.get('popup.user-page.title') }}</page-header>

<div v-if="user != null" class="profile">
<div v-if="!loading" class="login">
<div class="row">
<div class="col">
<img :src="user.picture" alt="The profile image" />
<h1>
{{
Language.get('popup.user-page.motd', {
name: user.given_name,
})
}}
</h1>
<btn v-on:click="authenticate">
<icon><img :src="'/dist/' + GoogleG"/></icon>
{{ Language.get( 'popup.user-page.login-button' ) }}
</btn>
</div>
</div>
</div>
<div v-else-if="!loading" class="login">
<div class="row">
<div class="col">
<btn v-on:click="authenticate">
{{
Language.get(
'popup.user-page.login-with-google'
)
}}
</btn>
{{ Language.get( 'popup.user-page.accept-label' ) }}
<a :href="StadiaPlusDB.url + '/privacy-policy'" target="_blank">
{{ Language.get('popup.user-page.privacy-policy') }}
</a>
</div>
</div>
</div>
Expand All @@ -47,6 +36,7 @@
import Icon from './components/Icon.vue';
import PageHeader from './components/PageHeader.vue';
import Button from './components/Button.vue';
import GoogleG from './assets/Google G.svg';
import { Language } from '../../Language';
import { SyncStorage, LocalStorage } from '../../Storage';
import { StadiaPlusDB } from '../../StadiaPlusDB';
Expand All @@ -55,8 +45,10 @@ export default {
data() {
return {
Language: Language,
StadiaPlusDB: StadiaPlusDB,
user: null,
loading: true,
loading: false,
GoogleG,
};
},
components: {
Expand All @@ -69,45 +61,19 @@ export default {
this.loading = true;
StadiaPlusDB.authenticate().then(() => {
StadiaPlusDB.getProfile().then((profile) => {
(this.user = profile), (this.loading = false);
});
});
},
},
created() {
LocalStorage.AUTH_TOKEN.get((response) => {
StadiaPlusDB.authToken = response[LocalStorage.AUTH_TOKEN.tag];
StadiaPlusDB.getProfile()
.then((profile) => {
this.user = profile;
this.loading = false;
console.log({ profile });
})
.catch(() => {
StadiaPlusDB.authToken = null;
this.loading = false;
Logger.error('Authentication failed, was it cancelled?');
this.$router.go(-1);
});
});
},
});
},
}
};
</script>

<style lang="scss" scoped>
.container {
padding: 1rem;
}
h3 {
.row {
margin-bottom: 0.5rem;
}
.profile img {
margin-bottom: 0.25rem;
width: 60px;
height: 60px;
border-radius: 50%;
border: 2px solid #eaeaea;
}
</style>
13 changes: 13 additions & 0 deletions src/popup/src/assets/Google G.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 17 additions & 2 deletions src/popup/src/components/Icon.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
<template>
<span class="material-icons" v-on:click="click"><slot /></span>
<span class="material-icons" :class="{['type-' + type]: type != undefined}" v-on:click="click"><slot /></span>
</template>

<style lang="scss" scoped>
.type- {
&inline {
font-size: 1em;
vertical-align: text-top;
}
}
</style>

<script>
export default {
methods: {
click() {
this.$emit('click');
}
}
},
props: [
'type'
]
}
</script>
Loading

0 comments on commit dd8ff97

Please sign in to comment.