2018-02-12 14:10:16 +02:00
|
|
|
<template>
|
2018-02-20 15:53:34 +02:00
|
|
|
<div class="nav">
|
2018-02-12 14:10:16 +02:00
|
|
|
<ul>
|
2018-05-27 07:49:09 +03:00
|
|
|
<template v-if="$store.getters.isSignedIn">
|
2018-07-23 08:35:00 +03:00
|
|
|
<li class="home" :class="{ active: $route.name == 'index' }" @click="goToTop">
|
2018-02-19 07:29:42 +02:00
|
|
|
<router-link to="/">
|
2018-02-12 14:10:16 +02:00
|
|
|
%fa:home%
|
2018-04-14 19:04:40 +03:00
|
|
|
<p>%i18n:@home%</p>
|
2018-02-19 07:29:42 +02:00
|
|
|
</router-link>
|
2018-02-12 14:10:16 +02:00
|
|
|
</li>
|
2018-07-23 08:35:00 +03:00
|
|
|
<li class="deck" :class="{ active: $route.name == 'deck' }" @click="goToTop">
|
2018-06-05 15:36:21 +03:00
|
|
|
<router-link to="/deck">
|
|
|
|
%fa:columns%
|
2018-08-29 21:37:23 +03:00
|
|
|
<p>%i18n:@deck%</p>
|
2018-06-05 15:36:21 +03:00
|
|
|
</router-link>
|
|
|
|
</li>
|
2018-02-12 14:10:16 +02:00
|
|
|
<li class="messaging">
|
|
|
|
<a @click="messaging">
|
|
|
|
%fa:comments%
|
2018-04-14 19:04:40 +03:00
|
|
|
<p>%i18n:@messaging%</p>
|
2018-05-28 20:31:32 +03:00
|
|
|
<template v-if="hasUnreadMessagingMessage">%fa:circle%</template>
|
2018-02-12 14:10:16 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
2018-03-07 10:48:32 +02:00
|
|
|
<li class="game">
|
|
|
|
<a @click="game">
|
|
|
|
%fa:gamepad%
|
2018-04-14 20:03:36 +03:00
|
|
|
<p>%i18n:@game%</p>
|
2018-03-07 10:48:32 +02:00
|
|
|
<template v-if="hasGameInvitations">%fa:circle%</template>
|
|
|
|
</a>
|
|
|
|
</li>
|
2018-02-12 14:10:16 +02:00
|
|
|
</template>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-02-18 16:51:41 +02:00
|
|
|
import MkMessagingWindow from './messaging-window.vue';
|
2018-03-07 10:48:32 +02:00
|
|
|
import MkGameWindow from './game-window.vue';
|
2018-02-12 14:10:16 +02:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
2018-03-07 10:48:32 +02:00
|
|
|
hasGameInvitations: false,
|
2018-02-12 14:10:16 +02:00
|
|
|
connection: null,
|
2018-04-09 13:53:15 +03:00
|
|
|
connectionId: null
|
2018-02-12 14:10:16 +02:00
|
|
|
};
|
|
|
|
},
|
2018-05-28 20:31:32 +03:00
|
|
|
computed: {
|
|
|
|
hasUnreadMessagingMessage(): boolean {
|
|
|
|
return this.$store.getters.isSignedIn && this.$store.state.i.hasUnreadMessagingMessage;
|
|
|
|
}
|
|
|
|
},
|
2018-02-12 14:10:16 +02:00
|
|
|
mounted() {
|
2018-05-27 07:49:09 +03:00
|
|
|
if (this.$store.getters.isSignedIn) {
|
2018-02-18 05:35:18 +02:00
|
|
|
this.connection = (this as any).os.stream.getConnection();
|
|
|
|
this.connectionId = (this as any).os.stream.use();
|
2018-02-12 14:10:16 +02:00
|
|
|
|
2018-06-17 02:10:54 +03:00
|
|
|
this.connection.on('reversi_invited', this.onReversiInvited);
|
|
|
|
this.connection.on('reversi_no_invites', this.onReversiNoInvites);
|
2018-02-12 14:10:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
2018-05-27 07:49:09 +03:00
|
|
|
if (this.$store.getters.isSignedIn) {
|
2018-06-17 02:10:54 +03:00
|
|
|
this.connection.off('reversi_invited', this.onReversiInvited);
|
|
|
|
this.connection.off('reversi_no_invites', this.onReversiNoInvites);
|
2018-02-18 05:35:18 +02:00
|
|
|
(this as any).os.stream.dispose(this.connectionId);
|
2018-02-12 14:10:16 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-06-17 02:10:54 +03:00
|
|
|
onReversiInvited() {
|
2018-03-11 11:08:26 +02:00
|
|
|
this.hasGameInvitations = true;
|
|
|
|
},
|
|
|
|
|
2018-06-17 02:10:54 +03:00
|
|
|
onReversiNoInvites() {
|
2018-03-11 11:08:26 +02:00
|
|
|
this.hasGameInvitations = false;
|
2018-02-12 14:10:16 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
messaging() {
|
2018-02-22 16:53:07 +02:00
|
|
|
(this as any).os.new(MkMessagingWindow);
|
2018-03-07 10:48:32 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
game() {
|
|
|
|
(this as any).os.new(MkGameWindow);
|
2018-07-23 08:35:00 +03:00
|
|
|
},
|
|
|
|
|
2018-07-25 22:29:09 +03:00
|
|
|
goToTop() {
|
|
|
|
window.scrollTo({
|
|
|
|
top: 0,
|
|
|
|
behavior: 'smooth'
|
|
|
|
});
|
2018-02-12 14:10:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-26 14:19:35 +03:00
|
|
|
|
2018-03-03 06:47:55 +02:00
|
|
|
|
2018-04-19 22:51:04 +03:00
|
|
|
root(isDark)
|
2018-02-12 14:10:16 +02:00
|
|
|
display inline-block
|
|
|
|
margin 0
|
|
|
|
padding 0
|
|
|
|
line-height 3rem
|
|
|
|
vertical-align top
|
|
|
|
|
|
|
|
> ul
|
|
|
|
display inline-block
|
|
|
|
margin 0
|
|
|
|
padding 0
|
|
|
|
vertical-align top
|
|
|
|
line-height 3rem
|
|
|
|
list-style none
|
|
|
|
|
|
|
|
> li
|
|
|
|
display inline-block
|
|
|
|
vertical-align top
|
|
|
|
height 48px
|
|
|
|
line-height 48px
|
|
|
|
|
|
|
|
&.active
|
|
|
|
> a
|
2018-09-26 14:19:35 +03:00
|
|
|
border-bottom solid 3px var(--primary)
|
2018-02-12 14:10:16 +02:00
|
|
|
|
|
|
|
> a
|
|
|
|
display inline-block
|
|
|
|
z-index 1
|
|
|
|
height 100%
|
|
|
|
padding 0 24px
|
|
|
|
font-size 13px
|
|
|
|
font-variant small-caps
|
2018-04-19 22:51:04 +03:00
|
|
|
color isDark ? #b8c5ca : #9eaba8
|
2018-02-12 14:10:16 +02:00
|
|
|
text-decoration none
|
|
|
|
transition none
|
|
|
|
cursor pointer
|
|
|
|
|
|
|
|
*
|
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
&:hover
|
2018-04-19 22:51:04 +03:00
|
|
|
color isDark ? #fff : darken(#9eaba8, 20%)
|
2018-02-12 14:10:16 +02:00
|
|
|
text-decoration none
|
|
|
|
|
|
|
|
> [data-fa]:first-child
|
|
|
|
margin-right 8px
|
|
|
|
|
|
|
|
> [data-fa]:last-child
|
|
|
|
margin-left 5px
|
|
|
|
font-size 10px
|
2018-09-26 14:19:35 +03:00
|
|
|
color var(--primary)
|
2018-02-12 14:10:16 +02:00
|
|
|
|
|
|
|
@media (max-width 1100px)
|
|
|
|
margin-left -5px
|
|
|
|
|
|
|
|
> p
|
|
|
|
display inline
|
|
|
|
margin 0
|
|
|
|
|
|
|
|
@media (max-width 1100px)
|
|
|
|
display none
|
|
|
|
|
|
|
|
@media (max-width 700px)
|
|
|
|
padding 0 12px
|
|
|
|
|
2018-04-19 22:51:04 +03:00
|
|
|
.nav[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.nav:not([data-darkmode])
|
|
|
|
root(false)
|
|
|
|
|
2018-02-12 14:10:16 +02:00
|
|
|
</style>
|