gamebrary/src/components/NavHeader/NavHeader.vue

249 lines
6.3 KiB
Vue
Raw Normal View History

2018-10-19 05:15:28 +00:00
<template lang="html">
2018-11-17 22:23:33 +00:00
<nav :class="{ dark: settings && settings.nightMode }">
2018-11-21 02:43:10 +00:00
<router-link
tag="button"
class="logo"
:to="{ name: isHome ? 'platforms' : 'home' }"
>
GAMEBRARY
</router-link>
<button
@click="showShareModal"
v-if="showShareUrl"
class="small share accent"
>
<i class="fas fa-share-alt" />
Share
</button>
2018-11-17 22:23:33 +00:00
<slide width="300">
2018-11-19 02:20:17 +00:00
<main>
<section class="profile">
<gravatar :email="user.email" />
<div class="info">
<strong>{{ user.displayName }}</strong>
{{ user.email }}
</div>
</section>
2018-11-08 03:49:04 +00:00
2018-11-19 02:20:17 +00:00
<section class="actions">
2018-11-08 03:49:04 +00:00
<router-link :to="{ name: 'home' }">
<i class="fas fa-home" />
Home
</router-link>
<router-link :to="{ name: 'platforms' }" v-if="platform">
<i class="fas fa-exchange-alt" />
Change platform
</router-link>
<router-link :to="{ name: 'settings' }">
<i class="fas fa-cog" />
Settings
</router-link>
<a href="https://www.paypal.me/RomanCervantes/5" target="_blank">
<i class="fas fa-donate" />
Donate
</a>
<a href="https://github.com/romancmx/gamebrary/issues" target="_blank">
<i class="fas fa-bug" />
Report bugs
</a>
<a href="https://goo.gl/forms/r0juBCsZaUtJ03qb2" target="_blank">
<i class="fas fa-comments" />
Submit feedback
</a>
<a @click="signOut">
<i class="fas fa-sign-out-alt" />
Sign out
</a>
2018-11-19 02:20:17 +00:00
<p>&copy; 2018 Gamebrary</p>
</section>
</main>
2018-11-17 22:23:33 +00:00
</slide>
2018-10-19 05:15:28 +00:00
</nav>
</template>
<script>
2018-11-08 03:49:04 +00:00
import Gravatar from 'vue-gravatar';
import firebase from 'firebase/app';
import 'firebase/auth';
2018-11-21 02:39:49 +00:00
import { swal, $error } from '@/shared/modals';
2018-11-17 22:23:33 +00:00
import { Slide } from 'vue-burger-menu';
import { mapState } from 'vuex';
2018-10-19 05:15:28 +00:00
export default {
2018-11-08 03:49:04 +00:00
components: {
Gravatar,
2018-11-17 22:23:33 +00:00
Slide,
2018-11-08 03:49:04 +00:00
},
2018-10-19 05:15:28 +00:00
computed: {
2018-11-02 01:42:43 +00:00
...mapState(['user', 'platform', 'settings']),
2018-11-08 03:49:04 +00:00
platformLogo() {
return this.platform.useAlt
? `/static/img/platforms/${this.platform.code}-alt.svg`
: `/static/img/platforms/${this.platform.code}.svg`;
},
2018-11-21 02:43:10 +00:00
isHome() {
return this.$route.name === 'home';
},
showShareUrl() {
return this.$route.name === 'home' && this.platform;
},
shareUrl() {
const url = process.env.NODE_ENV === 'development'
? 'http://localhost:3000'
: 'https://gamebrary.com';
// eslint-disable-next-line
return `${url}/#/s/${this.user.uid}/${this.platform.code}`;
},
2018-11-08 03:49:04 +00:00
},
methods: {
signOut() {
firebase.auth().signOut()
.then(() => {
this.$store.commit('CLEAR_SESSION');
this.$router.push({ name: 'home' });
})
.catch((error) => {
2018-11-21 02:39:49 +00:00
$error(error);
2018-11-08 03:49:04 +00:00
});
},
2018-11-21 02:39:49 +00:00
showShareModal() {
swal({
titleText: 'Share your list',
html: 'Use the following URL to share this list.',
input: 'url',
inputValue: this.shareUrl,
showConfirmButton: false,
});
},
2018-10-19 05:15:28 +00:00
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
@import "~styles/styles.scss";
nav {
2018-11-08 03:49:04 +00:00
user-select: none;
position: fixed;
z-index: 1;
width: 100vw;
2018-11-17 22:23:33 +00:00
height: $navHeight;
2018-10-19 05:15:28 +00:00
display: flex;
2018-11-08 03:49:04 +00:00
justify-content: center;
2018-11-17 22:23:33 +00:00
background: $color-white;
2018-11-08 03:49:04 +00:00
color: $color-dark-gray;
2018-10-29 23:53:49 +00:00
.logo {
2018-11-08 03:49:04 +00:00
height: $navHeight;
2018-10-29 23:53:49 +00:00
font-weight: bold;
2018-11-08 03:49:04 +00:00
}
2018-11-21 02:43:10 +00:00
.share {
position: fixed;
top: $gp / 2;
right: $gp / 2;
}
2018-11-17 22:23:33 +00:00
&.dark {
background: $color-darkest-gray;
color: $color-gray !important;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
.actions {
a {
color: $color-gray;
2018-11-08 03:49:04 +00:00
}
2018-11-18 22:27:47 +00:00
}
.profile {
background: $color-darkest-gray;
.info {
color: $color-gray;
2018-11-17 22:23:33 +00:00
}
2018-11-08 03:49:04 +00:00
}
}
2018-11-17 22:23:33 +00:00
}
.profile {
display: flex;
align-items: center;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
.info {
2018-11-08 03:49:04 +00:00
display: flex;
flex-direction: column;
2018-11-17 22:23:33 +00:00
margin-left: $gp;
color: $color-dark-gray;
2018-10-19 05:15:28 +00:00
}
2018-11-17 22:23:33 +00:00
img {
2018-11-18 22:27:47 +00:00
width: 40px;
height: 40px;
2018-11-17 22:23:33 +00:00
border-radius: 100%;
border: 2px solid $color-white;
box-shadow: 0 0 2px 0px $color-dark-gray;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
@media($small) {
width: 40px;
height: 40px;
2018-11-08 03:49:04 +00:00
}
}
2018-11-17 22:23:33 +00:00
}
2018-11-08 03:49:04 +00:00
2018-11-19 02:20:17 +00:00
main {
height: 100vh;
border-right: 2px solid $color-light-gray;
2018-11-17 22:23:33 +00:00
display: flex;
flex-direction: column;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
a {
color: $color-dark-gray;
2018-11-18 22:27:47 +00:00
grid-template-columns: 40px auto;
margin-bottom: $gp / 2;
2018-11-17 22:23:33 +00:00
display: grid;
align-items: center;
text-decoration: none;
}
i, img {
2018-11-18 22:27:47 +00:00
width: 40px;
height: 40px;
2018-11-17 22:23:33 +00:00
text-align: center;
justify-content: center;
align-items: center;
display: flex;
2018-10-19 05:15:28 +00:00
}
}
2018-11-19 02:31:42 +00:00
.bm-overlay {
nav > div {
background: #0008;
position: fixed;
width: 100%;
height: 100%;
}
}
2018-10-19 05:15:28 +00:00
</style>
2018-11-21 02:39:49 +00:00
<style lang="scss" rel="stylesheet/scss">
.swal2-input {
font-size: 10px !important;
}
</style>